diff --git a/conf/le6/testing/create-iso.conf b/conf/le6/testing/create-iso.conf index 09408387650c5e1e164903baacb1d0c4dada7fe0..296f0d2f7b13dc8e9fc3ec007412c96147256d1e 100644 --- a/conf/le6/testing/create-iso.conf +++ b/conf/le6/testing/create-iso.conf @@ -1,7 +1,7 @@ SHORTNAME=le6 -TMP=/home/lucas/${_DIST}/ -CHROOTDIR=/home/lucas/create-iso/overlay -OVERLAY=/home/lucas/tmp +TMP=/home/${SUDO_USER}/${_DIST}/ +CHROOTDIR=/home/${SUDO_USER}/overlay +TMPFS=/home/${SUDO_USER}/tmp CHROOTFILE=${TMP}/todo.sh DISTRO=Linux_Educacional_6.1.0 DPLIST=${PREFIX}/pkg-list/${_DIST}/dependencies.list diff --git a/lib/mktmpfs.sh b/lib/mktmpfs.sh new file mode 100644 index 0000000000000000000000000000000000000000..b9c1dbd87add0d268e6e474e8cf16960db0f4835 --- /dev/null +++ b/lib/mktmpfs.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# +# Copyright (C) 2017 Centro de Computacao Cientifica e Software Livre +# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR +# +# This file is part of create-iso +# +# create-iso is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. + +mountTmpfs() { + local TMPFS=$1 + + if mount | grep -q ${TMPFS}; then + return 1 + fi + mkdir -p ${TMPFS} + if [ ! -d "${TMPFS}" ]; then + echo "overlay path: '${TMPFS}' has not been found." + exit 1 + fi + mount -t tmpfs tmpfs -o suid,dev,size=6291456k ${TMPFS} +} + +umountTmpfs() { + local TMPFS=$1 + if mountpoint -q ${TMPFS}; then + umount ${TMPFS} + fi + rm -r ${TMPFS} +} diff --git a/lib/overlay.sh b/lib/overlay.sh new file mode 100755 index 0000000000000000000000000000000000000000..8eb3590ac368406114509b7a704b8d1f05097ebb --- /dev/null +++ b/lib/overlay.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# +# Copyright (C) 2017 Centro de Computacao Cientifica e Software Livre +# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR +# +# This file is part of create-iso +# +# create-iso is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 3 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, +# USA. + +mountOverlay() { + local CHROOTDIR=$1 + local TMPFS=$2 + local PREFIX=$(pwd) + + mkdir -p "${TMPFS}/upper" + mkdir -p "${TMPFS}/work" + mkdir -p ${CHROOTDIR} + + if [ ! -d "${TMPFS}" ]; then + echo "overlay path: '${TMPFS}' has not been found." + exit 1 + fi + if [ ! -d "${TMPFS}/upper" ]; then + echo "upperdir path: '${TMPFS}/upper' has not been found." + exit 1 + fi + if [ ! -d "${TMPFS}/work" ]; then + echo "workdir path: '${TMPFS}/work' has not been found." + exit 1 + fi + if [ ! -d "${CHROOTDIR}" ]; then + echo "merge point path: '${CHROOTDIR}' has not been found." + exit 1 + fi + if [ ! -d "${PREFIX}/chroot" ]; then + echo "chroot path: '${PREFIX}/chroot' has not been found." + exit 1 + fi + + if ! mountpoint -q ${CHROOTDIR}; then + if ! mount -t overlay overlay -o rw,lowerdir="${PREFIX}/chroot",upperdir="${TMPFS}"/upper,workdir="${TMPFS}"/work "${CHROOTDIR}"; then + echo "Overlay could not be mounted:" >&2 + echo " lowerdir: '${PREFIX}/chroot'" >&2 + echo " upperdir: '${TMPFS}/upper'" >&2 + echo " workdir: '${TMPFS}/work'" >&2 + echo "mount point: '${CHROOTDIR}'" >&2 + exit 1 + fi + fi +} + +umountOverlay() { + local CHROOTDIR=$1 + local TMPFS=$2 + if mountpoint -q ${CHROOTDIR}; then + umount ${CHROOTDIR} + fi + rm -r ${TMPFS}/{upper,work} +} diff --git a/monta_image.sh b/monta_image.sh index f2bf9ecb26383b39b0abf16db413c48100f4f635..7176068600f78f4781bac523ebada587f437f2f8 100755 --- a/monta_image.sh +++ b/monta_image.sh @@ -5,7 +5,7 @@ # # This file is part of create-iso # -# le6-conf is free software; you can redistribute it and/or +# create-iso is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. @@ -69,16 +69,20 @@ source ${PREFIX}/conf/$_DIST/create-iso.conf \ || log ERROR "configuration file not found for dist: \"${_DIST}\"" source common.sh - -mkdir -p ${TMP} +source lib/mktmpfs.sh +source lib/overlay.sh sudo apt-get install syslinux squashfs-tools genisoimage xorriso \ || log ERROR "Failed to install basic tools: \"${_DIST}\"" +mountTmpfs ${TMPFS} +mountOverlay ${CHROOTDIR} ${TMPFS} + +mkdir -p ${TMP} for file in $(ls ${SCRIPTSDIR}); do if [ -x "${SCRIPTSDIR}/${file}" ] && egrep -q '^[0-9]{2}-[a-z-]+' <<< "$file"; then echo "$file" - if ! "${SCRIPTSDIR}/${file}" ${_DIST} ${_ARCH} ${CHROOTDIR} ${CHROOTFILE} ${DISTRO} ${DPLIST} ${INSTLIST} ${ISOLINUX} ${MOUNTLIST} ${OURSOURCESLIST} ${RMDSKT} ${RMLIST} ${SCRIPTSDIR} ${SHORTNAME} ${SOURCESLISTDEFAULT} ${TMP} ${OVERLAY} ${REPOPKGS}; then + if ! "${SCRIPTSDIR}/${file}" ${_DIST} ${_ARCH} ${CHROOTDIR} ${CHROOTFILE} ${DISTRO} ${DPLIST} ${INSTLIST} ${ISOLINUX} ${MOUNTLIST} ${OURSOURCESLIST} ${RMDSKT} ${RMLIST} ${SCRIPTSDIR} ${SHORTNAME} ${SOURCESLISTDEFAULT} ${TMP} ${TMPFS} ${REPOPKGS}; then log ERROR "While running \"${SCRIPTSDIR}/${file}\"" fi fi @@ -93,5 +97,7 @@ sudo xorriso -as mkisofs -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -c isolin cd - cleanTmpFiles +umountOverlay ${CHROOTDIR} ${TMPFS} +umountTmpfs ${TMPFS} exit 0 diff --git a/scripts-available/chroot.sh b/scripts-available/chroot.sh index b71330f42b4e008cfe9649b5e675a4668034dc67..aa1bd1ee7b63af47ab034c76e21d36dc7d491025 100755 --- a/scripts-available/chroot.sh +++ b/scripts-available/chroot.sh @@ -5,7 +5,7 @@ # # This file is part of create-iso # -# le6-conf is free software; you can redistribute it and/or +# create-iso is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. @@ -36,7 +36,7 @@ SCRIPTSDIR=${13} SHORTNAME=${14} SOURCESLISTDEFAULT=${15} TMP=${16} -OVERLAY=${17} +TMPFS=${17} REPOPKGS=${18} PREFIX=$PWD diff --git a/scripts-available/compress.sh b/scripts-available/compress.sh index 9501e174ea6a45ff85331d8bfed3282d8c7a4aab..8d7bc09f8363045a22c7ecb46f58f7922840db14 100755 --- a/scripts-available/compress.sh +++ b/scripts-available/compress.sh @@ -5,7 +5,7 @@ # # This file is part of create-iso # -# le6-conf is free software; you can redistribute it and/or +# create-iso is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. @@ -36,7 +36,7 @@ SCRIPTSDIR=${13} SHORTNAME=${14} SOURCESLISTDEFAULT=${15} TMP=${16} -OVERLAY=${17} +TMPFS=${17} REPOPKGS=${18} PREFIX=$PWD diff --git a/scripts-available/create-local-repository.sh b/scripts-available/create-local-repository.sh index b01c5d77dfdbe7cbcd7254a977c9776b24575ba2..770784787b3fa5dac3a142b186c1df1cbfdc1ba3 100755 --- a/scripts-available/create-local-repository.sh +++ b/scripts-available/create-local-repository.sh @@ -5,7 +5,7 @@ # # This file is part of create-iso # -# le6-conf is free software; you can redistribute it and/or +# create-iso is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. @@ -39,7 +39,7 @@ SCRIPTSDIR=${13} SHORTNAME=${14} SOURCESLISTDEFAULT=${15} TMP=${16} -OVERLAY=${17} +TMPFS=${17} REPOPKGS=${18} PREFIX=$PWD diff --git a/scripts-available/install-dependencies.sh b/scripts-available/install-dependencies.sh index 4a7f2c23d55ced128d30f375fb819fcab7bd4d89..d5953a63452491332bae1f539411012d86846207 100755 --- a/scripts-available/install-dependencies.sh +++ b/scripts-available/install-dependencies.sh @@ -5,7 +5,7 @@ # # This file is part of create-iso # -# le6-conf is free software; you can redistribute it and/or +# create-iso is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. @@ -36,7 +36,7 @@ SCRIPTSDIR=${13} SHORTNAME=${14} SOURCESLISTDEFAULT=${15} TMP=${16} -OVERLAY=${17} +TMPFS=${17} REPOPKGS=${18} PREFIX=$PWD diff --git a/scripts-available/install.sh b/scripts-available/install.sh index 499516056d438d6ac67889cf398804439ed69695..f25a90e012bc8b8c7e785806a7a39d29c77894ec 100755 --- a/scripts-available/install.sh +++ b/scripts-available/install.sh @@ -5,7 +5,7 @@ # # This file is part of create-iso # -# le6-conf is free software; you can redistribute it and/or +# create-iso is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. @@ -36,7 +36,7 @@ SCRIPTSDIR=${13} SHORTNAME=${14} SOURCESLISTDEFAULT=${15} TMP=${16} -OVERLAY=${17} +TMPFS=${17} REPOPKGS=${18} PREFIX=$PWD diff --git a/scripts-available/make-initrd.sh b/scripts-available/make-initrd.sh index 28c99c4a61ebcff33d41fb789caee4e02e83bc34..b507b4ea0758d613eac0d7d9742a2c9a16a0e3f2 100755 --- a/scripts-available/make-initrd.sh +++ b/scripts-available/make-initrd.sh @@ -5,7 +5,7 @@ # # This file is part of create-iso # -# le6-conf is free software; you can redistribute it and/or +# create-iso is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. @@ -36,7 +36,7 @@ SCRIPTSDIR=${13} SHORTNAME=${14} SOURCESLISTDEFAULT=${15} TMP=${16} -OVERLAY=${17} +TMPFS=${17} REPOPKGS=${18} PREFIX=$PWD diff --git a/scripts-available/manifest.sh b/scripts-available/manifest.sh index 8c06b878bfd274c41e670c9f8a4637bfdc272a8e..cf430a6c4129424a899da0fb03d63c8fff5a34f3 100755 --- a/scripts-available/manifest.sh +++ b/scripts-available/manifest.sh @@ -5,7 +5,7 @@ # # This file is part of create-iso # -# le6-conf is free software; you can redistribute it and/or +# create-iso is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. @@ -36,7 +36,7 @@ SCRIPTSDIR=${13} SHORTNAME=${14} SOURCESLISTDEFAULT=${15} TMP=${16} -OVERLAY=${17} +TMPFS=${17} REPOPKGS=${18} PREFIX=$PWD diff --git a/scripts-available/overlay.sh b/scripts-available/overlay.sh deleted file mode 100755 index a61b7bc4cefd62c4ac7a4ef47317b2b0bd47d334..0000000000000000000000000000000000000000 --- a/scripts-available/overlay.sh +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2017 Centro de Computacao Cientifica e Software Livre -# Departamento de Informatica - Universidade Federal do Parana - C3SL/UFPR -# -# This file is part of create-iso -# -# le6-conf is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 3 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, -# USA. - -_DIST=$1 -_ARCH=$2 -CHROOTDIR=$3 -CHROOTFILE=$4 -DISTRO=$5 -DPLIST=$6 -INSTLIST=$7 -ISOLINUX=$8 -MOUNTLIST=$9 -OURSOURCESLIST=${10} -RMDSKT=${11} -RMLIST=${12} -SCRIPTSDIR=${13} -SHORTNAME=${14} -SOURCESLISTDEFAULT=${15} -TMP=${16} -OVERLAY=${17} -REPOPKGS=${18} -PREFIX=$PWD - -mkdir "${OVERLAY}/upper" -mkdir "${OVERLAY}/work" -mkdir ${CHROOTDIR} - -if [ ! -d "${OVERLAY}" ]; then - echo "overlay path: '${OVERLAY}' has not been found." - exit 1 -fi -if [ ! -d "${OVERLAY}/upper" ]; then - echo "upperdir path: '${OVERLAY}/upper' has not been found." - exit 1 -fi -if [ ! -d "${OVERLAY}/work" ]; then - echo "workdir path: '${OVERLAY}/work' has not been found." - exit 1 -fi -if [ ! -d "${CHROOTDIR}" ]; then - echo "merge point path: '${CHROOTDIR}' has not been found." - exit 1 -fi -if [ ! -d "${PREFIX}/chroot" ]; then - echo "chroot path: '${PREFIX}/chroot' has not been found." - exit 1 -fi - -if ! mountpoint ${CHROOTDIR}; then - if ! mount -t overlay overlay -o rw,lowerdir="${PREFIX}/chroot",upperdir="${OVERLAY}"/upper,workdir="${OVERLAY}"/work "${CHROOTDIR}"; then - echo "Overlay could not be mounted:" >&2 - echo " lowerdir: '${PREFIX}/chroot'" >&2 - echo " upperdir: '${OVERLAY}/upper'" >&2 - echo " workdir: '${OVERLAY}/work'" >&2 - echo "mount point: '${CHROOTDIR}'" >&2 - exit 1 - fi -fi diff --git a/scripts-available/post-epilogue.sh b/scripts-available/post-epilogue.sh index 3a3c928f7581f67e8affee0e0f2ccf757d388891..45852efdc08b1b7b0fcb4c9c4810577f832a502f 100755 --- a/scripts-available/post-epilogue.sh +++ b/scripts-available/post-epilogue.sh @@ -5,7 +5,7 @@ # # This file is part of create-iso # -# le6-conf is free software; you can redistribute it and/or +# create-iso is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. @@ -36,7 +36,7 @@ SCRIPTSDIR=${13} SHORTNAME=${14} SOURCESLISTDEFAULT=${15} TMP=${16} -OVERLAY=${17} +TMPFS=${17} REPOPKGS=${18} PREFIX=$PWD diff --git a/scripts-available/pre-manifest.sh b/scripts-available/pre-manifest.sh index b5ff9b88703784e9c58cb88402e38ef4a5613bab..2bb7fd41d33dc1ba67eb31bd7368bca3f847c972 100755 --- a/scripts-available/pre-manifest.sh +++ b/scripts-available/pre-manifest.sh @@ -5,7 +5,7 @@ # # This file is part of create-iso # -# le6-conf is free software; you can redistribute it and/or +# create-iso is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. @@ -36,7 +36,7 @@ SCRIPTSDIR=${13} SHORTNAME=${14} SOURCESLISTDEFAULT=${15} TMP=${16} -OVERLAY=${17} +TMPFS=${17} REPOPKGS=${18} export PREFIX=$PWD diff --git a/scripts-available/remove.sh b/scripts-available/remove.sh index 53daf5037e166686160c8963d2a2c90f8b7159b9..7f4b18a8ba576820ec99350b18dadc80c2cf53ab 100755 --- a/scripts-available/remove.sh +++ b/scripts-available/remove.sh @@ -5,7 +5,7 @@ # # This file is part of create-iso # -# le6-conf is free software; you can redistribute it and/or +# create-iso is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. @@ -36,7 +36,7 @@ SCRIPTSDIR=${13} SHORTNAME=${14} SOURCESLISTDEFAULT=${15} TMP=${16} -OVERLAY=${17} +TMPFS=${17} REPOPKGS=${18} PREFIX=$PWD diff --git a/scripts-available/setup.sh b/scripts-available/setup.sh index 14aa8fb702c10a3d9aefb642552b0f1fdc4a25b2..6ea5c45efc10fbd194d70a5c07fd2de94fb278c4 100755 --- a/scripts-available/setup.sh +++ b/scripts-available/setup.sh @@ -5,7 +5,7 @@ # # This file is part of create-iso # -# le6-conf is free software; you can redistribute it and/or +# create-iso is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 3 # of the License, or (at your option) any later version. @@ -36,7 +36,7 @@ SCRIPTSDIR=${13} SHORTNAME=${14} SOURCESLISTDEFAULT=${15} TMP=${16} -OVERLAY=${17} +TMPFS=${17} REPOPKGS=${18} PREFIX=$PWD diff --git a/scripts-available/update-sourceslist.sh b/scripts-available/update-sourceslist.sh index 1e360a83446dff4daa4a2fe7df1f45b4c039f897..f61098065fc9dd33dd075988fcfef0ebf750246a 100755 --- a/scripts-available/update-sourceslist.sh +++ b/scripts-available/update-sourceslist.sh @@ -36,7 +36,7 @@ SCRIPTSDIR=${13} SHORTNAME=${14} SOURCESLISTDEFAULT=${15} TMP=${16} -OVERLAY=${17} +TMPFS=${17} REPOPKGS=${18} PREFIX=$PWD