diff options
Diffstat (limited to 'helpers')
56 files changed, 1725 insertions, 438 deletions
diff --git a/helpers/lh_binary b/helpers/lh_binary index cc392f51f..7641871eb 100755 --- a/helpers/lh_binary +++ b/helpers/lh_binary @@ -1,36 +1,64 @@ #!/bin/sh -# lh_image(1) - building the images +# lh_binary(1) - build binary images +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. -# Building root filesystem -lh_binary_rootfs -lh_binary_manifest -lh_binary_encryption +set -e + +# Source common functions +for FUNCTION in /usr/share/live-helper/functions/*.sh +do + . ${FUNCTION} +done + +# Set static variables +DESCRIPTION="build binary images" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +if [ "${FORCE}" = "true" ] +then + OPTIONS="${OPTIONS} --force" +fi + +# Preparing root filesystem +lh_binary_chroot "${OPTIONS}" # Configuring chroot -lh_chroot_proc install -lh_chroot_sysfs install -lh_chroot_hosts install -lh_chroot_resolv install -lh_chroot_sources install +lh_chroot_proc install "${OPTIONS}" +lh_chroot_sysfs install "${OPTIONS}" +lh_chroot_hosts install "${OPTIONS}" +lh_chroot_resolv install "${OPTIONS}" +lh_chroot_sources install "${OPTIONS}" + +# Building root filesystem +lh_binary_rootfs "${OPTIONS}" +lh_binary_manifest "${OPTIONS}" +lh_binary_encryption "${OPTIONS}" # Prepare images -lh_binary_linuximage -lh_binary_memtest86 -lh_binary_syslinux -lh_binary_includes -lh_binary_localincludes -lh_binary_md5sum +lh_binary_linuximage "${OPTIONS}" +lh_binary_memtest86 "${OPTIONS}" +lh_binary_syslinux "${OPTIONS}" +lh_binary_includes "${OPTIONS}" +lh_binary_localincludes "${OPTIONS}" +lh_binary_md5sum "${OPTIONS}" # Building images -lh_binary_hdd -lh_binary_iso -lh_binary_net -lh_binary_usb +lh_binary_hdd "${OPTIONS}" +lh_binary_iso "${OPTIONS}" +lh_binary_net "${OPTIONS}" +lh_binary_usb "${OPTIONS}" # Deconfiguring chroot rm -f .stage/chroot_sources -lh_chroot_resolv remove -lh_chroot_hosts remove -lh_chroot_sysfs remove -lh_chroot_proc remove +lh_chroot_resolv remove "${OPTIONS}" +lh_chroot_hosts remove "${OPTIONS}" +lh_chroot_sysfs remove "${OPTIONS}" +lh_chroot_proc remove "${OPTIONS}" diff --git a/helpers/lh_binary_chroot b/helpers/lh_binary_chroot new file mode 100755 index 000000000..5cde421d3 --- /dev/null +++ b/helpers/lh_binary_chroot @@ -0,0 +1,50 @@ +#!/bin/sh + +# lh_binary_chroot(1) - copy chroot into chroot +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. + +set -e + +# Source common functions +for FUNCTION in /usr/share/live-helper/functions/*.sh +do + . ${FUNCTION} +done + +# Set static variables +DESCRIPTION="copy chroot into chroot" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffile config/common +Set_defaults + +# Requiring stage file +Require_stagefile .stage/bootstrap + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Checking stage file +Check_stagefile .stage/binary_chroot + +# Removing old chroot +rm -rf chroot/chroot +rm -rf chroot.tmp + +# Copying new chroot +cp -a chroot chroot.tmp +mv chroot.tmp chroot/chroot + +# Creating stage file +Create_stagefile .stage/binary_chroot diff --git a/helpers/lh_binary_encryption b/helpers/lh_binary_encryption index 871adaabe..03c056f05 100755 --- a/helpers/lh_binary_encryption +++ b/helpers/lh_binary_encryption @@ -1,6 +1,11 @@ #!/bin/sh # lh_binary_encryption(1) - encrypts rootfs +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,31 +15,32 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="encrypts rootfs" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/image Set_defaults -# Requiring stage file -Require_stagefile .stage/bootstrap -Require_stagefile .stage/binary_rootfs +if [ -n "${LIVE_ENCRYPTION}" ] +then + # Requiring stage file + Require_stagefile .stage/bootstrap + Require_stagefile .stage/binary_rootfs -# Checking lock file -Check_lockfile .lock + # Checking lock file + Check_lockfile .lock -# Creating lock file -Create_lockfile .lock + # Creating lock file + Create_lockfile .lock -# Checking stage file -Check_stagefile .stage/binary_encryption - -if [ -n "${LIVE_ENCRYPTION}" ] -then - if [ ! -x /usr/bin/aespipe ] - then - echo "E: aespipe is missing (FIXME)." - exit 1 - fi + # Checking stage file + Check_stagefile .stage/binary_encryption case "${LIVE_FILESYSTEM}" in ext2) @@ -51,22 +57,65 @@ then ;; esac + if [ ! -f chroot/usr/bin/aespipe ] + then + PACKAGES="${PACKAGES} aespipe" + fi + + if [ -n "${PACKAGES}" ] + then + # Installing packages + case "${LH_APT}" in + apt|apt-get) + Chroot "apt-get install --yes ${PACKAGES}" + ;; + + aptitude) + Chroot "aptitude install --assume-yes ${PACKAGES}" + ;; + esac + fi + + # Moving image + mv binary/casper/filesystem.${LIVE_FILESYSTEM} chroot + echo "Encrypting binary/casper/filesystem.${ROOTFS} with ${LIVE_ENCRYPTION}..." - while true - do - cat binary/casper/filesystem.${ROOTFS} | aespipe -e "${LIVE_ENCRYPTION}" -T > binary/casper/filesystem.${ROOTFS} && break +cat >> chroot/encrypt << EOF +while true +do + cat filesystem.${ROOTFS} | aespipe -e ${LIVE_ENCRYPTION} -T > filesystem.${ROOTFS} && break + + echo -n "Something went wrong... Retry? [YES/no] " + + read ANSWER - echo -n "Something went wrong... Retry? [YES/no] " + if [ "no" = "${ANSWER}" ] + then + unset ANSWER + break + fi +done +EOF - read ANSWER + Chroot "sh encrypt" - if [ 'no' = "${ANSWER}" ] - then - unset ANSWER - break - fi - done + # Move image + mv chroot/filesystem.${LIVE_FILESYSTEM} binary/casper + rm -f chroot/encrypt + + # Removing packages + if [ -n "${PACKAGES}" ] + then + case "${LH_APT}" in + apt|apt-get) + Chroot "apt-get remove --purge --yes ${PACKAGES}" + ;; + aptitude) + Chroot "aptitude purge --assume-yes ${PACKAGES}" + ;; + esac + fi # Creating stage file Create_stagefile .stage/binary_encryption diff --git a/helpers/lh_binary_hdd b/helpers/lh_binary_hdd index d973db52e..f41fbf40c 100755 --- a/helpers/lh_binary_hdd +++ b/helpers/lh_binary_hdd @@ -1,6 +1,11 @@ #!/bin/sh # lh_binary_hdd(1) - build harddisk binary image +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,28 +15,35 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="build harddisk binary image" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap Read_conffile config/image Set_defaults -# Requiring stage file -Require_stagefile .stage/bootstrap - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Checking stage file -Check_stagefile .stage/binary_hdd - for IMAGE in ${LIVE_BINARY_IMAGE} do if [ "${IMAGE}" = "hdd" ] then + # Requiring stage file + Require_stagefile .stage/bootstrap + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Checking stage file + Check_stagefile .stage/binary_hdd + # Remove old binary if [ -f binary-hdd.tar.gz ] then diff --git a/helpers/lh_binary_includes b/helpers/lh_binary_includes index 647ed0bca..6fbaeed41 100755 --- a/helpers/lh_binary_includes +++ b/helpers/lh_binary_includes @@ -1,6 +1,11 @@ #!/bin/sh # lh_binary_includes(1) - copy files into binary +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="copy files into binary" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -28,14 +40,18 @@ Create_lockfile .lock # Checking stage file Check_stagefile .stage/binary_includes -if ls /usr/share/live-helper/includes/common/* &> /dev/null +if ls "${LIVE_INCLUDES}"/common/* &> /dev/null then - cp -r /usr/share/live-helper/includes/common/* binary + cd "${LIVE_INCLUDES}"/common + find . | cpio -dmpu "${OLDPWD}"/binary + cd "${OLDPWD}" fi -if ls /usr/share/live-helper/includes/"${LIVE_BINARY_IMAGE}"/* &> /dev/null +if ls "${LIVE_INCLUDES}"/"${LIVE_BINARY_IMAGE}"/* &> /dev/null then - cp -r /usr/share/live-helper/includes/"${LIVE_BINARY_IMAGE}"/* binary + cd "${LIVE_INCLUDES}"/"${LIVE_BINARY_IMAGE}" + find . | cpio -dmpu "${OLDPWD}"/binary + cd "${OLDPWD}" fi # Creating stage file diff --git a/helpers/lh_binary_iso b/helpers/lh_binary_iso index 102b5a4a9..be9a51f74 100755 --- a/helpers/lh_binary_iso +++ b/helpers/lh_binary_iso @@ -1,6 +1,11 @@ #!/bin/sh # lh_binary_iso(1) - build iso binary image +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,42 +15,90 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="build iso binary image" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap Read_conffile config/image Set_defaults -# Requiring stage file -Require_stagefile .stage/bootstrap - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Checking stage file -Check_stagefile .stage/binary_iso - for IMAGE in ${LIVE_BINARY_IMAGE} do if [ "${IMAGE}" = "iso" ] then - # Remove old binary + # Requiring stage file + Require_stagefile .stage/bootstrap + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Checking stage file + Check_stagefile .stage/binary_iso + + if [ ! -f chroot/usr/bin/"${LH_GENISOIMAGE}" ] + then + PACKAGES="${PACKAGES} ${LH_GENISOIMAGE}" + fi + + if [ -n "${PACKAGES}" ] + then + # Installing packages + case "${LH_APT}" in + apt|apt-get) + Chroot "apt-get install --yes ${PACKAGES}" + ;; + + aptitude) + Chroot "aptitude install --assume-yes ${PACKAGES}" + ;; + esac + fi + + # Remove old iso image if [ -f binary.iso ] then rm -f binary.iso fi + # Moving image + mv binary chroot + # Create image if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] then - ${LH_GENISOIMAGE} -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o "${LIVE_IMAGE}"binary.iso -r -J -l -V "${LIVE_ISO_VOLUME}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table binary ${LIVE_INCLUDE_IMAGE} + #Chroot "${LH_GENISOIMAGE} -A \"Debian Live\" -p \"Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org\" -publisher \"Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org\" -o binary.iso -r -J -l -V \"${LIVE_ISO_VOLUME}\" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table binary" + Chroot "${LH_GENISOIMAGE} -o binary.iso -r -J -l -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table binary" else echo "W: Bootloader on your architecture not yet supported (Continuing in 5 seconds)." sleep 5 - ${LH_GENISOIMAGE} -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o "${LIVE_IMAGE}"binary.iso -r -J -l -V "${LIVE_ISO_VOLUME}" binary ${LIVE_INCLUDE_IMAGE} + #Chroot "${LH_GENISOIMAGE} -A 'Debian Live' -p 'Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org' -publisher 'Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org' -o binary.iso -r -J -l -V \"${LIVE_ISO_VOLUME}\" binary" + Chroot "${LH_GENISOIMAGE} -o binary.iso -r -J -l binary" + fi + + # Move image + mv chroot/binary chroot/binary.iso ./ + + # Removing packages + if [ -n "${PACKAGES}" ] + then + case "${LH_APT}" in + apt|apt-get) + Chroot "apt-get remove --purge --yes ${PACKAGES}" + ;; + + aptitude) + Chroot "aptitude purge --assume-yes ${PACKAGES}" + ;; + esac fi # Creating stage file diff --git a/helpers/lh_binary_linuximage b/helpers/lh_binary_linuximage index 7a9576d96..680b4c9c9 100755 --- a/helpers/lh_binary_linuximage +++ b/helpers/lh_binary_linuximage @@ -1,6 +1,11 @@ #!/bin/sh # lh_binary_linuximage(1) - install linux-image into binary +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="install linux-image into binary" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/image @@ -33,7 +45,7 @@ rm -f chroot/boot/initrd*bak* # Setting destination directory case "${LIVE_BINARY_IMAGE}" in iso) - DESTDIR="binary/isolinux" + DESTDIR="binary/live" ;; net) @@ -45,6 +57,16 @@ case "${LIVE_BINARY_IMAGE}" in ;; esac +# Temporary check for broken syslinux +if [ "${LIVE_BINARY_IMAGE}" = "iso" ] +then + case "${LIVE_ARCHITECTURE}" in + i386) + DESTDIR="${DESTDIR}.386" + ;; + esac +fi + # Creating directory if [ ! -d "${DESTDIR}" ] then @@ -52,8 +74,8 @@ then fi # Installing linux-image -cp chroot/boot/vmlinuz* "${DESTDIR}"/vmlinuz -cp chroot/boot/initrd.img* "${DESTDIR}"/initrd.gz +cp chroot/boot/vmlinuz* "${DESTDIR}" +cp chroot/boot/initrd.img* "${DESTDIR}" # Creating stage file Create_stagefile .stage/binary_linuximage diff --git a/helpers/lh_binary_localincludes b/helpers/lh_binary_localincludes index 4cc2dd84b..332710089 100755 --- a/helpers/lh_binary_localincludes +++ b/helpers/lh_binary_localincludes @@ -1,6 +1,11 @@ #!/bin/sh # lh_binary_localincludes(1) - copy files into binary +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="copy files into binary" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -31,7 +43,7 @@ if ls config/binary_localincludes/* &> /dev/null then # Copying includes cd config/binary_localincludes - find . | cpio -dmpu ../../binary + find . | cpio -dmpu "${OLDPWD}"/binary cd "${OLDPWD}" # Creating stage file diff --git a/helpers/lh_binary_manifest b/helpers/lh_binary_manifest index a0c248022..b0ae36c2c 100755 --- a/helpers/lh_binary_manifest +++ b/helpers/lh_binary_manifest @@ -1,6 +1,11 @@ #!/bin/sh # lh_binary_manifest(1) - create manifest +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="create manifest" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/image diff --git a/helpers/lh_binary_md5sum b/helpers/lh_binary_md5sum index cd925d9bf..c16b6d478 100755 --- a/helpers/lh_binary_md5sum +++ b/helpers/lh_binary_md5sum @@ -1,6 +1,11 @@ #!/bin/sh -# lh_binary_md5sum(1) - create md5sum.txt +# lh_binary_md5sum(1) - create binary md5sums +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="create binary md5sums" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/image diff --git a/helpers/lh_binary_memtest86 b/helpers/lh_binary_memtest86 index 1fc343076..c2231f6d5 100755 --- a/helpers/lh_binary_memtest86 +++ b/helpers/lh_binary_memtest86 @@ -1,6 +1,11 @@ #!/bin/sh -# lh_binary_memtest86(1) - installs memtest86+ +# lh_binary_memtest86(1) - installs memtest86+ into binary +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="installs memtest86+ into binary" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -55,9 +67,10 @@ then esac fi + # Setting destination directory case "${LIVE_BINARY_IMAGE}" in iso) - DESTDIR="binary/isolinux" + DESTDIR="binary/live" ;; net) @@ -69,6 +82,16 @@ then ;; esac + # Temporary check for broken syslinux + if [ "${LIVE_BINARY_IMAGE}" = "iso" ] + then + case "${LIVE_ARCHITECTURE}" in + i386) + DESTDIR="${DESTDIR}.386" + ;; + esac + fi + # Creating directory if [ ! -d "${DESTDIR}" ] then @@ -80,7 +103,7 @@ then if [ -n "${PACKAGES}" ] then - # Removing syslinux + # Removing packages case "${LH_APT}" in apt|apt-get) Chroot "apt-get remove --purge --yes ${PACKAGES}" diff --git a/helpers/lh_binary_net b/helpers/lh_binary_net index 7d657c919..4a2a20dd4 100755 --- a/helpers/lh_binary_net +++ b/helpers/lh_binary_net @@ -1,6 +1,11 @@ #!/bin/sh # lh_binary_net(1) - build netboot binary image +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,28 +15,35 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="build netboot binary image" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap Read_conffile config/image Set_defaults -# Requiring stage file -Require_stagefile .stage/bootstrap - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Checking stage file -Check_stagefile .stage/binary_net - for IMAGE in ${LIVE_BINARY_IMAGE} do if [ "${IMAGE}" = "net" ] then + # Requiring stage file + Require_stagefile .stage/bootstrap + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Checking stage file + Check_stagefile .stage/binary_net + # Remove old binary if [ -f binary-net.tar.gz ] then @@ -42,8 +54,8 @@ do mv binary "`basename ${LIVE_SERVER_PATH}`" cd .. - tar cfz binary-net.tar.gz "${LIVE_ROOT}/`basename ${LIVE_SERVER_PATH}`" "${LIVE_ROOT}/tftpboot" - mv binary-net.tar.gz "${LIVE_ROOT}" + tar cfz binary-net.tar.gz "${OLDPWD}/`basename ${LIVE_SERVER_PATH}`" "${OLDPWD}/tftpboot" + mv binary-net.tar.gz "${OLDPWD}" cd "${OLDPWD}" mv "`basename ${LIVE_SERVER_PATH}`" binary diff --git a/helpers/lh_binary_rootfs b/helpers/lh_binary_rootfs index 1ce994f87..bdc8904b0 100755 --- a/helpers/lh_binary_rootfs +++ b/helpers/lh_binary_rootfs @@ -1,6 +1,11 @@ #!/bin/sh # lh_binary_rootfs(1) - build rootfs image +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="build rootfs image" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/image @@ -17,6 +29,7 @@ Set_defaults # Requiring stage file Require_stagefile .stage/bootstrap +Require_stagefile .stage/binary_chroot # Checking lock file Check_lockfile .lock @@ -35,6 +48,26 @@ fi case "${LIVE_FILESYSTEM}" in ext2) + if [ ! -f chroot/usr/bin/genext2fs ] + then + PACKAGES="${PACKAGES} genext2fs" + fi + + if [ -n "${PACKAGES}" ] + then + # Installing packages + case "${LH_APT}" in + apt|apt-get) + Chroot "apt-get install --yes ${PACKAGES}" + ;; + + aptitude) + Chroot "aptitude install --assume-yes ${PACKAGES}" + ;; + esac + fi + + # Remove old ext2 image if [ -f binary/casper/filesystem.ext2 ] then rm -f binary/casper/filesystem.ext2 @@ -43,7 +76,25 @@ case "${LIVE_FILESYSTEM}" in DU_DIM="`du -ks chroot | cut -f1`" REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 20`" # Just 5% more to be sure, need something more sophistcated here... - genext2fs --size-in-blocks=${REAL_DIM} --reserved-blocks=0 --root=chroot binary/casper/filesystem.ext2 + Chroot "genext2fs --size-in-blocks=${REAL_DIM} --reserved-blocks=0 --root=chroot filesystem.ext2" + + # Move image + mv chroot/filesystem.ext2 binary/casper + rm -rf chroot/chroot + + # Removing packages + if [ -n "${PACKAGES}" ] + then + case "${LH_APT}" in + apt|apt-get) + Chroot "apt-get remove --purge --yes ${PACKAGES}" + ;; + + aptitude) + Chroot "aptitude purge --assume-yes ${PACKAGES}" + ;; + esac + fi ;; plain) @@ -55,19 +106,60 @@ case "${LIVE_FILESYSTEM}" in cd chroot find . | cpio -pumd ../binary/casper/filesystem.dir cd "${OLDPWD}" + + rm -rf chroot/chroot ;; squashfs) + if [ ! -f chroot/usr/sbin/mksquashfs ] + then + PACKAGES="${PACKAGES} squashfs-tools" + fi + + if [ -n "${PACKAGES}" ] + then + # Installing packages + case "${LH_APT}" in + apt|apt-get) + Chroot "apt-get install --yes ${PACKAGES}" + ;; + + aptitude) + Chroot "aptitude install --assume-yes ${PACKAGES}" + ;; + esac + fi + + # Remove old squashfs image if [ -f binary/casper/filesystem.squashfs ] then - rm binary/casper/filesystem.squashfs + rm -f binary/casper/filesystem.squashfs fi - if [ "${LIVE_FLAVOUR}" = "minimal" ] || [ "${LIVE_FLAVOUR}" = "mini" ] + # Create image + if [ "${LIVE_PACKAGES_LISTS}" != "minimal" ] && [ "${LIVE_PACKAGES_LISTS}" != "mini" ] then - mksquashfs chroot binary/casper/filesystem.squashfs -e chroot/boot/vmlinuz* chroot/boot/initrd.img* chroot/vmlinuz chroot/initrd.img chroot/boot/config-* chroot/boot/System.map-* + Chroot "mksquashfs chroot filesystem.squashfs" else - mksquashfs chroot binary/casper/filesystem.squashfs + Chroot "mksquashfs chroot filesystem.squashfs -e chroot/boot/vmlinuz* chroot/boot/initrd.img* chroot/vmlinuz* chroot/initrd.img* chroot/boot/config-* chroot/boot/System.map-*" + fi + + # Move image + mv chroot/filesystem.squashfs binary/casper + rm -rf chroot/chroot + + # Removing packages + if [ -n "${PACKAGES}" ] + then + case "${LH_APT}" in + apt|apt-get) + Chroot "apt-get remove --purge --yes ${PACKAGES}" + ;; + + aptitude) + Chroot "aptitude purge --assume-yes ${PACKAGES}" + ;; + esac fi ;; esac diff --git a/helpers/lh_binary_syslinux b/helpers/lh_binary_syslinux index d80d66eba..88b02b9d5 100755 --- a/helpers/lh_binary_syslinux +++ b/helpers/lh_binary_syslinux @@ -1,6 +1,11 @@ #!/bin/sh -# lh_binary_syslinux(1) - installs syslinux +# lh_binary_syslinux(1) - installs syslinux into binary +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,9 +15,17 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="installs syslinux into binary" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap +Read_conffile config/chroot Read_conffile config/image Set_defaults @@ -55,11 +68,102 @@ then esac fi + # Setting destination directory + case "${LIVE_BINARY_IMAGE}" in + iso) + DESTDIR="binary/live" + ;; + + net) + DESTDIR="tftpboot" + ;; + + usb|hdd) + DESTDIR="binary" + ;; + esac + + # Temporary check for broken syslinux + if [ "${LIVE_BINARY_IMAGE}" = "iso" ] + then + case "${LIVE_ARCHITECTURE}" in + i386) + DESTDIR="${DESTDIR}.386" + ;; + esac + fi + + # Creating directory + if [ ! -d "${DESTDIR}" ] + then + mkdir -p "${DESTDIR}" + fi + + # Setting boot parameters if [ -n "${LIVE_ENCRYPTION}" ] then LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} encryption=${LIVE_ENCRYPTION}" fi + if [ -n "${LIVE_USERNAME}" ] + then + LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} username=${LIVE_USERNAME}" + fi + + if [ -n "${LIVE_HOSTNAME}" ] + then + LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} hostname=${LIVE_HOSTNAME}" + fi + + LIVE_BOOTAPPEND="`echo ${LIVE_BOOTAPPEND} | sed -e 's/ //'`" + + # Assembling kernel configuration + if [ "${LIVE_BINARY_IMAGE}" = "iso" ] + then + DEFAULT_FLAVOUR="`echo ${LIVE_KERNEL_FLAVOUR} | awk '{ print $1 }'`" + LINUX="label linux\n kernel /`basename ${DESTDIR}`/`basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR}`\n append initrd=/`basename ${DESTDIR}`/initrd.img-`basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR} | sed -e 's/vmlinuz-//'` boot=casper LIVE_BOOTAPPEND" + else + DEFAULT_FLAVOUR="`echo ${LIVE_KERNEL_FLAVOUR} | awk '{ print $1 }'`" + LINUX="label linux\n kernel `basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR}`\n append initrd=initrd.img-`basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR} | sed -e 's/vmlinuz-//'` boot=casper LIVE_BOOTAPPEND" + fi + + if [ "`echo ${LIVE_KERNEL_FLAVOUR} | wc -w`" -gt "1" ] + then + for KERNEL in chroot/boot/vmlinuz* + do + if [ -z "${LINUX}" ] + then + if [ "${LIVE_BINARY_IMAGE}" = "iso" ] + then + LINUX="label linux-`basename ${KERNEL} | sed -e 's/vmlinuz-//'`\n kernel /`basename ${DESTDIR}`/`basename ${KERNEL}`\n append initrd=/`basename ${DESTDIR}`/initrd.img-`basename ${KERNEL} | sed -e 's/vmlinuz-//'` boot=casper LIVE_BOOTAPPEND" + else + LINUX="label linux-`basename ${KERNEL} | sed -e 's/vmlinuz-//'`\n kernel `basename ${KERNEL}`\n append initrd=initrd.img-`basename ${KERNEL} | sed -e 's/vmlinuz-//'` boot=casper LIVE_BOOTAPPEND" + fi + else + if [ "${LIVE_BINARY_IMAGE}" = "iso" ] + then + LINUX="${LINUX}\nlabel linux-`basename ${KERNEL} | sed -e 's/vmlinuz-//'`\n kernel /`basename ${DESTDIR}`/`basename ${KERNEL}`\n append initrd=/`basename ${DESTDIR}`/initrd.img-`basename ${KERNEL} | sed -e 's/vmlinuz-//'` boot=casper LIVE_BOOTAPPEND" + else + LINUX="${LINUX}\nlabel linux-`basename ${KERNEL} | sed -e 's/vmlinuz-//'`\n kernel `basename ${KERNEL}`\n append initrd=initrd.img-`basename ${KERNEL} | sed -e 's/vmlinuz-//'` boot=casper LIVE_BOOTAPPEND" + fi + fi + done + fi + + LINUX="`echo ${LINUX} | sed -e 's#//#/#g'`" + + # Assembling memtest configuration + if [ -f "${DESTDIR}"/memtest ] + then + if [ "${LIVE_BINARY_IMAGE}" = "iso" ] + then + MEMTEST="label memtest\n kernel /`basename ${DESTDIR}`/memtest" + MEMTEST="`echo ${MEMTEST} | sed -e 's#//#/#g'`" + else + MEMTEST="label memtest\n kernel memtest" + fi + fi + case "${LIVE_BINARY_IMAGE}" in iso) # Copying syslinux @@ -74,17 +178,34 @@ then fi # Configure syslinux templates + sed -i -e "s#LIVE_KERNEL#${LINUX}#" -e "s#LIVE_MEMTEST#${MEMTEST}#" binary/isolinux/isolinux.cfg sed -i -e "s#LIVE_BOOTAPPEND#${LIVE_BOOTAPPEND}#" binary/isolinux/isolinux.cfg sed -i -e "s/LIVE_DATE/`date +%Y%m%d`/" binary/isolinux/f1.txt sed -i -e "s/LIVE_VERSION/${VERSION}/" binary/isolinux/f10.txt # Remove unused files rm -f binary/isolinux/pxelinux.cfg + + # Working arround syslinux 8.3 limitation + if [ "`echo ${LIVE_KERNEL_FLAVOUR} | wc -w`" -gt "1" ] + then + for FLAVOUR in ${LIVE_KERNEL_FLAVOUR} + do + NUMBER=$(($NUMBER + 1)) + + mv "${DESTDIR}"/vmlinuz-*-${FLAVOUR} "${DESTDIR}"/vmlinuz${NUMBER} + mv "${DESTDIR}"/initrd.img-*-${FLAVOUR} "${DESTDIR}"/initrd${NUMBER}.img + sed -i -e "s/linux.*-${FLAVOUR}/linux${NUMBER}/g" -e "s/vmlinuz-.*-${FLAVOUR}/vmlinuz${NUMBER}/g" -e "s/initrd.img-.*-${FLAVOUR}/initrd${NUMBER}.img/g" binary/isolinux/isolinux.cfg + done + else + mv "${DESTDIR}"/vmlinuz-*-${LIVE_KERNEL_FLAVOUR} "${DESTDIR}"/vmlinuz + mv "${DESTDIR}"/initrd.img-*-${LIVE_KERNEL_FLAVOUR} "${DESTDIR}"/initrd.img + sed -i -e "s/linux.*-${LIVE_KERNEL_FLAVOUR}/linux/g" -e "s/vmlinuz-.*-${LIVE_KERNEL_FLAVOUR}/vmlinuz/g" -e "s/initrd.img-.*-${LIVE_KERNEL_FLAVOUR}/initrd.img/g" binary/isolinux/isolinux.cfg + fi ;; net) # Copying syslinux - mkdir -p tftpboot cp chroot/usr/lib/syslinux/pxelinux.0 tftpboot # Install syslinux templates @@ -96,16 +217,34 @@ then # Copying splash screen if [ -n "${LIVE_SYSLINUX_SPLASH}" ] then - cp "${LIVE_SYSLINUX_SPLASH}" ftpboot/pxelinux.cfg/splash.rle + cp "${LIVE_SYSLINUX_SPLASH}" tftpboot/pxelinux.cfg/splash.rle fi # Configure syslinux templates + sed -i -e "s#LIVE_KERNEL#${LINUX}#" -e "s#LIVE_MEMTEST#${MEMTEST}#" tftpboot/pxelinux.cfg/default sed -i -e "s/LIVE_SERVER_ADDRESS/${LIVE_SERVER_ADDRESS}/" -e "s#LIVE_SERVER_PATH#${LIVE_SERVER_PATH}#" -e "s#LIVE_BOOTAPPEND#${LIVE_BOOTAPPEND}#" tftpboot/pxelinux.cfg/default sed -i -e "s/LIVE_DATE/`date +%Y%m%d`/" tftpboot/pxelinux.cfg/f1.txt sed -i -e "s/LIVE_VERSION/${VERSION}/" tftpboot/pxelinux.cfg/f10.txt # Remove unused files rm -f tftpboot/pxelinux.cfg/isolinux.cfg + + # Working arround syslinux 8.3 limitation + if [ "`echo ${LIVE_KERNEL_FLAVOUR} | wc -w`" -gt "1" ] + then + for FLAVOUR in ${LIVE_KERNEL_FLAVOUR} + do + NUMBER=$(($NUMBER + 1)) + + mv "${DESTDIR}"/vmlinuz-*-${FLAVOUR} "${DESTDIR}"/vmlinuz${NUMBER} + mv "${DESTDIR}"/initrd.img-*-${FLAVOUR} "${DESTDIR}"/initrd${NUMBER}.img + sed -i -e "s/linux.*-${FLAVOUR}/linux${NUMBER}/g" -e "s/vmlinuz-.*-${FLAVOUR}/vmlinuz${NUMBER}/g" -e "s/initrd.img-.*-${FLAVOUR}/initrd${NUMBER}.img/g" tftpboot/pxelinux.cfg/default + done + else + mv "${DESTDIR}"/vmlinuz-*-${LIVE_KERNEL_FLAVOUR} "${DESTDIR}"/vmlinuz + mv "${DESTDIR}"/initrd.img-*-${LIVE_KERNEL_FLAVOUR} "${DESTDIR}"/initrd.img + sed -i -e "s/linux.*-${LIVE_KERNEL_FLAVOUR}/linux/g" -e "s/vmlinuz-.*-${LIVE_KERNEL_FLAVOUR}/vmlinuz/g" -e "s/initrd.img-.*-${LIVE_KERNEL_FLAVOUR}/initrd.img/g" tftpboot/pxelinux.cfg/default + fi ;; usb|hdd) @@ -124,18 +263,36 @@ then fi # Configure syslinux templates + sed -i -e "s#LIVE_KERNEL#${LINUX}#" -e "s#LIVE_MEMTEST#${MEMTEST}#" binary/syslinux.cfg sed -i -e "s#LIVE_BOOTAPPEND#${LIVE_BOOTAPPEND}#" binary/syslinux.cfg sed -i -e "s/LIVE_DATE/`date +%Y%m%d`/" binary/f1.txt sed -i -e "s/LIVE_VERSION/${VERSION}/" binary/f10.txt # Remove unused files rm -f binary/pxelinux.cfg + + # Working arround syslinux 8.3 limitation + if [ "`echo ${LIVE_KERNEL_FLAVOUR} | wc -w`" -gt "1" ] + then + for FLAVOUR in ${LIVE_KERNEL_FLAVOUR} + do + NUMBER=$(($NUMBER + 1)) + + mv "${DESTDIR}"/vmlinuz-*-${FLAVOUR} "${DESTDIR}"/vmlinuz${NUMBER} + mv "${DESTDIR}"/initrd.img-*-${FLAVOUR} "${DESTDIR}"/initrd${NUMBER}.img + sed -i -e "s/linux.*-${FLAVOUR}/linux${NUMBER}/g" -e "s/vmlinuz-.*-${FLAVOUR}/vmlinuz${NUMBER}/g" -e "s/initrd.img-.*-${FLAVOUR}/initrd${NUMBER}.img/g" binary/syslinux.cfg + done + else + mv "${DESTDIR}"/vmlinuz-*-${LIVE_KERNEL_FLAVOUR} "${DESTDIR}"/vmlinuz + mv "${DESTDIR}"/initrd.img-*-${LIVE_KERNEL_FLAVOUR} "${DESTDIR}"/initrd.img + sed -i -e "s/linux.*-${LIVE_KERNEL_FLAVOUR}/linux/g" -e "s/vmlinuz-.*-${LIVE_KERNEL_FLAVOUR}/vmlinuz/g" -e "s/initrd.img-.*-${LIVE_KERNEL_FLAVOUR}/initrd.img/g" binary/syslinux.cfg + fi ;; esac if [ -n "${PACKAGES}" ] then - # Removing syslinux + # Removing packages case "${LH_APT}" in apt|apt-get) Chroot "apt-get remove --purge --yes ${PACKAGES}" diff --git a/helpers/lh_binary_usb b/helpers/lh_binary_usb index 79a3ee028..241488e9e 100755 --- a/helpers/lh_binary_usb +++ b/helpers/lh_binary_usb @@ -1,6 +1,11 @@ #!/bin/sh # lh_binary_usb(1) - build binary image +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,29 +15,36 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="build binary image" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap Read_conffile config/image Set_defaults -# Requiring stage file -Require_stagefile .stage/bootstrap -Require_stagefile .stage/chroot_proc - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Checking stage file -Check_stagefile .stage/binary_usb - for IMAGE in ${LIVE_BINARY_IMAGE} do if [ "${IMAGE}" = "usb" ] then + # Requiring stage file + Require_stagefile .stage/bootstrap + Require_stagefile .stage/chroot_proc + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Checking stage file + Check_stagefile .stage/binary_usb + if [ ! -f chroot/sbin/mkdosfs ] then PACKAGES="${PACKAGES} dosfstools" diff --git a/helpers/lh_bootstrap b/helpers/lh_bootstrap index c4db590f7..bae8828e6 100755 --- a/helpers/lh_bootstrap +++ b/helpers/lh_bootstrap @@ -1,6 +1,11 @@ #!/bin/sh # lh_bootstrap(1) - bootstrap a Debian system +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,9 +15,21 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="bootstrap a Debian system" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +if [ "${FORCE}" = "true" ] +then + OPTIONS="${OPTIONS} --force" +fi + # Reading configuration files Read_conffile config/common Set_defaults # Bootstrapping system -lh_bootstrap_"${LH_BOOTSTRAP}" +lh_bootstrap_"${LH_BOOTSTRAP}" "${OPTIONS}" diff --git a/helpers/lh_bootstrap_cdebootstrap b/helpers/lh_bootstrap_cdebootstrap index e4b83a2e7..b6ea6b910 100755 --- a/helpers/lh_bootstrap_cdebootstrap +++ b/helpers/lh_bootstrap_cdebootstrap @@ -1,6 +1,11 @@ #!/bin/sh # lh_bootstrap_cdebootstrap(1) - bootstrap a Debian system with cdebootstrap(1) +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="bootstrap a Debian system with cdebootstrap(1)" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Ensure that a system is built as root lh_testroot @@ -44,26 +56,26 @@ then CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --suite-config=${LIVE_DISTRIBUTION_CONFIG}" fi -if [ "${LIVE_FLAVOUR}" = "mini" ] || [ "${LIVE_FLAVOUR}" = "minimal" ] || [ "${LIVE_FLAVOUR}" = "minimal-net" ] +if [ "${LIVE_PACKAGES_LISTS}" != "minimal" ] && [ "${LIVE_PACKAGES_LISTS}" != "mini" ] then - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=minimal" -else CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=standard" +else + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=minimal" fi if [ -x "/usr/bin/cdebootstrap" ] then - # Restore old cache - if [ -d cache/bootstrap ] - then - mkdir -p chroot/var/cache/bootstrap - cp cache/bootstrap/*.deb chroot/var/cache/bootstrap - fi - if [ "${LH_CACHE}" = "enabled" ] then + # Restore old cache + if [ -d cache/bootstrap ] + then + mkdir -p chroot/var/cache/bootstrap + cp cache/bootstrap/*.deb chroot/var/cache/bootstrap + fi + # Executing cdebootstrap (download-only) - cdebootstrap ${CDEBOOTSTRAP_OPTIONS} --download-only "${LIVE_DISTRIBUTION}" chroot "${LIVE_MIRROR_LOCAL}" + cdebootstrap ${CDEBOOTSTRAP_OPTIONS} --download-only "${LIVE_DISTRIBUTION}" chroot "${LIVE_MIRROR_BUILD}" # Removing old cache if [ -d cache/bootstrap ] @@ -81,17 +93,23 @@ then fi # Executing cdebootstrap (regular run) - cdebootstrap ${CDEBOOTSTRAP_OPTIONS} "${LIVE_DISTRIBUTION}" chroot "${LIVE_MIRROR_LOCAL}" + cdebootstrap ${CDEBOOTSTRAP_OPTIONS} "${LIVE_DISTRIBUTION}" chroot "${LIVE_MIRROR_BUILD}" + + # Remove cdebootstrap-helper-diverts (needed at least for minimal flavours) + if [ "${LIVE_BOOTSTRAP_FLAVOUR}" = "minimal" ] || [ "${LIVE_BOOTSTRAP_FLAVOUR}" = "mini" ] + then + Chroot "dpkg -P cdebootstrap-helper-diverts" + fi + + # Removing bootstrap cache + if [ -d chroot/var/cache/bootstrap ] + then + rm -rf chroot/var/cache/bootstrap + fi + + # Creating stage file + Create_stagefile .stage/bootstrap else echo "E: Can't process file /usr/bin/cdebootstrap (FIXME)" exit 1 fi - -# Removing bootstrap cache -if [ -d chroot/var/cache/bootstrap ] -then - rm -rf chroot/var/cache/bootstrap -fi - -# Creating stage file -Create_stagefile .stage/bootstrap diff --git a/helpers/lh_bootstrap_debootstrap b/helpers/lh_bootstrap_debootstrap index 8ff83af48..ab7ac6b99 100755 --- a/helpers/lh_bootstrap_debootstrap +++ b/helpers/lh_bootstrap_debootstrap @@ -1,6 +1,11 @@ #!/bin/sh # lh_bootstrap_debootstrap(1) - bootstrap a Debian system with debootstrap(8) +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="bootstrap a Debian system with debootstrap(8)" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Ensure that a system is built as root lh_testroot @@ -46,17 +58,17 @@ fi if [ -x "/usr/sbin/debootstrap" ] then - # Restore old cache - if [ -d cache/bootstrap ] - then - mkdir -p chroot/var/cache/apt/archives - cp cache/bootstrap/*.deb chroot/var/cache/apt/archives - fi - if [ "${LH_CACHE}" = "enabled" ] then + # Restore old cache + if [ -d cache/bootstrap ] + then + mkdir -p chroot/var/cache/apt/archives + cp cache/bootstrap/*.deb chroot/var/cache/apt/archives + fi + # Executing debootstrap (download-only) - debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LIVE_DISTRIBUTION}" chroot "${LIVE_MIRROR_LOCAL}" "${LIVE_DEBOOTSTRAP_SCRIPT}" + debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LIVE_DISTRIBUTION}" chroot "${LIVE_MIRROR_BUILD}" "${LIVE_DEBOOTSTRAP_SCRIPT}" # Removing old cache if [ -d cache/bootstrap ] @@ -74,14 +86,14 @@ then fi # Executing debootstrap (regular run) - debootstrap ${DEBOOTSTRAP_OPTIONS} "${LIVE_DISTRIBUTION}" chroot "${LIVE_MIRROR_LOCAL}" "${LIVE_DEBOOTSTRAP_SCRIPT}" + debootstrap ${DEBOOTSTRAP_OPTIONS} "${LIVE_DISTRIBUTION}" chroot "${LIVE_MIRROR_BUILD}" "${LIVE_DEBOOTSTRAP_SCRIPT}" + + # Removing bootstrap cache + rm -rf chroot/var/cache/apt/archives/*.deb + + # Creating stage file + Create_stagefile .stage/bootstrap else echo "E: Can't process file /usr/bin/debootstrap (FIXME)" exit 1 fi - -# Removing bootstrap cache -rm -rf chroot/var/cache/apt/archives/*.deb - -# Creating stage file -Create_stagefile .stage/bootstrap diff --git a/helpers/lh_build b/helpers/lh_build index 1d839a925..bb05c747c 100755 --- a/helpers/lh_build +++ b/helpers/lh_build @@ -1,17 +1,40 @@ #!/bin/sh -# lh_build(1) - build a Debian system +# lh_build(1) - build a Debian Live system +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e +# Source common functions +for FUNCTION in /usr/share/live-helper/functions/*.sh +do + . ${FUNCTION} +done + +# Set static variables +DESCRIPTION="build a Debian Live system" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +if [ "${FORCE}" = "true" ] +then + OPTIONS="${OPTIONS} --force" +fi + # Bootstrapping system -lh_bootstrap +lh_bootstrap "${OPTIONS}" # Customizing chroot -lh_chroot +lh_chroot "${OPTIONS}" # Building binary image -lh_binary +lh_binary "${OPTIONS}" # Building source image -lh_source +lh_source "${OPTIONS}" diff --git a/helpers/lh_chroot b/helpers/lh_chroot index 75f3174cc..045b3ac9f 100755 --- a/helpers/lh_chroot +++ b/helpers/lh_chroot @@ -1,6 +1,13 @@ #!/bin/sh # lh_chroot(1) - customize the Debian system +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. + +set -e # Source common functions for FUNCTION in /usr/share/live-helper/functions/*.sh @@ -8,43 +15,56 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="customize the Debian system" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +if [ "${FORCE}" = "true" ] +then + OPTIONS="${OPTIONS} --force" +fi + # Reading configuration files Read_conffile config/common Read_conffile config/chroot Set_defaults # Configuring chroot -lh_chroot_proc install -lh_chroot_sysfs install -lh_chroot_debianchroot install -lh_chroot_sysvrc install -lh_chroot_hosts install -lh_chroot_resolv install -lh_chroot_apt install -lh_chroot_sources install -lh_chroot_linuximage install +lh_chroot_proc install "${OPTIONS}" +lh_chroot_sysfs install "${OPTIONS}" +lh_chroot_debianchroot install "${OPTIONS}" +lh_chroot_sysvrc install "${OPTIONS}" +lh_chroot_hosts install "${OPTIONS}" +lh_chroot_resolv install "${OPTIONS}" +lh_chroot_apt install "${OPTIONS}" +lh_chroot_sources install "${OPTIONS}" +lh_chroot_linuximage install "${OPTIONS}" # Customizing chroot -lh_chroot_tasks -lh_chroot_packageslist -lh_chroot_packages -lh_chroot_localpackages -lh_chroot_localpackageslist -lh_chroot_localization -lh_chroot_hacks -lh_chroot_localincludes -lh_chroot_sysvinit -lh_chroot_hooks -lh_chroot_localhooks -lh_chroot_symlinks +lh_chroot_tasks "${OPTIONS}" +lh_chroot_packageslists "${OPTIONS}" +lh_chroot_packages "${OPTIONS}" +lh_chroot_localpackages "${OPTIONS}" +lh_chroot_localpackageslists "${OPTIONS}" +lh_chroot_localization "${OPTIONS}" +lh_chroot_hacks "${OPTIONS}" +lh_chroot_localincludes "${OPTIONS}" +lh_chroot_sysvinit "${OPTIONS}" +lh_chroot_hooks "${OPTIONS}" +lh_chroot_localhooks "${OPTIONS}" +lh_chroot_symlinks "${OPTIONS}" +lh_chroot_interactive "${OPTIONS}" # Deconfiguring chroot -lh_chroot_linuximage remove -lh_chroot_sources remove -lh_chroot_apt remove -lh_chroot_resolv remove -lh_chroot_hosts remove -lh_chroot_sysvrc remove -lh_chroot_debianchroot remove -lh_chroot_sysfs remove -lh_chroot_proc remove +lh_chroot_linuximage remove "${OPTIONS}" +lh_chroot_sources remove "${OPTIONS}" +lh_chroot_apt remove "${OPTIONS}" +lh_chroot_resolv remove "${OPTIONS}" +lh_chroot_hosts remove "${OPTIONS}" +lh_chroot_sysvrc remove "${OPTIONS}" +lh_chroot_debianchroot remove "${OPTIONS}" +lh_chroot_sysfs remove "${OPTIONS}" +lh_chroot_proc remove "${OPTIONS}" diff --git a/helpers/lh_chroot_apt b/helpers/lh_chroot_apt index fd3701206..c80f22ff9 100755 --- a/helpers/lh_chroot_apt +++ b/helpers/lh_chroot_apt @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_apt(1) - manage /etc/apt/apt.conf +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="manage /etc/apt/apt.conf" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -29,6 +41,12 @@ case "${1}" in # Checking stage file Check_stagefile .stage/chroot_apt + if [ -f chroot/etc/apt/apt.conf ] + then + # Remove old /etc/apt/apt.conf + rm -f chroot/etc/apt/apt.conf + fi + if [ "${LH_APT}" = "aptitude" ] && [ ! -d chroot/etc/apt/apt.conf.d ] then mkdir -p chroot/etc/apt/apt.conf.d @@ -110,6 +128,30 @@ case "${1}" in esac fi + # Configuring apt secure + if [ "${LH_APT_SECURE}" = "enabled" ] + then + case "${LH_APT}" in + apt|apt-get) + echo "APT::Get::AllowUnauthenticated \"0\";" >> chroot/etc/apt/apt.conf + ;; + + aptitude) + echo "APT::Get::AllowUnauthenticated \"0\";" > chroot/etc/apt/apt.conf.d/secure + ;; + esac + else + case "${LH_APT}" in + apt|apt-get) + echo "APT::Get::AllowUnauthenticated \"1\";" >> chroot/etc/apt/apt.conf + ;; + + aptitude) + echo "APT::Get::AllowUnauthenticated \"1\";" > chroot/etc/apt/apt.conf.d/secure + ;; + esac + fi + # Creating stage file Create_stagefile .stage/chroot_apt ;; @@ -130,12 +172,14 @@ case "${1}" in # Deconfiguring aptitude recommends rm -f chroot/etc/apt/apt.conf.d/recommends + # Deconfiguring aptitude secure + rm -f chroot/etc/apt/apt.conf.d/secure + # Removing stage file rm -f .stage/chroot_apt ;; *) - echo "Usage: ${0} {install|remove}" - exit 1 + Usage ;; esac diff --git a/helpers/lh_chroot_debianchroot b/helpers/lh_chroot_debianchroot index d6fcaa362..1c926ebaa 100755 --- a/helpers/lh_chroot_debianchroot +++ b/helpers/lh_chroot_debianchroot @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_debianchroot(1) - manage /etc/debian_chroot +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="manage /etc/debian_chroot" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -57,7 +69,6 @@ case "${1}" in ;; *) - echo "Usage: ${0} {install|remove}" - exit 1 + Usage ;; esac diff --git a/helpers/lh_chroot_hacks b/helpers/lh_chroot_hacks index 2b08283e8..942222653 100755 --- a/helpers/lh_chroot_hacks +++ b/helpers/lh_chroot_hacks @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_hacks(1) - execute hacks in chroot +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="execute hacks in chroot" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -32,32 +44,37 @@ rm -f chroot/etc/udev/rules.d/z25_persistent-net.rules case "${LIVE_BINARY_IMAGE}" in net) - case "${LH_APT}" in - apt|apt-get) - Chroot "apt-get install --yes smbfs" - ;; + if [ ! -f chroot/usr/bin/smbmount ] + then + case "${LH_APT}" in + apt|apt-get) + Chroot "apt-get install --yes smbfs" + ;; - aptitude) - Chroot "aptitude install --assume-yes smbfs" - ;; - esac + aptitude) + Chroot "aptitude install --assume-yes smbfs" + ;; + esac + fi if [ ! -d chroot/etc/initramfs-tools ] then mkdir chroot/etc/initramfs-tools fi - - # Configuring initramfs for NFS + if [ ! "`grep 'MODULES=netboot' chroot/etc/initramfs-tools/initramfs.conf`" ] + then + # Configuring initramfs for NFS cat >> chroot/etc/initramfs-tools/initramfs.conf << EOF MODULES=netboot BOOT=nfs NFSROOT=auto EOF + fi ;; esac # Update initramfs -Chroot "update-initramfs -tu" +Chroot "update-initramfs -k all -t -u" # Creating stage file Create_stagefile .stage/chroot_hacks diff --git a/helpers/lh_chroot_hooks b/helpers/lh_chroot_hooks index d6558256a..47dea53c3 100755 --- a/helpers/lh_chroot_hooks +++ b/helpers/lh_chroot_hooks @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_hooks(1) - execute hooks in chroot +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="execute hooks in chroot" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -28,19 +40,19 @@ Check_lockfile .lock Create_lockfile .lock # Processing hooks -if [ -n "${LIVE_PACKAGES_LIST}" ] && [ -f /usr/share/live-helper/hooks/"${LIVE_PACKAGES_LIST}" ] +if [ -n "${LIVE_PACKAGES_LISTS}" ] && [ -f /usr/share/live-helper/hooks/"${LIVE_PACKAGES_LISTS}" ] then # Copying hook - cp /usr/share/live-helper/hooks/"${LIVE_PACKAGES_LIST}" chroot/root + cp /usr/share/live-helper/hooks/"${LIVE_PACKAGES_LISTS}" chroot/root # Making hook executable - if [ ! -x chroot/root/${LIVE_PACKAGES_LIST} ] + if [ ! -x chroot/root/${LIVE_PACKAGES_LISTS} ] then - chmod +x chroot/root/${LIVE_PACKAGES_LIST} + chmod +x chroot/root/${LIVE_PACKAGES_LISTS} fi # Executing hook - Chroot "/root/${LIVE_PACKAGES_LIST}" + Chroot "/root/${LIVE_PACKAGES_LISTS}" # Removing hook rm -f chroot/root/"${LIVE_PACKAGE_LIST}" diff --git a/helpers/lh_chroot_hosts b/helpers/lh_chroot_hosts index 48cc1c925..518ef3077 100755 --- a/helpers/lh_chroot_hosts +++ b/helpers/lh_chroot_hosts @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_hosts(1) - manage /etc/hosts +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="manage /etc/hosts" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -60,7 +72,6 @@ case "${1}" in ;; *) - echo "Usage: ${0} {install|remove}" - exit 1 + Usage ;; esac diff --git a/helpers/lh_chroot_interactive b/helpers/lh_chroot_interactive new file mode 100755 index 000000000..82fd98633 --- /dev/null +++ b/helpers/lh_chroot_interactive @@ -0,0 +1,66 @@ +#!/bin/sh + +# lh_chroot_interactive(1) - make build interactive +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. + +set -e + +# Source common functions +for FUNCTION in /usr/share/live-helper/functions/*.sh +do + . ${FUNCTION} +done + +# Set static variables +DESCRIPTION="make build interactive" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffile config/common +Read_conffile config/chroot +Set_defaults + +if [ "${LIVE_INTERACTIVE}" != "disabled" ] +then + # Requiring stage file + Require_stagefile .stage/bootstrap + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Checking stage file + Check_stagefile .stage/chroot_interactive + + case "${LIVE_INTERACTIVE}" in + enabled|shell) + echo "Pausing build: starting interactive shell..." + + Chroot "/bin/bash --login" + ;; + + x11) + echo "Pausing build: starting interactive X11..." + + Chroot "startx" + ;; + + xnest) + echo "Pausing build: starting interactive Xnest..." + + #Chroot "" # FIXME + ;; + esac + + # Creating stage file + Create_stagefile .stage/chroot_symlinks +fi diff --git a/helpers/lh_chroot_linuximage b/helpers/lh_chroot_linuximage index 0658155f6..c9443dd54 100755 --- a/helpers/lh_chroot_linuximage +++ b/helpers/lh_chroot_linuximage @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_linuximage(1) - manage /etc/kernel-img.conf +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="manage /etc/kernel-img.conf" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -38,19 +50,32 @@ case "${1}" in # Configuring kernel-img.conf echo "do_initrd = Yes" >> chroot/etc/kernel-img.conf - # Creating stage file - Create_stagefile .stage/chroot_linuximage + if [ "${LIVE_KERNEL_PACKAGES}" != "none" ] + then + for FLAVOUR in ${LIVE_KERNEL_FLAVOUR} + do + for PACKAGE in ${LIVE_KERNEL_PACKAGES} + do + PACKAGES="${PACKAGES} ${PACKAGE}-${FLAVOUR}" + done + done + fi + + PACKAGES="${PACKAGES} casper" # Installing linux-image, modules and casper case "${LH_APT}" in apt|apt-get) - Chroot "apt-get install --yes ${LIVE_KERNEL_PACKAGES}" + Chroot "apt-get install --yes ${PACKAGES}" ;; aptitude) - Chroot "aptitude install --assume-yes ${LIVE_KERNEL_PACKAGES}" + Chroot "aptitude install --assume-yes ${PACKAGES}" ;; esac + + # Creating stage file + Create_stagefile .stage/chroot_linuximage ;; remove) @@ -68,7 +93,6 @@ case "${1}" in ;; *) - echo "Usage: ${0} {install|remove}" - exit 1 + Usage ;; esac diff --git a/helpers/lh_chroot_localhooks b/helpers/lh_chroot_localhooks index 794e75903..ddc3af408 100755 --- a/helpers/lh_chroot_localhooks +++ b/helpers/lh_chroot_localhooks @@ -1,6 +1,11 @@ #!/bin/sh -# lh_chroot_localhooks(1) - execute hooks in chroot +# lh_chroot_localhooks(1) - execute local hooks in chroot +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="execute local hooks in chroot" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot diff --git a/helpers/lh_chroot_localincludes b/helpers/lh_chroot_localincludes index fc9c82992..05ca4ec7f 100755 --- a/helpers/lh_chroot_localincludes +++ b/helpers/lh_chroot_localincludes @@ -1,6 +1,11 @@ #!/bin/sh -# lh_chroot_localincludes(1) - copy files into chroot +# lh_chroot_localincludes(1) - copy local files into chroot +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="copy local files into chroot" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -31,7 +43,7 @@ if ls config/chroot_localincludes/* &> /dev/null then # Copying includes cd config/chroot_localincludes - find . | cpio -dmpu ../../chroot + find . | cpio -dmpu "${OLDPWD}"/chroot cd "${OLDPWD}" # Creating stage file diff --git a/helpers/lh_chroot_localization b/helpers/lh_chroot_localization index 24d60c006..a5d7de6ef 100755 --- a/helpers/lh_chroot_localization +++ b/helpers/lh_chroot_localization @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_localization(1) - install localization packages into chroot +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="install localization packages into chroot" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -660,11 +672,8 @@ then esac done - # Restore old cache - if [ -d cache/chroot_localization ] - then - cp cache/chroot_localization/*.deb chroot/var/cache/apt/archives - fi + # Restoring cache + Restore_cache cache/chroot_localization # Installing packages case "${LH_APT}" in @@ -677,18 +686,8 @@ then ;; esac - # Saving new cache - Chroot "apt-get autoclean" - - if ls chroot/var/cache/apt/archives/*.deb &> /dev/null - then - if [ ! -d cache/chroot_localization ] - then - mkdir -p cache/chroot_localization - fi - - mv -f chroot/var/cache/apt/archives/*.deb cache/chroot_localization - fi + # Saving cache + Save_cache cache/chroot_localization # Creating stage file Create_stagefile .stage/chroot_localization diff --git a/helpers/lh_chroot_localpackages b/helpers/lh_chroot_localpackages index 7f13acb62..b28552780 100755 --- a/helpers/lh_chroot_localpackages +++ b/helpers/lh_chroot_localpackages @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_localpackages(1) - install local packages into chroot +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="install local packages into chroot" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -29,11 +41,8 @@ Create_lockfile .lock if ls config/chroot_localpackages/*.deb &> /dev/null then - # Restore old cache - if [ -d cache/chroot_localpackages ] - then - cp cache/chroot_localpackages/*.deb chroot/var/cache/apt/archives - fi + # Restoring cache + Restore_cache cache/chroot_localpackages # Copying packages cp config/chroot_localpackages/*.deb chroot/root @@ -57,18 +66,8 @@ then rm -f chroot/root/*.deb rm -f chroot/root/localpackages - # Saving new cache - Chroot "apt-get autoclean" - - if ls chroot/var/cache/apt/archives/*.deb &> /dev/null - then - if [ ! -d cache/chroot_localpackages ] - then - mkdir -p cache/chroot_localpackages - fi - - mv -f chroot/var/cache/apt/archives/*.deb cache/chroot_localpackages - fi + # Saving cache + Save_cache cache/chroot_localpackages # Creating stage file Create_stagefile .stage/chroot_localpackages diff --git a/helpers/lh_chroot_localpackageslist b/helpers/lh_chroot_localpackageslists index 5039bc321..e5cc1bcfb 100755 --- a/helpers/lh_chroot_localpackageslist +++ b/helpers/lh_chroot_localpackageslists @@ -1,6 +1,11 @@ #!/bin/sh -# lh_chroot_localpackageslist(1) - install local packages into chroot +# lh_chroot_localpackageslists(1) - install local packages into chroot +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="install local packages into chroot" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -19,7 +31,7 @@ Set_defaults Require_stagefile .stage/bootstrap # Checking stage file -Check_stagefile .stage/chroot_localpackageslist +Check_stagefile .stage/chroot_localpackageslists # Checking lock file Check_lockfile .lock @@ -27,15 +39,12 @@ Check_lockfile .lock # Creating lock file Create_lockfile .lock -if ls config/chroot_localpackageslist/* &> /dev/null +if ls config/chroot_localpackageslists/* &> /dev/null then - # Restore old cache - if [ -d cache/chroot_localpackageslist ] - then - cp cache/chroot_localpackageslist/*.deb chroot/var/cache/apt/archives - fi + # Restoring cache + Restore_cache cache/chroot_localpackageslists - for PACKAGESLIST in config/chroot_localpackageslist/* + for PACKAGESLIST in config/chroot_localpackageslists/* do # Copying package list grep -v "^#" "${PACKAGESLIST}" > chroot/root/"`basename ${PACKAGESLIST}`" @@ -55,19 +64,9 @@ then rm -f chroot/root/"`basename ${PACKAGESLIST}`" done - # Saving new cache - Chroot "apt-get autoclean" - - if ls chroot/var/cache/apt/archives/*.deb &> /dev/null - then - if [ ! -d cache/chroot_localpackageslist ] - then - mkdir -p cache/chroot_localpackageslist - fi - - mv -f chroot/var/cache/apt/archives/*.deb cache/chroot_localpackageslist - fi + # Saving cache + Save_cache cache/chroot_localpackageslists # Creating stage file - Create_stagefile .stage/chroot_localpackageslist + Create_stagefile .stage/chroot_localpackageslists fi diff --git a/helpers/lh_chroot_packages b/helpers/lh_chroot_packages index e61d160e3..a0f5b8aa5 100755 --- a/helpers/lh_chroot_packages +++ b/helpers/lh_chroot_packages @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_packages(1) - install packages into chroot +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="install packages into chroot" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -30,11 +42,8 @@ Create_lockfile .lock if [ -n "${LIVE_PACKAGES}" ] then - # Restore old cache - if [ -d cache/chroot ] - then - cp cache/chroot_packages/*.deb chroot/var/cache/apt/archives - fi + # Restoring cache + Restore_cache cache/chroot_packages # Installing packages case "${LH_APT}" in @@ -47,18 +56,8 @@ then ;; esac - # Saving new cache - Chroot "apt-get autoclean" - - if ls chroot/var/cache/apt/archives/*.deb &> /dev/null - then - if [ ! -d cache/chroot_packages ] - then - mkdir -p cache/chroot_packages - fi - - mv -f chroot/var/cache/apt/archives/*.deb cache/chroot_packages - fi + # Saving cache + Save_cache cache/chroot_packages # Creating stage file Create_stagefile .stage/chroot_packages diff --git a/helpers/lh_chroot_packageslist b/helpers/lh_chroot_packageslists index dfe3a5c0e..3dfda53db 100755 --- a/helpers/lh_chroot_packageslist +++ b/helpers/lh_chroot_packageslists @@ -1,6 +1,11 @@ #!/bin/sh -# lh_chroot_packageslist(1) - install packages list into chroot +# lh_chroot_packageslists(1) - install packages lists into chroot +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="install packages lists into chroot" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -19,7 +31,7 @@ Set_defaults Require_stagefile .stage/bootstrap # Checking stage file -Check_stagefile .stage/chroot_packageslist +Check_stagefile .stage/chroot_packageslists # Checking lock file Check_lockfile .lock @@ -27,15 +39,12 @@ Check_lockfile .lock # Creating lock file Create_lockfile .lock -if [ -n "${LIVE_PACKAGES_LIST}" ] +if [ -n "${LIVE_PACKAGES_LISTS}" ] then - # Restore old cache - if [ -d cache/chroot_packageslist ] - then - cp cache/chroot_packageslist/*.deb chroot/var/cache/apt/archives - fi + # Restoring cache + Restore_cache cache/chroot_packageslists - for LIST in ${LIVE_PACKAGES_LIST} + for LIST in ${LIVE_PACKAGES_LISTS} do if [ -f /usr/share/live-helper/lists/"${LIST}" ] then @@ -58,19 +67,9 @@ then fi done - # Saving new cache - Chroot "apt-get autoclean" - - if ls chroot/var/cache/apt/archives/*.deb &> /dev/null - then - if [ ! -d cache/chroot_packageslist ] - then - mkdir -p cache/chroot_packageslist - fi - - mv -f chroot/var/cache/apt/archives/*.deb cache/chroot_packageslist - fi + # Saving cache + Save_cache cache/chroot_packageslists # Creating stage file - Create_stagefile .stage/chroot_packageslist + Create_stagefile .stage/chroot_packageslists fi diff --git a/helpers/lh_chroot_proc b/helpers/lh_chroot_proc index 0310d9c2a..ac0dd1788 100755 --- a/helpers/lh_chroot_proc +++ b/helpers/lh_chroot_proc @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_proc(1) - mount /proc +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="mount /proc" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -55,7 +67,6 @@ case "${1}" in ;; *) - echo "Usage: ${0} {install|remove}" - exit 1 + Usage ;; esac diff --git a/helpers/lh_chroot_resolv b/helpers/lh_chroot_resolv index 830c1858b..d319e9618 100755 --- a/helpers/lh_chroot_resolv +++ b/helpers/lh_chroot_resolv @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_resolv(1) - manage /etc/resolv.conf +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="manage /etc/resolv.conf" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -60,7 +72,6 @@ case "${1}" in ;; *) - echo "Usage: ${0} {install|remove}" - exit 1 + Usage ;; esac diff --git a/helpers/lh_chroot_sources b/helpers/lh_chroot_sources index 4fae531ce..6037c4feb 100755 --- a/helpers/lh_chroot_sources +++ b/helpers/lh_chroot_sources @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_sources(1) - manage /etc/apt/sources.list +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="manage /etc/apt/sources.list" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -32,32 +44,32 @@ case "${1}" in Check_stagefile .stage/chroot_sources # Configure custom sources.list - echo "deb ${LIVE_MIRROR_LOCAL} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" > chroot/etc/apt/sources.list + echo "deb ${LIVE_MIRROR_BUILD} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" > chroot/etc/apt/sources.list if [ "${LIVE_SOURCE}" = "enabled" ] then - echo "deb-src ${LIVE_MIRROR_LOCAL} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" >> chroot/etc/apt/sources.list + echo "deb-src ${LIVE_MIRROR_BUILD} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" >> chroot/etc/apt/sources.list fi if [ "${LIVE_SECURITY}" = "enabled" ] then if [ "${LIVE_DISTRIBUTION}" != "sid" ] && [ "${LIVE_DISTRIBUTION}" = "unstable" ] then - echo "deb ${LIVE_MIRROR_LOCAL_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> chroot/etc/apt/sources.list + echo "deb ${LIVE_MIRROR_BUILD_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> chroot/etc/apt/sources.list if [ "${LIVE_SOURCE}" = "yes" ] then - echo "deb-src ${LIVE_MIRROR_LOCAL_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> chroot/etc/apt/sources.list + echo "deb-src ${LIVE_MIRROR_BUILD_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> chroot/etc/apt/sources.list fi fi fi # Check local sources.list - if [ -f config/sources.list.local ] + if [ -f config/sources.list.build ] then echo "" >> chroot/etc/apt/sources.list echo "# Custom repositories" >> chroot/etc/apt/sources.list - cat config/sources.list.local >> chroot/etc/apt/sources.list + cat config/sources.list.build >> chroot/etc/apt/sources.list fi # Installing aptitude @@ -87,32 +99,32 @@ case "${1}" in rm -rf chroot/var/lib/apt/lists mkdir -p chroot/var/lib/apt/lists/partial - echo "deb ${LIVE_MIRROR_GENERIC} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" > chroot/etc/apt/sources.list + echo "deb ${LIVE_MIRROR_IMAGE} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" > chroot/etc/apt/sources.list if [ "${LIVE_SOURCE}" = "enabled" ] then - echo "deb-src ${LIVE_MIRROR_GENERIC} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" >> chroot/etc/apt/sources.list + echo "deb-src ${LIVE_MIRROR_IMAGE} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" >> chroot/etc/apt/sources.list fi if [ "${LIVE_SECURITY}" = "enabled" ] then if [ "${LIVE_DISTRIBUTION}" = "etch" ] || [ "${LIVE_DISTRIBUTION}" = "testing" ] then - echo "deb ${LIVE_MIRROR_GENERIC_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> chroot/etc/apt/sources.list + echo "deb ${LIVE_MIRROR_IMAGE_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> chroot/etc/apt/sources.list if [ "${LIVE_SOURCE}" = "yes" ] then - echo "deb-src ${LIVE_MIRROR_GENERIC_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> chroot/etc/apt/sources.list + echo "deb-src ${LIVE_MIRROR_IMAGE_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> chroot/etc/apt/sources.list fi fi fi # Check local sources.list - if [ -f config/sources.list.generic ] + if [ -f config/sources.list.image ] then echo "" >> chroot/etc/apt/sources.list echo "# Custom repositories" >> chroot/etc/apt/sources.list - cat config/sources.list.generic >> chroot/etc/apt/sources.list + cat config/sources.list.image >> chroot/etc/apt/sources.list fi case "${LH_APT}" in @@ -141,7 +153,6 @@ case "${1}" in ;; *) - echo "Usage: ${0} {install|remove}" - exit 1 + Usage ;; esac diff --git a/helpers/lh_chroot_symlinks b/helpers/lh_chroot_symlinks index 9f958c648..850c8f8b8 100755 --- a/helpers/lh_chroot_symlinks +++ b/helpers/lh_chroot_symlinks @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_symlinks(1) - convert symlinks +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="convert symlinks" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot diff --git a/helpers/lh_chroot_sysfs b/helpers/lh_chroot_sysfs index 8480061f1..3d51eef05 100755 --- a/helpers/lh_chroot_sysfs +++ b/helpers/lh_chroot_sysfs @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_sysfs(1) - mount /sys +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="mount /sys" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -52,7 +64,6 @@ case "${1}" in ;; *) - echo "Usage: ${0} {install|remove}" - exit 1 + Usage ;; esac diff --git a/helpers/lh_chroot_sysvinit b/helpers/lh_chroot_sysvinit index cae4b8a45..7817b47f7 100755 --- a/helpers/lh_chroot_sysvinit +++ b/helpers/lh_chroot_sysvinit @@ -1,6 +1,11 @@ #!/bin/sh -# lh_chroot_sysvinit(1) - configures sysvinit +# lh_chroot_sysvinit(1) - configure sysvinit +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="configure sysvinit" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot diff --git a/helpers/lh_chroot_sysvrc b/helpers/lh_chroot_sysvrc index 403982bed..ec27ad24d 100755 --- a/helpers/lh_chroot_sysvrc +++ b/helpers/lh_chroot_sysvrc @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_sysvrc(1) - manage /usr/sbin/policy-rc.d +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="manage /usr/sbin/policy-rc.d" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -66,7 +78,6 @@ EOF ;; *) - echo "Usage: ${0} {install|remove}" - exit 1 + Usage ;; esac diff --git a/helpers/lh_chroot_tasks b/helpers/lh_chroot_tasks index b2ffb8fab..33a846485 100755 --- a/helpers/lh_chroot_tasks +++ b/helpers/lh_chroot_tasks @@ -1,6 +1,11 @@ #!/bin/sh # lh_chroot_tasks(1) - install tasks into chroot +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="install tasks into chroot" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/chroot @@ -27,29 +39,57 @@ Check_lockfile .lock # Creating lock file Create_lockfile .lock -if [ -n "${LIVE_TASKS}" ] && [ "${LH_APT}" = "aptitude" ] +if [ -n "${LIVE_TASKS}" ] then - # Restore old cache - if [ -d cache/chroot_tasks ] + # Restoring cache + Restore_cache cache/chroot_tasks + + if [ ! -f chroot/usr/bin/aptitude ] + then + PACKAGES="${PACKAGES} aptitude" + fi + + if [ ! -f chroot/usr/bin/tasksel ] then - cp cache/chroot_tasks/*.deb chroot/var/cache/apt/archives + PACKAGES="${PACKAGES} tasksel" fi - Chroot "aptitude install --assume-yes ${LIVE_TASKS}" + if [ -n "${PACKAGES}" ] + then + # Installing symlinks + case "${LH_APT}" in + apt|apt-get) + Chroot "apt-get install --yes ${PACKAGES}" + ;; - # Saving new cache - Chroot "apt-get autoclean" + aptitude) + Chroot "aptitude install --assume-yes ${PACKAGES}" + ;; + esac + fi - if ls chroot/var/cache/apt/archives/*.deb &> /dev/null + for TASK in ${LIVE_TASKS} + do + Chroot "tasksel --debconf-apt-progress --logstderr install ${TASK}" + done + + if [ -n "${PACKAGES}" ] then - if [ ! -d cache/chroot_tasks ] - then - mkdir -p cache/chroot_tasks - fi + # Removing packages + case "${LH_APT}" in + apt|apt-get) + Chroot "apt-get remove --purge --yes ${PACKAGES}" + ;; - mv -f chroot/var/cache/apt/archives/*.deb cache/chroot_tasks + aptitude) + Chroot "aptitude purge --assume-yes ${PACKAGES}" + ;; + esac fi + # Saving cache + Save_cache cache/chroot_tasks + # Creating stage file Create_stagefile .stage/chroot_tasks fi diff --git a/helpers/lh_clean b/helpers/lh_clean index 8508a9cc8..1aad87d66 100755 --- a/helpers/lh_clean +++ b/helpers/lh_clean @@ -1,6 +1,11 @@ #!/bin/sh # lh_clean(1) - clean up system build directories +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="clean up system build directories" +HELP="" +USAGE="${PROGRAM} [all|cache|chroot|binary|lock|purge|stage|source]" + +Arguments "${@}" + # Ensure that a system is built as root lh_testroot @@ -21,6 +33,7 @@ case "${1}" in all) "${0}" chroot "${0}" binary + "${0}" lock "${0}" stage "${0}" source ;; @@ -38,31 +51,42 @@ case "${1}" in umount -f chroot/dev > /dev/null 2>&1 || true rm -rf chroot + + rm -f .stage/chroot* ;; binary) - rm -rf binary - rm -f binary.iso rm -f binary.img rm -f binary*.tar.gz rm -f packages.txt + rm -rf binary + rm -rf tftpboot + rm -f .stage/binary* ;; + lock) + rm -f .lock + ;; + + purge) + "${0}" all + "${0}" cache + ;; + stage) rm -rf .stage - rm -f .lock ;; source) - rm -rf source - rm -f source.iso rm -f source.img rm -f source*.tar.gz + rm -rf source + rm -f .stage/source* ;; diff --git a/helpers/lh_config b/helpers/lh_config index b0aff1e3c..b6eccd7eb 100755 --- a/helpers/lh_config +++ b/helpers/lh_config @@ -1,6 +1,11 @@ #!/bin/sh -# lh_make(1) - create sample configuration for live-helper(7) +# lh_config(1) - create configuration for live-helper(7) +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="create configuration for live-helper(7)" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + if [ "${1}" != "newconfig" ] then # Source existing configuration @@ -53,6 +65,10 @@ LH_APT_PDIFFS="${LH_APT_PDIFFS}" # (Default: ${LH_APT_RECOMMENDS}) LH_APT_RECOMMENDS="${LH_APT_RECOMMENDS}" +# \$LH_APT_SECURE: enable secure +# (Default: ${LH_APT_SECURE}) +LH_APT_SECURE="${LH_APT_SECURE}" + # \$LH_BOOTSTRAP: select the bootstrap program # (Default: ${LH_BOOTSTRAP}) LH_BOOTSTRAP="${LH_BOOTSTRAP}" @@ -70,7 +86,7 @@ LH_DEBCONF_FRONTEND="${LH_DEBCONF_FRONTEND}" LH_DEBCONF_PRIORITY="${LH_DEBCONF_PRIORITY}" # \$LH_GENISOIMAGE: set the genisoimage program -# (Default: autodetected) +# (Default: ${LH_GENISOIMAGE}) LH_GENISOIMAGE="${LH_GENISOIMAGE}" # \$LH_LOSETUP: set the losetup program @@ -86,13 +102,13 @@ EOF cat > "${LIVE_ROOT}"/config/chroot << EOF # config/chroot: configuration for lh_chroot_* -# \$LIVE_KERNEL: set the kernel flavour to use +# \$LIVE_KERNEL_FLAVOUR: set the kernel flavour to use # (Default: autodetected) -LIVE_KERNEL="${LIVE_KERNEL}" +LIVE_KERNEL_FLAVOUR="${LIVE_KERNEL_FLAVOUR}" -# \$LIVE_KERNEL: set the kernel packages to use +# \$LIVE_KERNEL_PACKAGES: set the kernel packages to use # (Default: autodetected) -#LIVE_KERNEL_PACKAGES +LIVE_KERNEL_PACKAGES="${LIVE_KERNEL_PACKAGES}" # \$LIVE_LANGUAGE: set the language to use # (Default: empty) @@ -102,9 +118,9 @@ LIVE_LANGUAGE="${LIVE_LANGUAGE}" # (Default: empty) LIVE_PACKAGES="${LIVE_PACKAGES}" -# \$LIVE_PACKAGES_LIST: set the package list to install -# (Default: ${LIVE_PACKAGES_LIST}) -LIVE_PACKAGES_LIST="${LIVE_PACKAGES_LIST}" +# \$LIVE_PACKAGES_LISTS: set the package list to install +# (Default: ${LIVE_PACKAGES_LISTS}) +LIVE_PACKAGES_LISTS="${LIVE_PACKAGES_LISTS}" # \$LIVE_TASKS: set the tasks to install # (Default: empty) @@ -121,13 +137,17 @@ LIVE_SYMLINKS="${LIVE_SYMLINKS}" # \$LIVE_SYSVINIT: enable sysvinit # (Default: ${LIVE_SYSVINIT}) LIVE_SYSVINIT="${LIVE_SYSVINIT}" + +# \$LIVE_INTERACTIVE: set interactive build +# (Default: ${LIVE_INTERACTIVE}) +LIVE_INTERACTIVE="${LIVE_INTERACTIVE}" EOF # Creating lh_chroot_* directories install -d -m 0755 "${LIVE_ROOT}"/config/chroot_localhooks || true install -d -m 0755 "${LIVE_ROOT}"/config/chroot_localincludes || true install -d -m 0755 "${LIVE_ROOT}"/config/chroot_localpackages || true -install -d -m 0755 "${LIVE_ROOT}"/config/chroot_localpackageslist || true +install -d -m 0755 "${LIVE_ROOT}"/config/chroot_localpackageslists || true # Creating lh_bootstrap_* configuration cat > "${LIVE_ROOT}"/config/bootstrap << EOF @@ -145,25 +165,25 @@ LIVE_DISTRIBUTION="${LIVE_DISTRIBUTION}" # (Default: empty) LIVE_DISTRIBUTION_CONFIG="${LIVE_DISTRIBUTION_CONFIG}" -# \$LIVE_FLAVOUR: select the flavour to use -# (Default: ${LIVE_FLAVOUR}) -LIVE_FLAVOUR="${LIVE_FLAVOUR}" +# \$LIVE_BOOTSTRAP_FLAVOUR: select the flavour to use +# (Default: ${LIVE_BOOTSTRAP_FLAVOUR}) +LIVE_BOOTSTRAP_FLAVOUR="${LIVE_BOOTSTRA_PFLAVOUR}" -# \$LIVE_MIRROR_LOCAL: set the local mirror to use -# (Default: ${LIVE_MIRROR_LOCAL}) -LIVE_MIRROR_LOCAL="${LIVE_MIRROR_LOCAL}" +# \$LIVE_MIRROR_BUILD: set the mirror to fetch packages from +# (Default: ${LIVE_MIRROR_BUILD}) +LIVE_MIRROR_BUILD="${LIVE_MIRROR_BUILD}" -# \$LIVE_MIRROR_LOCAL_SECURITY: set the local security mirror to use -# (Default: ${LIVE_MIRROR_LOCAL_SECURITY}) -LIVE_MIRROR_LOCAL_SECURITY="${LIVE_MIRROR_LOCAL_SECURITY}" +# \$LIVE_MIRROR_BUILD_SECURITY: set the security mirror to fetch packages from +# (Default: ${LIVE_MIRROR_BUILD_SECURITY}) +LIVE_MIRROR_BUILD_SECURITY="${LIVE_MIRROR_BUILD_SECURITY}" -# \$LIVE_MIRROR_GENERIC: set the generic mirror to use -# (Default: ${LIVE_MIRROR_GENERIC}) -LIVE_MIRROR_GENERIC="${LIVE_MIRROR_GENERIC}" +# \$LIVE_MIRROR_IMAGE: set the mirror which ends up in the image +# (Default: ${LIVE_MIRROR_IMAGE}) +LIVE_MIRROR_IMAGE="${LIVE_MIRROR_IMAGE}" -# \$LIVE_MIRROR_GENERIC_SECURITY: set the generic security mirror to use -# (Default: ${LIVE_MIRROR_GENERIC_SECURITY}) -LIVE_MIRROR_GENERIC_SECURITY="${LIVE_MIRROR_GENERIC_SECURITY}" +# \$LIVE_MIRROR_IMAGE_SECURITY: set the security mirror which ends up in the image +# (Default: ${LIVE_MIRROR_IMAGE_SECURITY}) +LIVE_MIRROR_IMAGE_SECURITY="${LIVE_MIRROR_IMAGE_SECURITY}" # \$LIVE_SECTIONS: select the section(s) to use # (Default: ${LIVE_SECTIONS}) @@ -182,6 +202,14 @@ LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND}" # (Default: empty) LIVE_ENCRYPTION="${LIVE_ENCRYPTION}" +# \$LIVE_USERNAME: set username +# (Default: ${LIVE_USERNAME}) +LIVE_USERNAME="${LIVE_USERNAME}" + +# \$LIVE_HOSTNAME: set hostname +# (Default: ${LIVE_HOSTNAME}) +LIVE_HOSTNAME="${LIVE_HOSTNAME}" + # \$LIVE_FILESYSTEM: set filesystem # (Default: ${LIVE_FILESYSTEM}) LIVE_FILESYSTEM="${LIVE_FILESYSTEM}" @@ -222,7 +250,14 @@ LIVE_BINARY_IMAGE="${LIVE_BINARY_IMAGE}" # (Default: ${LIVE_SOURCE_IMAGE}) LIVE_SOURCE_IMAGE="${LIVE_SOURCE_IMAGE}" +# \$LIVE_INCLUDES: set includes +# (Default: ${LIVE_INCLUDES}) +LIVE_INCLUDES="${LIVE_INCLUDES}" + # \$LIVE_TEMPLATES: set templates # (Default: ${LIVE_TEMPLATES}) LIVE_TEMPLATES="${LIVE_TEMPLATES}" EOF + +# Creating lh_binary_* directories +install -d -m 0755 "${LIVE_ROOT}"/config/binary_localincludes || true diff --git a/helpers/lh_losetup b/helpers/lh_losetup index 94337acf4..fb7141e5a 100755 --- a/helpers/lh_losetup +++ b/helpers/lh_losetup @@ -1,6 +1,11 @@ #!/bin/sh -# lh_losetup <device> <file> <partition> +# lh_losetup - wrapper around losetup +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="wrapper around losetup" +HELP="" +USAGE="${PROGRAM} <device> <file> <partition>" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Set_defaults diff --git a/helpers/lh_source b/helpers/lh_source index 0d23184ef..526646f49 100755 --- a/helpers/lh_source +++ b/helpers/lh_source @@ -1,6 +1,13 @@ #!/bin/sh -# lh_source(1) - building the source images +# lh_source(1) - build source images +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. + +set -e # Source common functions for FUNCTION in /usr/share/live-helper/functions/*.sh @@ -8,27 +15,40 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="build source images" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +if [ "${FORCE}" = "true" ] +then + OPTIONS="${OPTIONS} --force" +fi + # Reading configuration files Read_conffile config/common Read_conffile config/image Set_defaults # Enabling network in chroot -lh_chroot_hosts install -lh_chroot_resolv install -lh_chroot_sources install +lh_chroot_hosts install "${OPTIONS}" +lh_chroot_resolv install "${OPTIONS}" +lh_chroot_sources install "${OPTIONS}" # Preparing images -lh_source_config -lh_source_download +lh_source_config "${OPTIONS}" +lh_source_download "${OPTIONS}" +lh_source_md5sum "${OPTIONS}" # Building images -lh_source_generic -lh_source_iso -lh_source_net -lh_source_usb +lh_source_generic "${OPTIONS}" +lh_source_iso "${OPTIONS}" +lh_source_net "${OPTIONS}" +lh_source_usb "${OPTIONS}" # Deconfiguring chroot rm -f .stage/chroot_sources -lh_chroot_resolv remove -lh_chroot_hosts remove +lh_chroot_resolv remove "${OPTIONS}" +lh_chroot_hosts remove "${OPTIONS}" diff --git a/helpers/lh_source_config b/helpers/lh_source_config index fe96d094a..870165333 100755 --- a/helpers/lh_source_config +++ b/helpers/lh_source_config @@ -1,6 +1,11 @@ #!/bin/sh -# lh_source_config(1) - copies debian-live config into source +# lh_source_config(1) - copy debian-live config into source +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="copy debian-live config into source" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/image diff --git a/helpers/lh_source_download b/helpers/lh_source_download index 208122064..c1903f886 100755 --- a/helpers/lh_source_download +++ b/helpers/lh_source_download @@ -1,6 +1,11 @@ #!/bin/sh # lh_source_download(1) - download sources +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="download sources" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/image diff --git a/helpers/lh_source_generic b/helpers/lh_source_generic index 88b0bf7c2..81ba3a598 100755 --- a/helpers/lh_source_generic +++ b/helpers/lh_source_generic @@ -1,6 +1,11 @@ #!/bin/sh # lh_source_generic(1) - build source generic image +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="build source generic image" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/image diff --git a/helpers/lh_source_hdd b/helpers/lh_source_hdd index 93eaa7f02..9fbdf074e 100755 --- a/helpers/lh_source_hdd +++ b/helpers/lh_source_hdd @@ -1,6 +1,11 @@ #!/bin/sh # lh_source_hdd(1) - build source harddisk image +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="build source harddisk image" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/image diff --git a/helpers/lh_source_iso b/helpers/lh_source_iso index 3254ed62a..25dcb5f4c 100755 --- a/helpers/lh_source_iso +++ b/helpers/lh_source_iso @@ -1,6 +1,11 @@ #!/bin/sh # lh_source_iso(1) - build source iso image +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="build source iso image" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/image diff --git a/helpers/lh_source_md5sum b/helpers/lh_source_md5sum new file mode 100755 index 000000000..70a285490 --- /dev/null +++ b/helpers/lh_source_md5sum @@ -0,0 +1,57 @@ +#!/bin/sh + +# lh_source_md5sum(1) - create source md5sums +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. + +set -e + +# Source common functions +for FUNCTION in /usr/share/live-helper/functions/*.sh +do + . ${FUNCTION} +done + +# Set static variables +DESCRIPTION="create source md5sums" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffile config/common +Read_conffile config/image +Set_defaults + +if [ "${LIVE_SOURCE}" = "enabled" ] +then + # Requiring stage file + Require_stagefile .stage/source_download + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Checking stage file + Check_stagefile .stage/source_md5sum + + # Remove old md5sums + if [ -f source/md5sum.txt ] + then + rm -f source/md5sum.txt + fi + + # Calculating md5sums + cd source + find . -type f -print0 | xargs -0 md5sum > md5sum.txt + cd "${OLDPWD}" + + # Creating stage file + Create_stagefile .stage/source_md5sum +fi diff --git a/helpers/lh_source_net b/helpers/lh_source_net index 0f60ddc88..9a3c72d1c 100755 --- a/helpers/lh_source_net +++ b/helpers/lh_source_net @@ -1,6 +1,11 @@ #!/bin/sh # lh_source_net(1) - build source net image +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="build source net image" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/image diff --git a/helpers/lh_source_usb b/helpers/lh_source_usb index 7df37c748..8f88715d7 100755 --- a/helpers/lh_source_usb +++ b/helpers/lh_source_usb @@ -1,6 +1,11 @@ #!/bin/sh # lh_source_usb(1) - build source image +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. set -e @@ -10,6 +15,13 @@ do . ${FUNCTION} done +# Set static variables +DESCRIPTION="build source image" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap diff --git a/helpers/lh_testroot b/helpers/lh_testroot index e213ec5b8..bda3a4625 100755 --- a/helpers/lh_testroot +++ b/helpers/lh_testroot @@ -1,6 +1,26 @@ #!/bin/sh # lh_testroot(1) - ensure that a system is built as root +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. +# This is free software, and you are welcome to redistribute it +# under certain conditions; see COPYING for details. + +set -e + +# Source common functions +for FUNCTION in /usr/share/live-helper/functions/*.sh +do + . ${FUNCTION} +done + +# Set static variables +DESCRIPTION="ensure that a system is built as root" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" set -e diff --git a/helpers/make-live b/helpers/make-live index 6dc27af95..741de9754 100755 --- a/helpers/make-live +++ b/helpers/make-live @@ -1,10 +1,26 @@ #!/bin/sh -set -e +# make-live(1) - utility to build Debian Live systems +# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> +# +# This program 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 2 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 St, Fifth Floor, Boston, MA 02110-1301 USA +# +# On Debian systems, the complete text of the GNU General Public License +# can be found in /usr/share/common-licenses/GPL file. -# Set static variables -PROGRAM="`basename ${0}`" -DESCRIPTION="utility to build Debian Live systems" +set -e # Source common functions for FUNCTION in /usr/share/live-helper/functions/*.sh @@ -12,21 +28,16 @@ do . ${FUNCTION} done -Set_defaults - -# Source existing configuration -Read_conffile debian-live/config/common -Read_conffile debian-live/config/bootstrap -Read_conffile debian-live/config/chroot -Read_conffile debian-live/config/image - -USAGE="Usage: ${PROGRAM} [config] [--apt apt|aptitude] [--apt-ftpproxy URL] [--apt-httpproxy URL] [--apt-generic enabled|disabled] [--apt-pdiffs enabled|disabled] [--apt-recommends enabled|disabled] [--bootstrap cdebootstrap|deboostrap] [--cache enabled|disabled] [--debconf-frontend dialog|readline|noninteractive] [--debconf-priority low|medium|high|critical] [--genisoimage genisoimage|mkisofs] [--losetup losetup|losetup.org] [--root DIRECTORY] [-a|--architecture ARCHITECTURE] [-d|--distribution testing|unstable|etch|sid] [--distribution-config DIRECTORY] [-f|--flavour minimal|standard] [-m|--mirror-local URL] [--mirror-local-security URL] [--mirror-generic URL] [--mirror-generic-security URL] [--sections SECTION|\"SECTIONS\"] [-k|--kernel KERNEL] [--kernel-packages PACKAGES] [-l|--language LANGUAGE] [--packages PACKAGE|\"PACKAGES\"] [-p|--packages-list LIST] [--tasks TASK|\"TASKS\"] [--security enabled|disabled] [--symlinks enabled|disabled] [--sysvinit enabled|disabled] [--bootappend KERNEL_PARAMETER|\"KERNEL_PARAMETERS\"] [-e|--encryption ALGORITHM] [--filesystem ext2|plain|squashfs] [--memtest86 enabled|disabled] [--iso-volume STRING] [--server-address HOSTNAME|IP] [--server-path DIRECTORY] [--source enabled|disabled] [--syslinux enabled|disabled] [--syslinux-splash FILE] [-b|--binary-image hdd|iso|usb|net] [-s|--source-image generic|hdd|iso|usb|net] [--templates DIRECTORY]" +# Set static variables +PROGRAM="`basename ${0}`" +DESCRIPTION="utility to build Debian Live systems" +USAGE="${PROGRAM} [config] [--apt apt|aptitude] [--apt-ftpproxy URL] [--apt-httpproxy URL] [--apt-generic enabled|disabled] [--apt-pdiffs enabled|disabled] [--apt-recommends enabled|disabled] [--apt-secure enabled|disabled] [--bootstrap cdebootstrap|deboostrap] [--cache enabled|disabled] [--debconf-frontend dialog|readline|noninteractive] [--debconf-priority low|medium|high|critical] [--genisoimage genisoimage|mkisofs] [--losetup losetup|losetup.org] [-r|--root DIRECTORY] [-a|--architecture ARCHITECTURE] [-d|--distribution testing|unstable|etch|sid] [--distribution-config DIRECTORY] [-f|--bootstrap-flavour minimal|standard] [-m|--mirror-build URL] [--mirror-build-security URL] [--mirror-image URL] [--mirror-image-security URL] [--sections SECTION|\"SECTIONS\"] [--interactive shell|x11|xnest] [-k|--kernel-flavour FLAVOUR] [--kernel-packages PACKAGES] [-l|--language LANGUAGE] [--packages PACKAGE|\"PACKAGES\"] [-p|--packages-lists LIST|\"LISTS\"] [--tasks TASK|\"TASKS\"] [--security enabled|disabled] [--symlinks enabled|disabled] [--sysvinit enabled|disabled] [--bootappend KERNEL_PARAMETER|\"KERNEL_PARAMETERS\"] [-e|--encryption ALGORITHM] [--username NAME] [--hostname NAME] [--filesystem ext2|plain|squashfs] [--memtest86 enabled|disabled] [--iso-volume STRING] [--server-address HOSTNAME|IP] [--server-path DIRECTORY] [--source enabled|disabled] [--syslinux enabled|disabled] [--syslinux-splash FILE] [-b|--binary-image hdd|iso|usb|net] [-s|--source-image generic|hdd|iso|usb|net] [--includes DIRECTORY] [--templates DIRECTORY] [--force]" HELP="Lists: gnome, gnome-core, gnome-desktop, gnome-full, gnome-junior, gnustep, kde, kde-core, kde-desktop, kde-extra, kde-full, kde-junior, mini, minimal, minimal-net, rescue, standard, standard-x11, xfce, xfce-desktop, xfce-junior" -Main () +Local_arguments () { - ARGUMENTS="`getopt --longoptions apt:,apt-ftpproxy:,apt-httpproxy:,apt-generic:,apt-pdiffs:,apt-recommends:,bootstrap:,cache:,debconf-frontend:,debconf-priority:,genisoimage:,losetup:,root:,architecture:,distribution:,distribution-config:,flavour:,mirror:,mirror-security:,mirror-generic:,mirror-generic-security:,sections:,kernel:,kernel-packages:,language:,packages:,packages-list:,tasks:,security:,symlinks:,sysvinit:,bootappend:,encryption:,filesystem:,memtest86:,iso-volume:,server-address:,server-path:,source:,syslinux:,syslinux-splash:,binary-image:,binary-source:,templates:,help,usage,version --name=${PROGRAM} --options a:d:f:m:k:l:p:e:b:s:huv --shell sh -- "${@}"`" + ARGUMENTS="`getopt --longoptions apt:,apt-ftpproxy:,apt-httpproxy:,apt-generic:,apt-pdiffs:,apt-recommends:,apt-secure:,bootstrap:,cache:,debconf-frontend:,debconf-priority:,genisoimage:,losetup:,root:,architecture:,distribution:,distribution-config:,flavour:,mirror-local:,mirror-local-security:,mirror-generic:,mirror-generic-security:,sections:,interactive:,kernel:,kernel-packages:,language:,packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,bootappend:,encryption:,username:,hostname:,filesystem:,memtest86:,iso-volume:,server-address:,server-path:,source:,syslinux:,syslinux-splash:,binary-image:,binary-source:,includes:,templates:,help,usage,version,force --name=${PROGRAM} --options r:a:d:f:m:k:l:p:e:b:s:huv --shell sh -- "${@}"`" if [ "${?}" != "0" ] then @@ -69,6 +80,10 @@ Main () LH_APT_RECOMMENDS="${2}"; shift 2 ;; + --apt-secure) + LH_APT_SECURE="${2}"; shift 2 + ;; + --bootstrap) LH_BOOTSTRAP="${2}"; shift 2 ;; @@ -93,7 +108,7 @@ Main () LH_LOSETUP="${2}"; shift 2 ;; - --root) + -r|--root) LIVE_ROOT="${2}"; shift 2 ;; @@ -111,24 +126,24 @@ Main () LIVE_DISTRIBUTION_CONFIG="${2}"; shift 2 ;; - -f|--flavour) - LIVE_FLAVOUR="${2}"; shift 2 + -f|--bootstrap-flavour) + LIVE_BOOTSTRAP_FLAVOUR="${2}"; shift 2 ;; - -m|--mirror-local) - LIVE_MIRROR_LOCAL="${2}"; shift 2 + -m|--mirror-build) + LIVE_MIRROR_BUILD="${2}"; shift 2 ;; - --mirror-local-security) - LIVE_MIRROR_LOCAL_SECURITY="${2}"; shift 2 + --mirror-build-security) + LIVE_MIRROR_BUILD_SECURITY="${2}"; shift 2 ;; - --mirror-generic) - LIVE_MIRROR_GENERIC="${2}"; shift 2 + --mirror-image) + LIVE_MIRROR_IMAGE="${2}"; shift 2 ;; - --mirror-generic-security) - LIVE_MIRROR_GENERIC_SECURITY="${2}"; shift 2 + --mirror-image-security) + LIVE_MIRROR_IMAGE_SECURITY="${2}"; shift 2 ;; --sections) @@ -136,8 +151,12 @@ Main () ;; # chroot - -k|--kernel) - LIVE_KERNEL="${2}"; shift 2 + --interactive) + LIVE_INTERACTIVE="${2}"; shift 2 + ;; + + -k|--kernel-flavour) + LIVE_KERNEL_FLAVOUR="${2}"; shift 2 ;; --kernel-packages) @@ -152,8 +171,8 @@ Main () LIVE_PACKAGES="${2}"; shift 2 ;; - -p|--packages-list) - LIVE_PACKAGES_LIST="${2}"; shift 2 + -p|--packages-lists) + LIVE_PACKAGES_LISTS="${2}"; shift 2 ;; --tasks) @@ -181,6 +200,14 @@ Main () LIVE_ENCRYPTION="${2}"; shift 2 ;; + --username) + LIVE_USERNAME="${2}"; shift 2 + ;; + + --hostname) + LIVE_HOSTNAME="${2}"; shift 2 + ;; + --filesystem) LIVE_FILESYSTEM="${2}"; shift 2 ;; @@ -221,6 +248,10 @@ Main () LIVE_SOURCE_IMAGE="${2}"; shift 2 ;; + --includes) + LIVE_INCLUDES="${2}"; shift 2 + ;; + --templates) LIVE_TEMPLATES="${2}"; shift 2 ;; @@ -231,13 +262,17 @@ Main () ;; -u|--usage) - Usage 0; shift + Usage; shift ;; -v|--version) Version; shift ;; + --force) + FORCE="true"; shift + ;; + --) shift; break ;; @@ -248,17 +283,42 @@ Main () ;; esac done +} + +Main () +{ + Local_arguments "${@}" + + Set_defaults + + if [ -z "${ROOT}" ] + then + ROOT="${LIVE_ROOT}" + fi + + # Source existing configuration + Read_conffile "${ROOT}"/config/common + Read_conffile "${ROOT}"/config/bootstrap + Read_conffile "${ROOT}"/config/chroot + Read_conffile "${ROOT}"/config/image + + Local_arguments "${@}" # Initializing lh_testroot # Configuring (this is really shit!) - LH_APT="${LH_APT}" LH_APT_FTPPROXY="${LH_APT_FTPPROXY}" LH_APT_HTTPPROXY="${LH_APT_HTTPPROXY}" LH_APT_GENERIC="${LH_APT_GENERIC}" LH_APT_PDIFFS="${LH_APT_PDIFFS}" LH_APT_RECOMMENDS="${LH_APT_RECOMMENDS}" LH_BOOTSTRAP="${LH_BOOTSTRAP}" LH_CACHE="${LH_CACHE}" LH_DEBCONF_FRONTEND="${LH_DEBCONF_FRONTEND}" LH_DEBCONF_PRIORITY="${LH_DEBCONF_PRIORITY}" LH_GENISOIMAGE="${LH_GENISOIMAGE}" LIVE_ROOT="${LIVE_ROOT}" LIVE_ARCHITECTURE="${LIVE_ARCHITECTURE}" LIVE_DISTRIBUTION="${LIVE_DISTRIBUTION}" LIVE_DISTRIBUTION_CONFIG="${LIVE_DISTRIBUTION_CONFIG}" LIVE_FLAVOUR="${LIVE_FLAVOUR}" LIVE_MIRROR_LOCAL="${LIVE_MIRROR_LOCAL}" LIVE_MIRROR_LOCAL_SECURITY="${LIVE_MIRROR_LOCAL_SECURITY}" LIVE_MIRROR_GENERIC="${LIVE_MIRROR_GENERIC}" LIVE_MIRROR_GENERIC_SECURITY="${LIVE_MIRROR_GENERIC_SECURITY}" LIVE_SECTIONS="${LIVE_SECTIONS}" LIVE_KERNEL="${LIVE_KERNEL}" LIVE_KERNEL_PACKAGES="${LIVE_KERNEL_PACKAGES}" LIVE_LANGUAGE="${LIVE_LANGUAGE}" LIVE_PACKAGES="${LIVE_PACKAGES}" LIVE_PACKAGES_LIST="${LIVE_PACKAGES_LIST}" LIVE_TASKS="${LIVE_TASKS}" LIVE_SECURITY="${LIVE_SECURITY}" LIVE_SYMLINKS="${LIVE_SYMLINKS}" LIVE_SYSVINIT="${LIVE_SYSVINIT}" LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND}" LIVE_ENCRYPTION="${LIVE_ENCRYPTION}" LIVE_FILESYSTEM="${LIVE_FILESYSTEM}" LIVE_MEMTEST86="${LIVE_MEMTEST86}" LIVE_ISO_VOLUME="${LIVE_ISO_VOLUME}" LIVE_SERVER_ADDRESS="${LIVE_SERVER_ADDRESS}" LIVE_SERVER_PATH="${LIVE_SERVER_PATH}" LIVE_SOURCE="${LIVE_SOURCE}" LIVE_SYSLINUX="${LIVE_SYSLINUX}" LIVE_SYSLINUX_SPLASH="${LIVE_SYSLINUX_SPLASH}" LIVE_BINARY_IMAGE="${LIVE_BINARY_IMAGE}" LIVE_SOURCE_IMAGE="${LIVE_SOURCE_IMAGE}" LIVE_TEMPLATES="${LIVE_TEMPLATES}" lh_config newconfig + LH_APT="${LH_APT}" LH_APT_FTPPROXY="${LH_APT_FTPPROXY}" LH_APT_HTTPPROXY="${LH_APT_HTTPPROXY}" LH_APT_GENERIC="${LH_APT_GENERIC}" LH_APT_PDIFFS="${LH_APT_PDIFFS}" LH_APT_RECOMMENDS="${LH_APT_RECOMMENDS}" LH_APT_SECURE="${LH_APT_SECURE}" LH_BOOTSTRAP="${LH_BOOTSTRAP}" LH_CACHE="${LH_CACHE}" LH_DEBCONF_FRONTEND="${LH_DEBCONF_FRONTEND}" LH_DEBCONF_PRIORITY="${LH_DEBCONF_PRIORITY}" LH_GENISOIMAGE="${LH_GENISOIMAGE}" LIVE_ROOT="${LIVE_ROOT}" LIVE_ARCHITECTURE="${LIVE_ARCHITECTURE}" LIVE_DISTRIBUTION="${LIVE_DISTRIBUTION}" LIVE_DISTRIBUTION_CONFIG="${LIVE_DISTRIBUTION_CONFIG}" LIVE_BOOTSTRAP_FLAVOUR="${LIVE_BOOTSTRAP_FLAVOUR}" LIVE_MIRROR_BUILD="${LIVE_MIRROR_BUILD}" LIVE_MIRROR_BUILD_SECURITY="${LIVE_MIRROR_BUILD_SECURITY}" LIVE_MIRROR_IMAGE="${LIVE_MIRROR_IMAGE}" LIVE_MIRROR_IMAGE_SECURITY="${LIVE_MIRROR_IMAGE_SECURITY}" LIVE_SECTIONS="${LIVE_SECTIONS}" LIVE_INTERACTIVE="${LIVE_INTERACTIVE}" LIVE_KERNEL_FLAVOUR="${LIVE_KERNEL_FLAVOUR}" LIVE_KERNEL_PACKAGES="${LIVE_KERNEL_PACKAGES}" LIVE_LANGUAGE="${LIVE_LANGUAGE}" LIVE_PACKAGES="${LIVE_PACKAGES}" LIVE_PACKAGES_LISTS="${LIVE_PACKAGES_LISTS}" LIVE_TASKS="${LIVE_TASKS}" LIVE_SECURITY="${LIVE_SECURITY}" LIVE_SYMLINKS="${LIVE_SYMLINKS}" LIVE_SYSVINIT="${LIVE_SYSVINIT}" LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND}" LIVE_ENCRYPTION="${LIVE_ENCRYPTION}" LIVE_USERNAME="${LIVE_USERNAME}" LIVE_HOSTNAME="${LIVE_HOSTNAME}" LIVE_FILESYSTEM="${LIVE_FILESYSTEM}" LIVE_MEMTEST86="${LIVE_MEMTEST86}" LIVE_ISO_VOLUME="${LIVE_ISO_VOLUME}" LIVE_SERVER_ADDRESS="${LIVE_SERVER_ADDRESS}" LIVE_SERVER_PATH="${LIVE_SERVER_PATH}" LIVE_SOURCE="${LIVE_SOURCE}" LIVE_SYSLINUX="${LIVE_SYSLINUX}" LIVE_SYSLINUX_SPLASH="${LIVE_SYSLINUX_SPLASH}" LIVE_BINARY_IMAGE="${LIVE_BINARY_IMAGE}" LIVE_SOURCE_IMAGE="${LIVE_SOURCE_IMAGE}" LIVE_INCLUDES="${LIVE_INCLUDES}" LIVE_TEMPLATES="${LIVE_TEMPLATES}" lh_config newconfig + + if [ "${FORCE}" = "true" ] + then + OPTIONS="${OPTIONS} --force" + fi # Building if [ -z "${CONFIG}" ] then - cd "${LIVE_ROOT}" && lh_build + cd "${LIVE_ROOT}" && lh_build "${OPTIONS}" fi } |