diff options
author | Daniel Baumann <daniel@debian.org> | 2007-09-23 10:05:11 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2011-03-09 18:18:30 +0100 |
commit | 85c342c299231131d22764c0dfdcf977c57ce147 (patch) | |
tree | 1226c8a7ad43a2dd53e411c2e379969424e88e32 /helpers | |
parent | d1ee66e44c8272bb7a0053a456a3d8b0bd152268 (diff) | |
download | live-build-85c342c299231131d22764c0dfdcf977c57ce147.zip live-build-85c342c299231131d22764c0dfdcf977c57ce147.tar.gz |
Adding live-helper 1.0~a13-1.
Diffstat (limited to 'helpers')
60 files changed, 1057 insertions, 1049 deletions
diff --git a/helpers/lh_binary b/helpers/lh_binary index 45c405a..0ebb1d7 100755 --- a/helpers/lh_binary +++ b/helpers/lh_binary @@ -9,22 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="build binary images" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" -Breakpoint "binary: Init" - # Preparing root filesystem lh_binary_chroot ${*} diff --git a/helpers/lh_binary_chroot b/helpers/lh_binary_chroot index b92f94a..4c81a30 100755 --- a/helpers/lh_binary_chroot +++ b/helpers/lh_binary_chroot @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="copy chroot into chroot" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,8 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "binary_chroot: Init" +Echo_message "Begin copying chroot..." +Echo_message "This may take a while." # Requiring stage file Require_stagefile .stage/bootstrap @@ -62,7 +63,6 @@ ${LH_ROOT_COMMAND} rm -rf chroot/chroot ${LH_ROOT_COMMAND} rm -rf chroot.tmp # Copying new chroot -Echo_message "Copying chroot, this can take a while." ${LH_ROOT_COMMAND} cp -a chroot chroot.tmp ${LH_ROOT_COMMAND} mv chroot.tmp chroot/chroot diff --git a/helpers/lh_binary_debian-installer b/helpers/lh_binary_debian-installer index a14beda..99227c0 100755 --- a/helpers/lh_binary_debian-installer +++ b/helpers/lh_binary_debian-installer @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="install debian-installer into binary" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -37,7 +37,7 @@ then exit 0 fi -Breakpoint "binary_debian-installer: Init" +Echo_message "Begin installing debian-installer..." # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_binary_encryption b/helpers/lh_binary_encryption index f055a07..1a9265a 100755 --- a/helpers/lh_binary_encryption +++ b/helpers/lh_binary_encryption @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="encrypts rootfs" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -37,7 +37,7 @@ then exit 0 fi -Breakpoint "binary_encryption: Init" +Echo_message "Begin encrypting root filesystem image..." # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_binary_grub b/helpers/lh_binary_grub index c72b0f0..9300642 100755 --- a/helpers/lh_binary_grub +++ b/helpers/lh_binary_grub @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="installs grub into binary" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -37,7 +37,7 @@ then exit 0 fi -Breakpoint "binary_grub: Init" +Echo_message "Begin installing grub..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -125,10 +125,7 @@ then fi # Creating directory -if [ ! -d "${DESTDIR_LIVE}" ] -then - mkdir -p "${DESTDIR_LIVE}" -fi +mkdir -p "${DESTDIR_LIVE}" # Setting boot parameters if [ -n "${LIVE_ENCRYPTION}" ] diff --git a/helpers/lh_binary_hdd b/helpers/lh_binary_hdd index 8841d15..40762e8 100755 --- a/helpers/lh_binary_hdd +++ b/helpers/lh_binary_hdd @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="build harddisk binary image" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,34 +32,29 @@ Read_conffile config/binary Read_conffile config/source Set_defaults +if ! echo "${LIVE_BINARY_IMAGES}" | grep -qs hdd +then + exit 0 +fi -for IMAGE in ${LIVE_BINARY_IMAGES} -do - if [ "${IMAGE}" = "hdd" ] - then - Breakpoint "binary_hdd: Init" +Echo_message "Begin building binary harddisk image..." - # Requiring stage file - Require_stagefile .stage/bootstrap +# Requiring stage file +Require_stagefile .stage/bootstrap - # Checking stage file - Check_stagefile .stage/binary_hdd +# Checking stage file +Check_stagefile .stage/binary_hdd - # Checking lock file - Check_lockfile .lock +# Checking lock file +Check_lockfile .lock - # Creating lock file - Create_lockfile .lock +# Creating lock file +Create_lockfile .lock - # Remove old binary - if [ -f binary-hdd.tar.gz ] - then - rm -f binary-hdd.tar.gz - fi +# Remove old binary +rm -f binary-hdd.tar.gz - tar cfz binary-hdd.tar.gz binary +tar cfz binary-hdd.tar.gz binary - # Creating stage file - Create_stagefile .stage/binary_hdd - fi -done +# Creating stage file +Create_stagefile .stage/binary_hdd diff --git a/helpers/lh_binary_includes b/helpers/lh_binary_includes index 6a1f5b3..7979dfe 100755 --- a/helpers/lh_binary_includes +++ b/helpers/lh_binary_includes @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="copy files into binary" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -37,7 +37,7 @@ then exit 0 fi -Breakpoint "binary_includes: Init" +Echo_message "Begin copying binary includes..." # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_binary_iso b/helpers/lh_binary_iso index 0bea7e3..1b60024 100755 --- a/helpers/lh_binary_iso +++ b/helpers/lh_binary_iso @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="build iso binary image" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,109 +32,108 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -for IMAGE in ${LIVE_BINARY_IMAGES} -do - if [ "${IMAGE}" = "iso" ] - then - Breakpoint "binary_iso: Init" - - # Requiring stage file - Require_stagefile .stage/bootstrap - - # Checking stage file - Check_stagefile .stage/binary_iso - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Checking depends - Check_package chroot/usr/bin/"${LH_GENISOIMAGE}" ${LH_GENISOIMAGE} - - # Installing depends - Install_package - - # Remove old iso image - if [ -f binary.iso ] - then - rm -f binary.iso - fi - - if [ "${LH_VERBOSE}" = "enabled" ] - then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v" - fi - - if [ -n "${LIVE_ISO_APPLICATION}" ] && [ "${LIVE_ISO_APPLICATION}" != "none" ] - then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LIVE_ISO_APPLICATION}\"" - fi - - if [ -n "${LIVE_ISO_PREPARER}" ] && [ "${LIVE_ISO_PREPARER}" != "none" ] - then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LIVE_ISO_PREPARER}\"" - fi - - if [ -n "${LIVE_ISO_PUBLISHER}" ] && [ "${LIVE_ISO_PUBLISHER}" != "none" ] - then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LIVE_ISO_PUBLISHER}\"" - fi - - if [ -n "${LIVE_ISO_VOLUME}" ] && [ "${LIVE_ISO_VOLUME}" != "none" ] - then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LIVE_ISO_VOLUME}\"" - fi - - # Moving image - mv binary chroot - - # Create image - if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] - then - case "${LIVE_BOOTLOADER}" in - grub) - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -b boot/grub/stage2_eltorito" - - if [ "${LIVE_PACKAGES_LISTS}" = "mini" ] || [ "${LIVE_PACKAGES_LISTS}" = "minimal" ] - then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m boot/grub/stage2_eltorito" - fi - ;; - - syslinux) - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -b isolinux/isolinux.bin -c isolinux/boot.cat" - - if [ "${LIVE_PACKAGES_LISTS}" = "mini" ] || [ "${LIVE_PACKAGES_LISTS}" = "minimal" ] - then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m isolinux/isolinux.bin" - fi - ;; - - *) - Echo_warning "Bootloader on your architecture not yet supported (Continuing in 5 seconds)." - sleep 5 - ;; - esac - - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table" - fi +if ! echo "${LIVE_BINARY_IMAGES}" | grep -qs iso +then + exit 0 +fi + +Echo_message "Begin building binary iso image..." + +# Requiring stage file +Require_stagefile .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_iso + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Checking depends +Check_package chroot/usr/bin/"${LH_GENISOIMAGE}" ${LH_GENISOIMAGE} + +# Installing depends +Install_package + +# Remove old iso image +if [ -f binary.iso ] +then + rm -f binary.iso +fi + +if [ "${LH_VERBOSE}" = "enabled" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v" +fi + +if [ -n "${LIVE_ISO_APPLICATION}" ] && [ "${LIVE_ISO_APPLICATION}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LIVE_ISO_APPLICATION}\"" +fi + +if [ -n "${LIVE_ISO_PREPARER}" ] && [ "${LIVE_ISO_PREPARER}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LIVE_ISO_PREPARER}\"" +fi + +if [ -n "${LIVE_ISO_PUBLISHER}" ] && [ "${LIVE_ISO_PUBLISHER}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LIVE_ISO_PUBLISHER}\"" +fi + +if [ -n "${LIVE_ISO_VOLUME}" ] && [ "${LIVE_ISO_VOLUME}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LIVE_ISO_VOLUME}\"" +fi + +# Moving image +mv binary chroot + +# Create image +if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] +then + case "${LIVE_BOOTLOADER}" in + grub) + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -b boot/grub/stage2_eltorito" + + if [ "${LIVE_PACKAGES_LISTS}" = "mini" ] || [ "${LIVE_PACKAGES_LISTS}" = "minimal" ] + then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m boot/grub/stage2_eltorito" + fi + ;; + + syslinux) + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -b isolinux/isolinux.bin -c isolinux/boot.cat" + + if [ "${LIVE_PACKAGES_LISTS}" = "mini" ] || [ "${LIVE_PACKAGES_LISTS}" = "minimal" ] + then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m isolinux/isolinux.bin" + fi + ;; + + *) + Echo_warning "Bootloader on your architecture not yet supported (Continuing in 5 seconds)." + sleep 5 + ;; + esac + + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table" +fi cat >> chroot/binary.sh << EOF ${LH_GENISOIMAGE} ${GENISOIMAGE_OPTIONS} -o binary.iso -r -J -l -cache-inodes binary EOF - Chroot "sh binary.sh" +Chroot "sh binary.sh" - # Move image - mv chroot/binary chroot/binary.iso ./ - rm -f chroot/binary.sh +# Move image +mv chroot/binary chroot/binary.iso ./ +rm -f chroot/binary.sh - # Removing depends - Remove_package +# Removing depends +Remove_package - # Creating stage file - Create_stagefile .stage/binary_iso - fi -done +# Creating stage file +Create_stagefile .stage/binary_iso diff --git a/helpers/lh_binary_linux-image b/helpers/lh_binary_linux-image index b7349d9..474cf78 100755 --- a/helpers/lh_binary_linux-image +++ b/helpers/lh_binary_linux-image @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="install linux-image into binary" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "binary_linux-image: Init" +Echo_message "Begin install linux-image..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -98,10 +98,7 @@ then fi # Creating directory -if [ ! -d "${DESTDIR}" ] -then - mkdir -p "${DESTDIR}" -fi +mkdir -p "${DESTDIR}" # Installing linux-image cp chroot/boot/vmlinuz* "${DESTDIR}" diff --git a/helpers/lh_binary_local-includes b/helpers/lh_binary_local-includes index 8b6e5aa..862aea4 100755 --- a/helpers/lh_binary_local-includes +++ b/helpers/lh_binary_local-includes @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="copy files into binary" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "binary_local-includes: Init" +Echo_message "Begin copying binary local includes..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -46,7 +46,7 @@ Check_lockfile .lock # Creating lock file Create_lockfile .lock -if ls config/binary_local-includes/* &> /dev/null +if ls config/binary_local-includes/* > /dev/null 2>&1 then # Copying includes cd config/binary_local-includes diff --git a/helpers/lh_binary_manifest b/helpers/lh_binary_manifest index 87883c3..0016f19 100755 --- a/helpers/lh_binary_manifest +++ b/helpers/lh_binary_manifest @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="create manifest" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "binary_manifest: Init" +Echo_message "Begin creating manifest..." # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_binary_md5sum b/helpers/lh_binary_md5sum index e044406..861bce0 100755 --- a/helpers/lh_binary_md5sum +++ b/helpers/lh_binary_md5sum @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="create binary md5sums" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "binary_md5sum: Init" +Echo_message "Begin creating binary md5sum.txt..." # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_binary_memtest b/helpers/lh_binary_memtest index a96dbc5..85f93e2 100755 --- a/helpers/lh_binary_memtest +++ b/helpers/lh_binary_memtest @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="installs a memtest into binary" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -37,7 +37,7 @@ then exit 0 fi -Breakpoint "binary_memtest: Init" +Echo_message "Begin installing memtest..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -116,10 +116,7 @@ then fi # Creating directory -if [ ! -d "${DESTDIR}" ] -then - mkdir -p "${DESTDIR}" -fi +mkdir -p "${DESTDIR}" # Installing memtest case "${LIVE_MEMTEST}" in diff --git a/helpers/lh_binary_net b/helpers/lh_binary_net index 6ebe7ea..0347663 100755 --- a/helpers/lh_binary_net +++ b/helpers/lh_binary_net @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="build netboot binary image" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,51 +32,50 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "binary_net: Init" +if ! echo "${LIVE_BINARY_IMAGES}" | grep -qs net +then + exit 0 +fi -for IMAGE in ${LIVE_BINARY_IMAGES} -do - if [ "${IMAGE}" = "net" ] - then - # Requiring stage file - Require_stagefile .stage/bootstrap +Echo_message "Begin building binary netboot image..." - # Checking stage file - Check_stagefile .stage/binary_net +# Requiring stage file +Require_stagefile .stage/bootstrap - # Checking lock file - Check_lockfile .lock +# Checking stage file +Check_stagefile .stage/binary_net - # Creating lock file - Create_lockfile .lock +# Checking lock file +Check_lockfile .lock - # Remove old binary - if [ -f binary-net.tar.gz ] - then - rm -f binary-net.tar.gz - fi +# Creating lock file +Create_lockfile .lock - # Creating image file - if [ "`basename ${LIVE_NET_PATH}`" = "chroot" ] - then - mv chroot chroot.tmp - fi +# Remove old binary +if [ -f binary-net.tar.gz ] +then + rm -f binary-net.tar.gz +fi - mv binary "`basename ${LIVE_NET_PATH}`" +# Creating image file +if [ "`basename ${LIVE_NET_PATH}`" = "chroot" ] +then + mv chroot chroot.tmp +fi - cd .. - tar cfz binary-net.tar.gz "`basename ${OLDPWD}`/`basename ${LIVE_NET_PATH}`" "`basename ${OLDPWD}`/tftpboot" - mv binary-net.tar.gz "${OLDPWD}" - cd "${OLDPWD}" +mv binary "`basename ${LIVE_NET_PATH}`" - mv "`basename ${LIVE_NET_PATH}`" binary +cd .. +tar cfz binary-net.tar.gz "`basename ${OLDPWD}`/`basename ${LIVE_NET_PATH}`" "`basename ${OLDPWD}`/tftpboot" +mv binary-net.tar.gz "${OLDPWD}" +cd "${OLDPWD}" - if [ "`basename ${LIVE_NET_PATH}`" = "chroot" ] - then - mv chroot.tmp chroot - fi +mv "`basename ${LIVE_NET_PATH}`" binary - # Creating stage file - Create_stagefile .stage/binary_net - fi -done +if [ "`basename ${LIVE_NET_PATH}`" = "chroot" ] +then + mv chroot.tmp chroot +fi + +# Creating stage file +Create_stagefile .stage/binary_net diff --git a/helpers/lh_binary_rootfs b/helpers/lh_binary_rootfs index 47529a2..359151f 100755 --- a/helpers/lh_binary_rootfs +++ b/helpers/lh_binary_rootfs @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="build rootfs image" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "binary_rootfs: Init" +Echo_message "Begin building root filesystem image..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -58,10 +58,7 @@ case "${LH_INITRAMFS}" in esac # Creating directory -if [ ! -d binary/${INITFS} ] -then - mkdir -p binary/${INITFS} -fi +mkdir -p binary/${INITFS} case "${LIVE_CHROOT_FILESYSTEM}" in ext2) @@ -127,12 +124,18 @@ case "${LIVE_CHROOT_FILESYSTEM}" in MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -e chroot/boot/vmlinuz* chroot/boot/initrd.img* chroot/vmlinuz* chroot/initrd.img* chroot/boot/config-* chroot/boot/System.map-*" fi + if [ -f config/binary_rootfs/squashfs.sort ] + then + MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -sort squashfs.sort" + cp config/binary_rootfs/squashfs.sort chroot + fi + # Create image Chroot "mksquashfs chroot filesystem.squashfs ${MKSQUASHFS_OPTIONS}" # Move image ${LH_ROOT_COMMAND} mv chroot/filesystem.squashfs binary/${INITFS} - ${LH_ROOT_COMMAND} rm -rf chroot/chroot + ${LH_ROOT_COMMAND} rm -rf chroot/chroot chroot/squashfs.sort if [ -n "${LH_ROOT_COMMAND}" ] then diff --git a/helpers/lh_binary_syslinux b/helpers/lh_binary_syslinux index 124cb36..869bcc1 100755 --- a/helpers/lh_binary_syslinux +++ b/helpers/lh_binary_syslinux @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="installs syslinux into binary" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -37,7 +37,7 @@ then exit 0 fi -Breakpoint "binary_syslinux: Init" +Echo_message "Begin installing syslinux..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -137,10 +137,7 @@ then fi # Creating directory -if [ ! -d "${DESTDIR_LIVE}" ] -then - mkdir -p "${DESTDIR_LIVE}" -fi +mkdir -p "${DESTDIR_LIVE}" # Setting boot parameters if [ -n "${LIVE_ENCRYPTION}" ] @@ -174,7 +171,7 @@ then live-initramfs) if [ "${LIVE_HOSTNAME}" != "debian" ] then - LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} username=${LIVE_HOSTNAME}" + LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} hostname=${LIVE_HOSTNAME}" fi ;; esac diff --git a/helpers/lh_binary_usb-hdd b/helpers/lh_binary_usb-hdd index 5185a95..49f8e8e 100755 --- a/helpers/lh_binary_usb-hdd +++ b/helpers/lh_binary_usb-hdd @@ -1,6 +1,6 @@ #!/bin/sh -# lh_binary_usb-hdd(1) - build binary image +# lh_binary_usb-hdd(1) - build binary usb-hdd image # Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> # # live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="build binary image" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,127 +32,126 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "binary_usb-hdd: Init" - -for IMAGE in ${LIVE_BINARY_IMAGES} -do - if [ "${IMAGE}" = "usb-hdd" ] - then - # Requiring stage file - Require_stagefile .stage/bootstrap - Require_stagefile .stage/chroot_proc - - # Checking stage file - Check_stagefile .stage/binary_usb-hdd - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Checking depends - Check_package chroot/sbin/mkdosfs dosfstools - Check_package chroot/usr/sbin/mtools mtools - Check_package chroot/sbin/parted parted - - case "${LIVE_BOOTLOADER}" in - grub) - Check_package chroot/usr/sbin/grub grub - ;; - - syslinux) - Check_package chroot/usr/bin/syslinux syslinux - ;; - esac - - # Installing depends - Install_package - - # Remove old binary - if [ -f binary.img ] - then - rm -f binary.img - fi - - # Everything which comes here needs to be cleaned up, - DU_DIM="`du -ms binary | cut -f1`" - REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 50`" # Just 2% more to be sure, need something more sophistcated here... - dd if=/dev/zero of=binary.img bs=1024k count=${REAL_DIM} - FREELO="`${LH_LOSETUP} -f`" - if [ ! -b chroot/${FREELO} ] - then - MAKEDEV="true" - - mv chroot/dev chroot/dev.tmp - find /dev | cpio -dmpu chroot - fi - - echo "!!! The following error/warning messages can be ignored !!!" - lh_losetup $FREELO binary.img 0 - Chroot "parted -s ${FREELO} mklabel msdos" || true - Chroot "parted -s ${FREELO} mkpartfs primary fat16 0.0 100%" || true - Chroot "parted -s ${FREELO} set 1 boot on" || true - Chroot "parted -s ${FREELO} set 1 lba off" || true - - case "${LIVE_BOOTLOADER}" in - grub) - #echo "(hd0) ${FREELO}" > binary/boot/grub/device.map +if ! echo "${LIVE_BINARY_IMAGES}" | grep -qs usb-hdd +then + exit 0 +fi + +Echo_message "Begin building binary usb-hdd image..." + +# Requiring stage file +Require_stagefile .stage/bootstrap +Require_stagefile .stage/chroot_proc + +# Checking stage file +Check_stagefile .stage/binary_usb-hdd + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Checking depends +Check_package chroot/sbin/mkdosfs dosfstools +Check_package chroot/usr/sbin/mtools mtools +Check_package chroot/sbin/parted parted + +case "${LIVE_BOOTLOADER}" in + grub) + Check_package chroot/usr/sbin/grub grub + ;; + + syslinux) + Check_package chroot/usr/bin/syslinux syslinux + ;; +esac + +# Installing depends +Install_package + +# Remove old binary +if [ -f binary.img ] +then + rm -f binary.img +fi + +# Everything which comes here needs to be cleaned up, +DU_DIM="`du -ms binary | cut -f1`" +REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 50`" # Just 2% more to be sure, need something more sophistcated here... +dd if=/dev/zero of=binary.img bs=1024k count=${REAL_DIM} +FREELO="`${LH_LOSETUP} -f`" +if [ ! -b chroot/${FREELO} ] +then + MAKEDEV="true" + + mv chroot/dev chroot/dev.tmp + find /dev | cpio -dmpu chroot +fi + +echo "!!! The following error/warning messages can be ignored !!!" +lh_losetup $FREELO binary.img 0 +Chroot "parted -s ${FREELO} mklabel msdos" || true +Chroot "parted -s ${FREELO} mkpartfs primary fat16 0.0 100%" || true +Chroot "parted -s ${FREELO} set 1 boot on" || true +Chroot "parted -s ${FREELO} set 1 lba off" || true + +case "${LIVE_BOOTLOADER}" in + grub) + #echo "(hd0) ${FREELO}" > binary/boot/grub/device.map #grub --batch --no-floppy --device-map=binary/boot/grub/device.map << EOF #setup --stage1=binary/boot/grub/stage1 --stage2=binary/boot/grub/stage2 --prefix=/boot/grub (hd0) # #quit #EOF - #rm -f binary/boot/grub/device.map - - #Chroot "grub-install --no-floppy --root-directory=/ (hd0)" - ;; - - syslinux) - cat chroot/usr/lib/syslinux/mbr.bin > ${FREELO} - ;; - esac - - ${LH_LOSETUP} -d ${FREELO} - - FREELO="`${LH_LOSETUP} -f`" - lh_losetup $FREELO binary.img 1 - Chroot " mkfs.vfat -F 16 -n DEBIAN_LIVE ${FREELO}" - mkdir -p binary.tmp - ${LH_ROOT_COMMAND} mount ${FREELO} binary.tmp - cp -r binary/* binary.tmp - ${LH_ROOT_COMMAND} umount binary.tmp - rmdir binary.tmp - - if [ "${LIVE_BOOTLOADER}" = "syslinux" ] - then - Chroot "syslinux ${FREELO}" - fi - - ${LH_LOSETUP} -d ${FREELO} - - #if [ "${LIVE_BOOTLOADER}" = "grub" ] - #then - # FREELO="`${LH_LOSETUP} -f`" - # lh_losetup $FREELO binary.img 0 - - # dd if=binary/boot/grub/stage1 of=${FREELO} bs=512 count=1 - # dd if=binary/boot/grub/stage2 of=${FREELO} bs=512 seek=1 - - # ${LH_LOSETUP} -d ${FREELO} - #fi - echo "!!! The above error/warning messages can be ignored !!!" - - if [ -n "${MAKEDEV}" ] - then - rm -f chroot/dev - mv chroot/dev.tmp chroot/dev - fi - - # Removing depends - Remove_package - - # Creating stage file - Create_stagefile .stage/binary_usb-hdd - fi -done + #rm -f binary/boot/grub/device.map + + #Chroot "grub-install --no-floppy --root-directory=/ (hd0)" + ;; + + syslinux) + cat chroot/usr/lib/syslinux/mbr.bin > ${FREELO} + ;; +esac + +${LH_LOSETUP} -d ${FREELO} + +FREELO="`${LH_LOSETUP} -f`" +lh_losetup $FREELO binary.img 1 +Chroot " mkfs.vfat -F 16 -n DEBIAN_LIVE ${FREELO}" +mkdir -p binary.tmp +${LH_ROOT_COMMAND} mount ${FREELO} binary.tmp +cp -r binary/* binary.tmp +${LH_ROOT_COMMAND} umount binary.tmp +rmdir binary.tmp + +if [ "${LIVE_BOOTLOADER}" = "syslinux" ] +then + Chroot "syslinux ${FREELO}" +fi + +${LH_LOSETUP} -d ${FREELO} + +#if [ "${LIVE_BOOTLOADER}" = "grub" ] +#then +# FREELO="`${LH_LOSETUP} -f`" +# lh_losetup $FREELO binary.img 0 + +# dd if=binary/boot/grub/stage1 of=${FREELO} bs=512 count=1 +# dd if=binary/boot/grub/stage2 of=${FREELO} bs=512 seek=1 + +# ${LH_LOSETUP} -d ${FREELO} +#fi +echo "!!! The above error/warning messages can be ignored !!!" + +if [ -n "${MAKEDEV}" ] +then + rm -f chroot/dev + mv chroot/dev.tmp chroot/dev +fi + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/binary_usb-hdd diff --git a/helpers/lh_binary_yaboot b/helpers/lh_binary_yaboot index 23187f3..0b0becf 100755 --- a/helpers/lh_binary_yaboot +++ b/helpers/lh_binary_yaboot @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="installs yaboot into binary" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -37,7 +37,7 @@ then exit 0 fi -Breakpoint "binary_yaboot: Init" +Echo_message "Begin installing yaboot..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -113,10 +113,7 @@ then fi # Creating directory -if [ ! -d "${DESTDIR}" ] -then - mkdir -p "${DESTDIR}" -fi +mkdir -p "${DESTDIR}" # Setting boot parameters if [ -n "${LIVE_ENCRYPTION}" ] diff --git a/helpers/lh_bootstrap b/helpers/lh_bootstrap index 36a7a0a..fbb8f17 100755 --- a/helpers/lh_bootstrap +++ b/helpers/lh_bootstrap @@ -9,26 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="bootstrap a Debian system" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - -# Starting helper -Echo_debug "Init ${PROGRAM}" - -Breakpoint "bootstrap: Init" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap diff --git a/helpers/lh_bootstrap_cdebootstrap b/helpers/lh_bootstrap_cdebootstrap index dad8948..2eaa23f 100755 --- a/helpers/lh_bootstrap_cdebootstrap +++ b/helpers/lh_bootstrap_cdebootstrap @@ -9,24 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting 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 - -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -35,13 +32,16 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "bootstrap_cdeboostrap: Init" - if [ "${LH_BOOTSTRAP}" != "cdebootstrap" ] then exit 0 fi +Echo_message "Begin bootstrapping system..." + +# Ensure that a system is built as root +lh_testroot + # Checking stage file Check_stagefile .stage/bootstrap @@ -52,10 +52,7 @@ Check_lockfile .lock Create_lockfile .lock # Creating chroot directory -if [ ! -d chroot ] -then - mkdir -p chroot -fi +mkdir -p chroot # Setting cdebootstrap options if [ -n "${LIVE_ARCHITECTURE}" ] @@ -68,6 +65,11 @@ then CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --suite-config=${LIVE_BOOTSTRAP_CONFIG}" fi +if [ -n "${LIVE_BOOTSTRAP_KEYRING}" ] +then + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --keyring=${LIVE_BOOTSTRAP_KEYRING}" +fi + if [ "${LIVE_PACKAGES_LISTS}" != "minimal" ] && [ "${LIVE_PACKAGES_LISTS}" != "mini" ] then CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=standard" @@ -134,10 +136,7 @@ then fi # Saving new cache - if [ ! -d cache/packages_bootstrap ] - then - mkdir -p cache/packages_bootstrap - fi + mkdir -p cache/packages_bootstrap cp chroot/var/cache/bootstrap/*.deb cache/packages_bootstrap fi @@ -174,10 +173,7 @@ then rm -rf cache/stages_bootstrap fi - if [ ! -d cache ] - then - mkdir cache - fi + mkdir -p cache ${LH_ROOT_COMMAND} cp -a chroot cache/stages_bootstrap diff --git a/helpers/lh_bootstrap_debootstrap b/helpers/lh_bootstrap_debootstrap index c3e4cad..58d36c4 100755 --- a/helpers/lh_bootstrap_debootstrap +++ b/helpers/lh_bootstrap_debootstrap @@ -9,24 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting 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 - -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -35,13 +32,16 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "bootstrap_debootstrap: Init" - if [ "${LH_BOOTSTRAP}" != "debootstrap" ] then exit 0 fi +Echo_message "Begin bootstrapping system..." + +# Ensure that a system is built as root +lh_testroot + # Checking stage file Check_stagefile .stage/bootstrap @@ -52,10 +52,7 @@ Check_lockfile .lock Create_lockfile .lock # Creating chroot directory -if [ ! -d chroot ] -then - mkdir -p chroot -fi +mkdir -p chroot # Setting debootstrap options if [ -n "${LIVE_ARCHITECTURE}" ] @@ -117,10 +114,7 @@ then fi # Saving new cache - if [ ! -d cache/packages_bootstrap ] - then - mkdir -p cache/packages_bootstrap - fi + mkdir -p cache/packages_bootstrap cp chroot/var/cache/apt/archives/*.deb cache/packages_bootstrap fi @@ -146,10 +140,7 @@ then rm -rf cache/stages_bootstrap fi - if [ ! -d cache ] - then - mkdir cache - fi + mkdir -p cache ${LH_ROOT_COMMAND} cp -a chroot cache/stages_bootstrap diff --git a/helpers/lh_build b/helpers/lh_build index e2cef4c..3e8e782 100755 --- a/helpers/lh_build +++ b/helpers/lh_build @@ -9,30 +9,29 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="build a Debian Live system" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" -Breakpoint "build: Init" - # Bootstrapping system lh_bootstrap ${*} # Customizing chroot lh_chroot ${*} -# Building binary image +# Building binary images lh_binary ${*} -# Building source image +# Building source images lh_source ${*} diff --git a/helpers/lh_chroot b/helpers/lh_chroot index 7c0015e..b12521f 100755 --- a/helpers/lh_chroot +++ b/helpers/lh_chroot @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="customize the Debian system" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,8 +32,6 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot: Init" - # Configuring chroot lh_chroot_proc install ${*} lh_chroot_sysfs install ${*} @@ -46,6 +44,7 @@ lh_chroot_sources install ${*} lh_chroot_linux-image install ${*} # Customizing chroot +lh_chroot_preseed ${*} lh_chroot_tasks ${*} lh_chroot_packageslists ${*} lh_chroot_packages ${*} diff --git a/helpers/lh_chroot_apt b/helpers/lh_chroot_apt index 97d7087..cafabd3 100755 --- a/helpers/lh_chroot_apt +++ b/helpers/lh_chroot_apt @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="manage /etc/apt/apt.conf" HELP="" USAGE="${PROGRAM} {install|remove} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_apt: Init" +Echo_message "Configuring file /etc/apt/apt.conf" # Requiring stage file Require_stagefile .stage/bootstrap @@ -48,10 +48,7 @@ case "${1}" in # Creating lock file Create_lockfile .lock - if [ ! -d chroot/etc/apt/apt.conf.d ] - then - mkdir -p chroot/etc/apt/apt.conf.d - fi + mkdir -p chroot/etc/apt/apt.conf.d # Configuring apt ftp proxy if [ -n "${LH_APT_FTPPROXY}" ] @@ -76,6 +73,12 @@ case "${1}" in ;; esac + # Configuring apt pipeline + if [ -n "${LH_APT_PIPELINE}" ] + then + echo "Acquire::http::Pipeline-Depth \"${LH_APT_PIPELINE}\";" > chroot/etc/apt/apt.conf.d/00pipeline + fi + # Configuring apt recommends if [ "${LH_APT}" = "aptitude" ] then @@ -123,6 +126,9 @@ case "${1}" in # Deconfiguring aptitude pdiffs rm -f chroot/etc/apt/apt.conf.d/00pdiffs + # Deconfiguring aptitude pipeline + rm -f chroot/etc/apt/apt.conf.d/00pipeline + # Deconfiguring aptitude recommends rm -f chroot/etc/apt/apt.conf.d/00recommends diff --git a/helpers/lh_chroot_debianchroot b/helpers/lh_chroot_debianchroot index 3c65f53..4410227 100755 --- a/helpers/lh_chroot_debianchroot +++ b/helpers/lh_chroot_debianchroot @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="manage /etc/debian_chroot" HELP="" USAGE="${PROGRAM} {install|remove} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_debianchroot: Init" +Echo_message "Configuring file /etc/debian_chroot" # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_chroot_hacks b/helpers/lh_chroot_hacks index 1c828dc..5a5e650 100755 --- a/helpers/lh_chroot_hacks +++ b/helpers/lh_chroot_hacks @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="execute hacks in chroot" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_hacks: Init" +Echo_message "Begin executing hacks..." # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_chroot_hooks b/helpers/lh_chroot_hooks index 8f5c988..caa4fd3 100755 --- a/helpers/lh_chroot_hooks +++ b/helpers/lh_chroot_hooks @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="execute hooks in chroot" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_hooks: Init" +Echo_message "Begin executing hooks..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -49,10 +49,10 @@ Create_lockfile .lock # Processing hooks for HOOK in ${LIVE_PACKAGES_LISTS} ${LIVE_TASKS} do - if [ -f /usr/share/live-helper/hooks/"${HOOK}" ] + if [ -f ${LH_BASE:-/usr/share/live-helper}/hooks/"${HOOK}" ] then # Copying hook - cp /usr/share/live-helper/hooks/"${HOOK}" chroot/root + cp ${LH_BASE:-/usr/share/live-helper}/hooks/"${HOOK}" chroot/root # Making hook executable if [ ! -x chroot/root/"${HOOK}" ] diff --git a/helpers/lh_chroot_hosts b/helpers/lh_chroot_hosts index 3a7dec9..09ae098 100755 --- a/helpers/lh_chroot_hosts +++ b/helpers/lh_chroot_hosts @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="manage /etc/hosts" HELP="" USAGE="${PROGRAM} {install|remove} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_hosts: Init" +Echo_message "Configuring file /etc/hosts" # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_chroot_interactive b/helpers/lh_chroot_interactive index e8c5773..2a9417e 100755 --- a/helpers/lh_chroot_interactive +++ b/helpers/lh_chroot_interactive @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="make build interactive" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,13 +32,13 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_interactive: Init" - if [ "${LIVE_INTERACTIVE}" = "disabled" ] then exit 0 fi +Echo_message "Begin interactive build..." + # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_chroot_linux-image b/helpers/lh_chroot_linux-image index 660ae40..218f248 100755 --- a/helpers/lh_chroot_linux-image +++ b/helpers/lh_chroot_linux-image @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="manage /etc/kernel-img.conf" HELP="" USAGE="${PROGRAM} {install|remove} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_linux-image: Init" +Echo_message "Configuring file /etc/kernel-img.conf" # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_chroot_local-hooks b/helpers/lh_chroot_local-hooks index 953a1f1..75702db 100755 --- a/helpers/lh_chroot_local-hooks +++ b/helpers/lh_chroot_local-hooks @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="execute local hooks in chroot" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_local-hooks: Init" +Echo_message "Begin executing local hooks..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -47,7 +47,7 @@ Check_lockfile .lock Create_lockfile .lock # Processing local-hooks -if ls config/chroot_local-hooks/* &> /dev/null +if ls config/chroot_local-hooks/* > /dev/null 2>&1 then for HOOK in config/chroot_local-hooks/* do diff --git a/helpers/lh_chroot_local-includes b/helpers/lh_chroot_local-includes index 0d94703..329c566 100755 --- a/helpers/lh_chroot_local-includes +++ b/helpers/lh_chroot_local-includes @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="copy local files into chroot" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_local-includes: Init" +Echo_message "Begin copying chroot local includes..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -46,7 +46,7 @@ Check_lockfile .lock # Creating lock file Create_lockfile .lock -if ls config/chroot_local-includes/* &> /dev/null +if ls config/chroot_local-includes/* > /dev/null 2>&1 then # Copying includes cd config/chroot_local-includes diff --git a/helpers/lh_chroot_local-packages b/helpers/lh_chroot_local-packages index 07c9eb2..fd42695 100755 --- a/helpers/lh_chroot_local-packages +++ b/helpers/lh_chroot_local-packages @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="install local packages into chroot" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_local-packages: Init" +Echo_message "Begin installing local packages..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -46,7 +46,7 @@ Check_lockfile .lock # Creating lock file Create_lockfile .lock -if ls config/chroot_local-packages/*.deb &> /dev/null +if ls config/chroot_local-packages/*.deb > /dev/null 2>&1 then # Restoring cache Restore_cache cache/packages_local-packages diff --git a/helpers/lh_chroot_local-packageslists b/helpers/lh_chroot_local-packageslists index f358fca..ed914ab 100755 --- a/helpers/lh_chroot_local-packageslists +++ b/helpers/lh_chroot_local-packageslists @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="install local packages into chroot" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_local-packageslists: Init" +Echo_message "Begin installing local packages lists..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -46,7 +46,7 @@ Check_lockfile .lock # Creating lock file Create_lockfile .lock -if ls config/chroot_local-packageslists/* &> /dev/null +if ls config/chroot_local-packageslists/* > /dev/null 2>&1 then # Restoring cache Restore_cache cache/packages_local-packageslists diff --git a/helpers/lh_chroot_localization b/helpers/lh_chroot_localization index 914be81..1741b58 100755 --- a/helpers/lh_chroot_localization +++ b/helpers/lh_chroot_localization @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="install localization packages into chroot" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_localization: Init" +Echo_message "Begin installing localization packages..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -601,35 +601,12 @@ then esac # Setting languages - if [ -z "${ICEAPE}" ] - then - ICEAPE="${LIVE_LANGUAGE}" - fi - - if [ -z "${ICEDOCE}" ] - then - ICEDOVE="${LIVE_LANGUAGE}" - fi - - if [ -z "${ICEWEASEL}" ] - then - ICEWEASEL="${LIVE_LANGUAGE}" - fi - - if [ -z "${KDE}" ] - then - KDE="${LIVE_LANGUAGE}" - fi - - if [ -z "${KOFFICE}" ] - then - KOFFICE="${LIVE_LANGUAGE}" - fi - - if [ -z "${OPENOFFICE}" ] - then - OPENOFFICE="${LIVE_LANGUAGE}" - fi + ICEAPE="${ICEAPE:-$LIVE_LANGUAGE}" + ICEDOVE="${ICEDOVE:-$LIVE_LANGUAGE}" + ICEWEASEL="${ICEWEASEL:-$LIVE_LANGUAGE}" + KDE="${KDE:-$LIVE_LANGUAGE}" + KOFFICE="${KOFFICE:-$LIVE_LANGUAGE}" + OPENOFFICE="${OPENOFFICE:-$LIVE_LANGUAGE}" # Setting packages for LOCALIZATION in ${LOCALIZATIONS} diff --git a/helpers/lh_chroot_packages b/helpers/lh_chroot_packages index e94cdda..bfc427c 100755 --- a/helpers/lh_chroot_packages +++ b/helpers/lh_chroot_packages @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="install packages into chroot" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_packages: Init" +Echo_message "Begin installing packages..." # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_chroot_packageslists b/helpers/lh_chroot_packageslists index d1d9a13..3735d6b 100755 --- a/helpers/lh_chroot_packageslists +++ b/helpers/lh_chroot_packageslists @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="install packages lists into chroot" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_packageslists: Init" +Echo_message "Begin installing packages lists..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -53,10 +53,10 @@ then for LIST in ${LIVE_PACKAGES_LISTS} do - if [ -f /usr/share/live-helper/lists/"${LIST}" ] + if [ -f ${LH_BASE:-/usr/share/live-helper}/lists/"${LIST}" ] then # Copying package list - grep -v "^#" /usr/share/live-helper/lists/"${LIST}" > chroot/root/"${LIST}" + grep -v "^#" ${LH_BASE:-/usr/share/live-helper}/lists/"${LIST}" > chroot/root/"${LIST}" # Installing package list case "${LH_APT}" in diff --git a/helpers/lh_chroot_preseed b/helpers/lh_chroot_preseed new file mode 100755 index 0000000..88f9dd3 --- /dev/null +++ b/helpers/lh_chroot_preseed @@ -0,0 +1,76 @@ +#!/bin/sh + +# lh_chroot_preseed(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 + +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh +do + . "${FUNCTION}" +done + +# Setting static variables +DESCRIPTION="execute preseed in chroot" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffile config/common +Read_conffile config/bootstrap +Read_conffile config/chroot +Read_conffile config/binary +Read_conffile config/source +Set_defaults + +Echo_message "Begin executing preseed..." + +# Requiring stage file +Require_stagefile .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_preseed + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ -n "${LIVE_PRESEED}" ] +then + if [ -f "${LIVE_PRESEED}" ] + then + # Check dependency + Check_package chroot/usr/bin/debconf-set-selections debconf + + # Install dependency + Install_package + + # Copying preseed + cp "${LIVE_PRESEED}" chroot/root/preseed + + Chroot "debconf-set-selections /root/preseed" + + # Removing preseed file + rm -f chroot/root/preseed + + # Remove dependency + Remove_package + + # Creating stage file + Create_stagefile .stage/chroot_preseed + fi +else + Echo_error "'${LIVE_PRESEED}' file doesn't exists." + exit 1 +fi diff --git a/helpers/lh_chroot_proc b/helpers/lh_chroot_proc index 563dbb4..66b4c3c 100755 --- a/helpers/lh_chroot_proc +++ b/helpers/lh_chroot_proc @@ -9,13 +9,15 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="mount /proc" HELP="" USAGE="${PROGRAM} {install|remove} [--force]" @@ -25,8 +27,6 @@ Arguments "${@}" # Ensure that a system is built as root lh_testroot -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -35,7 +35,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_proc: Init" +Echo_message "Begin mounting /proc..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -51,11 +51,8 @@ case "${1}" in # Creating lock file Create_lockfile .lock - if [ ! -d chroot/proc ] - then - # Creating mountpoint - mkdir -p chroot/proc - fi + # Creating mountpoint + mkdir -p chroot/proc # Mounting /proc ${LH_ROOT_COMMAND} mount proc-live -t proc chroot/proc diff --git a/helpers/lh_chroot_resolv b/helpers/lh_chroot_resolv index 8197b8a..031bdc2 100755 --- a/helpers/lh_chroot_resolv +++ b/helpers/lh_chroot_resolv @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="manage /etc/resolv.conf" HELP="" USAGE="${PROGRAM} {install|remove} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_resolv: Init" +Echo_message "Configuring file /etc/resolv.conf" # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_chroot_sources b/helpers/lh_chroot_sources index bdbe856..341f2d6 100755 --- a/helpers/lh_chroot_sources +++ b/helpers/lh_chroot_sources @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="manage /etc/apt/sources.list" HELP="" USAGE="${PROGRAM} {install|remove} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_sources: Init" +Echo_message "Configuring file /etc/apt/sources.list" # Requiring stage file Require_stagefile .stage/bootstrap @@ -83,7 +83,7 @@ case "${1}" in fi # Check local sources.list - if ls config/chroot_sources/*.bootstrap &> /dev/null + if ls config/chroot_sources/*.bootstrap > /dev/null 2>&1 then echo "" >> chroot/etc/apt/sources.list echo "# Custom repositories" >> chroot/etc/apt/sources.list @@ -97,12 +97,12 @@ case "${1}" in # Update indices from cache if [ "${LH_CACHE_INDICES}" = "enabled" ] && [ -d cache/indices_bootstrap ] then - if ls cache/indices_bootstrap/secring.gpg* &> /dev/null + if ls cache/indices_bootstrap/secring.gpg* > /dev/null 2>&1 then cp -f cache/indices_bootstrap/secring.gpg* chroot/etc/apt fi - if ls cache/indices_bootstrap/trusted.gpg* &> /dev/null + if ls cache/indices_bootstrap/trusted.gpg* > /dev/null 2>&1 then cp -f cache/indices_bootstrap/trusted.gpg* chroot/etc/apt fi @@ -117,17 +117,17 @@ case "${1}" in cp -f cache/indices_bootstrap/srcpkgcache.bin chroot/var/cache/apt fi - if ls cache/indices_bootstrap/*_Packages &> /dev/null + if ls cache/indices_bootstrap/*_Packages > /dev/null 2>&1 then cp -f cache/indices_bootstrap/*_Packages chroot/var/lib/apt/lists fi - if ls cache/indices_bootstrap/*_Sources &> /dev/null + if ls cache/indices_bootstrap/*_Sources > /dev/null 2>&1 then cp -f cache/indices_bootstrap/*_Sources chroot/var/lib/apt/lists fi - if ls cache/indices_bootstrap/*_Release* &> /dev/null + if ls cache/indices_bootstrap/*_Release* > /dev/null 2>&1 then cp -f cache/indices_bootstrap/*_Release* chroot/var/lib/apt/lists fi @@ -138,7 +138,7 @@ case "${1}" in fi else # Get fresh indices # Check local gpg keys - if ls config/chroot_sources/*.bootstrap.gpg &> /dev/null + if ls config/chroot_sources/*.bootstrap.gpg > /dev/null 2>&1 then for FILE in config/chroot_sources/*.bootstrap.gpg do @@ -149,7 +149,7 @@ case "${1}" in fi # Check local keyring packages - if ls config/chroot_sources/*.deb &> /dev/null + if ls config/chroot_sources/*.deb > /dev/null 2>&1 then for PACKAGE in config/chroot_sources/*.deb do @@ -183,10 +183,7 @@ case "${1}" in if [ "${LH_CACHE_INDICES}" = "enabled" ] then - if [ ! -d cache/indices_bootstrap ] - then - mkdir -p cache/indices_bootstrap - fi + mkdir -p cache/indices_bootstrap cp -f chroot/etc/apt/secring.gpg* cache/indices_bootstrap cp -f chroot/etc/apt/trusted.gpg* cache/indices_bootstrap @@ -259,7 +256,7 @@ case "${1}" in fi # Check local sources.list - if ls config/chroot_sources/*.binary &> /dev/null + if ls config/chroot_sources/*.binary > /dev/null 2>&1 then echo "" >> chroot/etc/apt/sources.list echo "# Custom repositories" >> chroot/etc/apt/sources.list @@ -271,7 +268,7 @@ case "${1}" in fi # Check local gpg keys - if ls config/chroot_sources/*.binary.gpg &> /dev/null + if ls config/chroot_sources/*.binary.gpg > /dev/null 2>&1 then for FILE in config/chroot_sources/*.binary.gpg do diff --git a/helpers/lh_chroot_symlinks b/helpers/lh_chroot_symlinks index 2f89d41..a7ceefe 100755 --- a/helpers/lh_chroot_symlinks +++ b/helpers/lh_chroot_symlinks @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="convert symlinks" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,12 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_symlinks: Init" +if [ "${LIVE_SYMLINKS}" != "enabled" ] +then + exit 0 +fi + +Echo_message "Begin converting symlinks..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -46,20 +51,17 @@ Check_lockfile .lock # Creating lock file Create_lockfile .lock -if [ "${LIVE_SYMLINKS}" = "enabled" ] -then - # Checking depends - Check_package chroot/usr/bin/symlinks symlinks +# Checking depends +Check_package chroot/usr/bin/symlinks symlinks - # Installing depends - Install_package +# Installing depends +Install_package - # Converting symlinks - Chroot "symlinks -c -r -s /" +# Converting symlinks +Chroot "symlinks -c -r -s /" - # Removing depends - Remove_package +# Removing depends +Remove_package - # Creating stage file - Create_stagefile .stage/chroot_symlinks -fi +# Creating stage file +Create_stagefile .stage/chroot_symlinks diff --git a/helpers/lh_chroot_sysfs b/helpers/lh_chroot_sysfs index 244369c..996262d 100755 --- a/helpers/lh_chroot_sysfs +++ b/helpers/lh_chroot_sysfs @@ -9,13 +9,15 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="mount /sys" HELP="" USAGE="${PROGRAM} {install|remove} [--force]" @@ -25,8 +27,6 @@ Arguments "${@}" # Ensure that a system is built as root lh_testroot -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -35,7 +35,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_sysfs: Init" +Echo_message "Begin mounting /sys..." # Requiring stage file Require_stagefile .stage/bootstrap @@ -51,11 +51,8 @@ case "${1}" in # Creating lock file Create_lockfile .lock - if [ ! -d chroot/sys ] - then - # Create mountpoint - mkdir -p chroot/sys - fi + # Create mountpoint + mkdir -p chroot/sys # Mounting /sys ${LH_ROOT_COMMAND} mount sysfs-live -t sysfs chroot/sys diff --git a/helpers/lh_chroot_sysvinit b/helpers/lh_chroot_sysvinit index 16f40f1..ca45aff 100755 --- a/helpers/lh_chroot_sysvinit +++ b/helpers/lh_chroot_sysvinit @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="configure sysvinit" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_sysvinit: Init" +Echo_message "Configuring package sysvinit" # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_chroot_sysvrc b/helpers/lh_chroot_sysvrc index 1729f46..a2b2230 100755 --- a/helpers/lh_chroot_sysvrc +++ b/helpers/lh_chroot_sysvrc @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="manage /usr/sbin/policy-rc.d" HELP="" USAGE="${PROGRAM} {install|remove} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_sysvrc: Init" +Echo_message "Configuring file /usr/sbin/policy-rc.d" # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_chroot_tasks b/helpers/lh_chroot_tasks index 9b6da5b..704f3d4 100755 --- a/helpers/lh_chroot_tasks +++ b/helpers/lh_chroot_tasks @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="install tasks into chroot" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,7 +32,7 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "chroot_tasks: Init" +Echo_message "Begin installing tasks..." # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_clean b/helpers/lh_clean index f016e95..84c60b8 100755 --- a/helpers/lh_clean +++ b/helpers/lh_clean @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="clean up system build directories" HELP="" USAGE="${PROGRAM} [all|cache|chroot|binary|lock|purge|stage|source]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap diff --git a/helpers/lh_config b/helpers/lh_config index 7020536..b911207 100755 --- a/helpers/lh_config +++ b/helpers/lh_config @@ -9,13 +9,15 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="create configuration for live-helper(7)" HELP="" USAGE="${PROGRAM} [--force]" @@ -24,19 +26,17 @@ Arguments "${@}" CONFIG="${1}" -Echo_debug "Init ${PROGRAM}" - if [ -n "${LH_CONFIG}" ] then - if [ -d /usr/share/live-helper/configs/"${LH_CONFIG}" ] + if [ -d ${LH_BASE:-/usr/share/live-helper}/configs/"${LH_CONFIG}" ] then mkdir "${LH_CONFIG}" - cp -r /usr/share/live-helper/configs/"${LH_CONFIG}" "${LH_CONFIG}"/config + cp -r ${LH_BASE:-/usr/share/live-helper}/configs/"${LH_CONFIG}" "${LH_CONFIG}"/config LIVE_ROOT="${LH_CONFIG}" CONFIG="" else - Echo_error "Couldn't find config ${LH_CONFIG} in /usr/share/live-helper/configs/." + Echo_error "Couldn't find config ${LH_CONFIG} in ${LH_BASE:-/usr/share/live-helper}/configs/." fi fi @@ -53,8 +53,6 @@ fi # Setting defaults Set_defaults -Breakpoint "config: Init" - # Creating bootstrap configuration mkdir -p "${LIVE_ROOT}"/config mkdir -p "${LIVE_ROOT}"/config/includes @@ -80,6 +78,10 @@ LH_APT_HTTPPROXY="${LH_APT_HTTPPROXY}" # (Default: ${LH_APT_PDIFFS}) LH_APT_PDIFFS="${LH_APT_PDIFFS}" +# \$LH_APT_PIPELINE: set apt/aptitude pipeline depth +# (Default: ${LH_APT_PIPELINE}) +LH_APT_PIPELINE="${LH_APT_PIPELINE}" + # \$LH_APT_RECOMMENDS: set apt/aptitude recommends # (Default: ${LH_APT_RECOMMENDS}) LH_APT_RECOMMENDS="${LH_APT_RECOMMENDS}" @@ -183,18 +185,22 @@ cat > "${LIVE_ROOT}"/config/bootstrap << EOF # (Default: autodetected) LIVE_ARCHITECTURE="${LIVE_ARCHITECTURE}" -# \$LIVE_DISTRIBUTION: select distribution to use -# (Default: ${LIVE_DISTRIBUTION}) -LIVE_DISTRIBUTION="${LIVE_DISTRIBUTION}" - -# \$LIVE_DISTRIBUTION_CONFIG: set distribution config directory +# \$LIVE_BOOTSTRAP_CONFIG: set distribution config directory # (Default: empty) -LIVE_DISTRIBUTION_CONFIG="${LIVE_DISTRIBUTION_CONFIG}" +LIVE_BOOTSTRAP_CONFIG="${LIVE_BOOTSTRAP_CONFIG}" # \$LIVE_BOOTSTRAP_FLAVOUR: select flavour to use # (Default: ${LIVE_BOOTSTRAP_FLAVOUR}) LIVE_BOOTSTRAP_FLAVOUR="${LIVE_BOOTSTRAP_FLAVOUR}" +# \$LIVE_BOOTSTRAP_KEYRING: set distribution keyring +# (Default: empty) +LIVE_BOOTSTRAP_KEYRING="${LIVE_BOOTSTRAP_KEYRING}" + +# \$LIVE_DISTRIBUTION: select distribution to use +# (Default: ${LIVE_DISTRIBUTION}) +LIVE_DISTRIBUTION="${LIVE_DISTRIBUTION}" + # \$LIVE_MIRROR_BOOTSTRAP: set mirror to fetch packages from # (Default: ${LIVE_MIRROR_BOOTSTRAP}) LIVE_MIRROR_BOOTSTRAP="${LIVE_MIRROR_BOOTSTRAP}" @@ -282,6 +288,7 @@ EOF # Creating lh_binary_* configuration mkdir -p "${LIVE_ROOT}"/config/binary_grub mkdir -p "${LIVE_ROOT}"/config/binary_local-includes +mkdir -p "${LIVE_ROOT}"/config/binary_rootfs mkdir -p "${LIVE_ROOT}"/config/binary_syslinux cat > "${LIVE_ROOT}"/config/binary << EOF diff --git a/helpers/lh_losetup b/helpers/lh_losetup index a8d6176..c2c7a7b 100755 --- a/helpers/lh_losetup +++ b/helpers/lh_losetup @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="wrapper around losetup" HELP="" USAGE="${PROGRAM} <device> <file> <partition>" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,8 +32,6 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "losetup: Init" - if [ -z "${1}" ] then DEVICE="`${LH_ROOT_COMMAND} ${LH_LOSETUP} -f`" diff --git a/helpers/lh_source b/helpers/lh_source index 56c1849..bf07772 100755 --- a/helpers/lh_source +++ b/helpers/lh_source @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="build source images" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,8 +32,6 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "source: Init" - # Enabling network in chroot lh_chroot_hosts install ${*} lh_chroot_resolv install ${*} diff --git a/helpers/lh_source_debian b/helpers/lh_source_debian index eb43e18..4ec0a56 100755 --- a/helpers/lh_source_debian +++ b/helpers/lh_source_debian @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="debian sources" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,13 +32,13 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "source_debian: Init" - if [ "${LIVE_SOURCE}" != "enabled" ] then exit 0 fi +Echo_message "Begin downloading sources..." + # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_source_debian-live b/helpers/lh_source_debian-live index 06f9d86..970e0fd 100755 --- a/helpers/lh_source_debian-live +++ b/helpers/lh_source_debian-live @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="copy debian-live config into source" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,13 +32,13 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "source_debian-live: Init" - if [ "${LIVE_SOURCE}" != "enabled" ] then exit 0 fi +Echo_message "Begin copying live-helper configuration..." + # Requiring stage file Require_stagefile .stage/bootstrap diff --git a/helpers/lh_source_generic b/helpers/lh_source_generic index 4db80a0..7c1b826 100755 --- a/helpers/lh_source_generic +++ b/helpers/lh_source_generic @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="build source generic image" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,40 +32,39 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "source_generic: Init" - if [ "${LIVE_SOURCE}" != "enabled" ] then exit 0 fi -for IMAGE in ${LIVE_SOURCE_IMAGES} -do - if [ "${IMAGE}" = "generic" ] - then - # Requiring stage file - Require_stagefile .stage/source_debian +if ! echo "${LIVE_SOURCE_IMAGES}" | grep -qs generic +then + exit 0 +fi - # Checking stage file - Check_stagefile .stage/source_generic +Echo_message "Begin building source generic image..." +Echo_message "This may take a while." - # Checking lock file - Check_lockfile .lock +# Requiring stage file +Require_stagefile .stage/source_debian - # Creating lock file - Create_lockfile .lock +# Checking stage file +Check_stagefile .stage/source_generic - # Remove old source - if [ -f source.tar ] - then - rm -f source.tar - fi +# Checking lock file +Check_lockfile .lock - # Create tarball - Echo_message "Creating tarball, this can take a while." - tar cf source.tar source +# Creating lock file +Create_lockfile .lock - # Creating stage file - Create_stagefile .stage/source_generic - fi -done +# Remove old source +if [ -f source.tar ] +then + rm -f source.tar +fi + +# Create tarball +tar cf source.tar source + +# Creating stage file +Create_stagefile .stage/source_generic diff --git a/helpers/lh_source_hdd b/helpers/lh_source_hdd index 74b8889..416f1ba 100755 --- a/helpers/lh_source_hdd +++ b/helpers/lh_source_hdd @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="build source harddisk image" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,40 +32,39 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "source_hdd: Init" - if [ "${LIVE_SOURCE}" != "enabled" ] then exit 0 fi -for IMAGE in ${LIVE_SOURCE_IMAGES} -do - if [ "${IMAGE}" = "hdd" ] - then - # Requiring stage file - Require_stagefile .stage/source_debian +if ! echo "${LIVE_SOURCE_IMAGES}" | grep -qs hdd +then + exit 0 +fi - # Checking stage file - Check_stagefile .stage/source_hdd +Echo_message "Begin building source harddisk image..." +Echo_message "This may take a while." - # Checking lock file - Check_lockfile .lock +# Requiring stage file +Require_stagefile .stage/source_debian - # Creating lock file - Create_lockfile .lock +# Checking stage file +Check_stagefile .stage/source_hdd - # Remove old source - if [ -f source-hdd.tar.gz ] - then - rm -f source-hdd.tar.gz - fi +# Checking lock file +Check_lockfile .lock - # Create tarball - Echo_message "Creating tarball, this can take a while." - tar cfz source-hdd.tar.gz source +# Creating lock file +Create_lockfile .lock - # Creating stage file - Create_stagefile .stage/source_hdd - fi -done +# Remove old source +if [ -f source-hdd.tar.gz ] +then + rm -f source-hdd.tar.gz +fi + +# Create tarball +tar cfz source-hdd.tar.gz source + +# Creating stage file +Create_stagefile .stage/source_hdd diff --git a/helpers/lh_source_iso b/helpers/lh_source_iso index 426fac7..79e588e 100755 --- a/helpers/lh_source_iso +++ b/helpers/lh_source_iso @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="build iso source image" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -37,78 +37,77 @@ then exit 0 fi -for IMAGE in ${LIVE_SOURCE_IMAGES} -do - if [ "${IMAGE}" = "iso" ] - then - Breakpoint "source_iso: Init" +if ! echo "${LIVE_SOURCE_IMAGES}" | grep -qs iso +then + exit 0 +fi - # Requiring stage file - Require_stagefile .stage/source_debian +Echo_message "Begin building source iso image..." - # Checking stage file - Check_stagefile .stage/source_iso +# Requiring stage file +Require_stagefile .stage/source_debian - # Checking lock file - Check_lockfile .lock +# Checking stage file +Check_stagefile .stage/source_iso - # Creating lock file - Create_lockfile .lock +# Checking lock file +Check_lockfile .lock - # Checking depends - Check_package chroot/usr/bin/"${LH_GENISOIMAGE}" ${LH_GENISOIMAGE} +# Creating lock file +Create_lockfile .lock - # Installing depends - Install_package +# Checking depends +Check_package chroot/usr/bin/"${LH_GENISOIMAGE}" ${LH_GENISOIMAGE} - # Remove old iso image - if [ -f source.iso ] - then - rm -f source.iso - fi +# Installing depends +Install_package - if [ "${LH_VERBOSE}" = "enabled" ] - then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v" - fi +# Remove old iso image +if [ -f source.iso ] +then + rm -f source.iso +fi - if [ -n "${LIVE_ISO_APPLICATION}" ] && [ "${LIVE_ISO_APPLICATION}" != "none" ] - then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LIVE_ISO_APPLICATION}\"" - fi +if [ "${LH_VERBOSE}" = "enabled" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v" +fi - if [ -n "${LIVE_ISO_PREPARER}" ] && [ "${LIVE_ISO_PREPARER}" != "none" ] - then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LIVE_ISO_PREPARER}\"" - fi +if [ -n "${LIVE_ISO_APPLICATION}" ] && [ "${LIVE_ISO_APPLICATION}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LIVE_ISO_APPLICATION}\"" +fi - if [ -n "${LIVE_ISO_PUBLISHER}" ] && [ "${LIVE_ISO_PUBLISHER}" != "none" ] - then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LIVE_ISO_PUBLISHER}\"" - fi +if [ -n "${LIVE_ISO_PREPARER}" ] && [ "${LIVE_ISO_PREPARER}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LIVE_ISO_PREPARER}\"" +fi - if [ -n "${LIVE_ISO_VOLUME}" ] && [ "${LIVE_ISO_VOLUME}" != "none" ] - then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LIVE_ISO_VOLUME}\"" - fi +if [ -n "${LIVE_ISO_PUBLISHER}" ] && [ "${LIVE_ISO_PUBLISHER}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LIVE_ISO_PUBLISHER}\"" +fi - # Moving image - mv source chroot +if [ -n "${LIVE_ISO_VOLUME}" ] && [ "${LIVE_ISO_VOLUME}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LIVE_ISO_VOLUME}\"" +fi + +# Moving image +mv source chroot cat >> chroot/source.sh << EOF ${LH_GENISOIMAGE} ${GENISOIMAGE_OPTIONS} -o source.iso -r -J -l -cache-inodes source EOF - Chroot "sh source.sh" +Chroot "sh source.sh" - # Move image - mv chroot/source chroot/source.iso ./ - rm -f chroot/source.sh +# Move image +mv chroot/source chroot/source.iso ./ +rm -f chroot/source.sh - # Removing depends - Remove_package +# Removing depends +Remove_package - # Creating stage file - Create_stagefile .stage/source_iso - fi -done +# Creating stage file +Create_stagefile .stage/source_iso diff --git a/helpers/lh_source_md5sum b/helpers/lh_source_md5sum index e458ed8..7674692 100755 --- a/helpers/lh_source_md5sum +++ b/helpers/lh_source_md5sum @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="create source md5sums" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,13 +32,13 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "source_md5sum: Init" - if [ "${LIVE_SOURCE}" != "enabled" ] then exit 0 fi +Echo_message "Begin creating source md5sum.txt..." + # Requiring stage file Require_stagefile .stage/source_debian diff --git a/helpers/lh_source_net b/helpers/lh_source_net index 90e5191..58da2f9 100755 --- a/helpers/lh_source_net +++ b/helpers/lh_source_net @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="build source net image" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,39 +32,38 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "source_net: Init" - if [ "${LIVE_SOURCE}" != "enabled" ] then exit 0 fi -for IMAGE in ${LIVE_SOURCE_IMAGES} -do - if [ "${IMAGE}" = "net" ] - then - # Requiring stage file - Require_stagefile .stage/source_debian +if ! echo "${LIVE_SOURCE_IMAGES}" | grep -qs net +then + exit 0 +fi - # Checking stage file - Check_stagefile .stage/source_net +Echo_message "Begin building source netboot image..." - # Checking lock file - Check_lockfile .lock +# Requiring stage file +Require_stagefile .stage/source_debian - # Creating lock file - Create_lockfile .lock +# Checking stage file +Check_stagefile .stage/source_net - # Remove old source - if [ -f source-net.tar.gz ] - then - rm -f source-net.tar.gz - fi +# Checking lock file +Check_lockfile .lock - # Create tarball - tar cfz source-net.tar.gz source +# Creating lock file +Create_lockfile .lock - # Creating stage file - Create_stagefile .stage/source_net - fi -done +# Remove old source +if [ -f source-net.tar.gz ] +then + rm -f source-net.tar.gz +fi + +# Create tarball +tar cfz source-net.tar.gz source + +# Creating stage file +Create_stagefile .stage/source_net diff --git a/helpers/lh_source_usb-hdd b/helpers/lh_source_usb-hdd index ec853a1..903f2bb 100755 --- a/helpers/lh_source_usb-hdd +++ b/helpers/lh_source_usb-hdd @@ -1,6 +1,6 @@ #!/bin/sh -# lh_source_usb-hdd(1) - build source image +# lh_source_usb-hdd(1) - build source usb-hdd image # Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org> # # live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING. @@ -9,21 +9,21 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="build source image" HELP="" USAGE="${PROGRAM} [--force]" Arguments "${@}" -Echo_debug "Init ${PROGRAM}" - # Reading configuration files Read_conffile config/common Read_conffile config/bootstrap @@ -32,82 +32,81 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Breakpoint "source_usb-hdd: Init" - if [ "${LIVE_SOURCE}" != "enabled" ] then exit 0 fi -for IMAGE in ${LIVE_SOURCE_IMAGES} -do - if [ "${IMAGE}" = "usb-hdd" ] - then - # Requiring stage file - Require_stagefile .stage/source_debian - - # Checking stage file - Check_stagefile .stage/source_usb-hdd - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Checking depends - Check_package chroot/sbin/mkdosfs dosfstools - Check_package chroot/sbin/parted parted - - # Installing depends - Install_package - - # Remove old source - if [ -f source.img ] - then - rm -f source.img - fi - - # Everything which comes here needs to be cleaned up, - DU_DIM="`du -ms source | cut -f1`" - REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 50`" # Just 2% more to be sure, need something more sophistcated here... - dd if=/dev/zero of=source.img bs=1024k count=${REAL_DIM} - FREELO="`${LH_LOSETUP} -f`" - if [ ! -b chroot/${FREELO} ] - then - MAKEDEV="true" - - mv chroot/dev chroot/dev.tmp - find /dev | cpio -dmpu chroot - fi - - echo "!!! The following error/warning messages can be ignored !!!" - lh_losetup $FREELO source.img 0 - Chroot "parted -s ${FREELO} mklabel msdos" || true - Chroot "parted -s ${FREELO} mkpartfs primary fat16 0.0 100%" || true - Chroot "parted -s ${FREELO} set 1 lba off" || true - ${LH_LOSETUP} -d ${FREELO} - - lh_losetup $FREELO source.img 1 - Chroot " mkfs.vfat -F 16 -n DEBIAN_LIVE ${FREELO}" - mkdir -p source.tmp - ${LH_ROOT_COMMAND} mount ${FREELO} source.tmp - cp -r source/* source.tmp - ${LH_ROOT_COMMAND} umount source.tmp - rmdir source.tmp - ${LH_LOSETUP} -d ${FREELO} - echo "!!! The above error/warning messages can be ignored !!!" - - if [ -n "${MAKEDEV}" ] - then - rm -f chroot/dev - mv chroot/dev.tmp chroot/dev - fi - - # Removing depends - Remove_package - - # Creating stage file - Create_stagefile .stage/source_usb-hdd - fi -done +if ! echo "${LIVE_SOURCE_IMAGES}" | grep -qs usb-hdd +then + exit 0 +fi + +Echo_message "Begin building source usb-hdd image..." + +# Requiring stage file +Require_stagefile .stage/source_debian + +# Checking stage file +Check_stagefile .stage/source_usb-hdd + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Checking depends +Check_package chroot/sbin/mkdosfs dosfstools +Check_package chroot/sbin/parted parted + +# Installing depends +Install_package + +# Remove old source +if [ -f source.img ] +then + rm -f source.img +fi + +# Everything which comes here needs to be cleaned up, +DU_DIM="`du -ms source | cut -f1`" +REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 50`" # Just 2% more to be sure, need something more sophistcated here... +dd if=/dev/zero of=source.img bs=1024k count=${REAL_DIM} +FREELO="`${LH_LOSETUP} -f`" +if [ ! -b chroot/${FREELO} ] +then + MAKEDEV="true" + + mv chroot/dev chroot/dev.tmp + find /dev | cpio -dmpu chroot +fi + +echo "!!! The following error/warning messages can be ignored !!!" +lh_losetup $FREELO source.img 0 +Chroot "parted -s ${FREELO} mklabel msdos" || true +Chroot "parted -s ${FREELO} mkpartfs primary fat16 0.0 100%" || true +Chroot "parted -s ${FREELO} set 1 lba off" || true +${LH_LOSETUP} -d ${FREELO} + +lh_losetup $FREELO source.img 1 +Chroot " mkfs.vfat -F 16 -n DEBIAN_LIVE ${FREELO}" +mkdir -p source.tmp +${LH_ROOT_COMMAND} mount ${FREELO} source.tmp +cp -r source/* source.tmp +${LH_ROOT_COMMAND} umount source.tmp +rmdir source.tmp +${LH_LOSETUP} -d ${FREELO} +echo "!!! The above error/warning messages can be ignored !!!" + +if [ -n "${MAKEDEV}" ] +then + rm -f chroot/dev + mv chroot/dev.tmp chroot/dev +fi + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/source_usb-hdd diff --git a/helpers/lh_testroot b/helpers/lh_testroot index 679119e..90464ec 100755 --- a/helpers/lh_testroot +++ b/helpers/lh_testroot @@ -9,13 +9,15 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables DESCRIPTION="ensure that a system is built as root" HELP="" USAGE="${PROGRAM} [--force]" @@ -30,8 +32,6 @@ Read_conffile config/binary Read_conffile config/source Set_defaults -Echo_debug "Init ${PROGRAM}" - # Checking user account if [ "`${LH_ROOT_COMMAND} id -u`" -ne "0" ] then diff --git a/helpers/make-live b/helpers/make-live index d4ad57a..3f71f5c 100755 --- a/helpers/make-live +++ b/helpers/make-live @@ -22,13 +22,15 @@ set -e -# Source common functions -for FUNCTION in /usr/share/live-helper/functions/*.sh +# Including common functions +LH_BASE="${LH_BASE:-/usr/share/live-helper}" + +for FUNCTION in "${LH_BASE}"/functions/*.sh do - . ${FUNCTION} + . "${FUNCTION}" done -# Set static variables +# Setting static variables PROGRAM="`basename ${0}`" DESCRIPTION="utility to build Debian Live systems" USAGE="${PROGRAM} [config] [--mode MODE] [--config CONFIG] [--apt apt|aptitude] [--apt-ftpproxy URL] [--apt-httpproxy URL] [--binary-indices 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] [--debconf-nowarnings yes|no] [--genisoimage genisoimage|mkisofs] [--losetup losetup|losetup.org] [--tasksel aptitude|tasksel] [-r|--root DIRECTORY] [-a|--architecture ARCHITECTURE] [-d|--distribution stable|testing|unstable|etch|lenny|sid] [--distribution-config DIRECTORY] [-f|--bootstrap-flavour minimal|standard] [-m|--mirror-bootstrap URL] [--mirror-bootstrap-security URL] [--mirror-binary URL] [--mirror-binary-security URL] [--sections SECTION|\"SECTIONS\"] [--interactive shell|x11|xnest] [-k|--linux-flavour FLAVOUR] [--linux-packages PACKAGE|\"PACKAGES\"] [--keyring-packages PACKAGE|\"PACKAGES\"] [--hooks \"COMMAND\"|\"COMMANDS\"] [-l|--language LANGUAGE] [--packages PACKAGE|\"PACKAGES\"] [-p|--packages-lists LIST|\"LISTS\"] [--tasks TASK|\"TASKS\"] [--security enabled|disabled] [--symlinks enabled|disabled] [--sysvinit enabled|disabled] [--bootappend BOOT_PARAMETER|\"BOOT_PARAMETERS\"] [-e|--encryption ALGORITHM] [--username NAME] [--hostname NAME] [--chroot-filesystem ext2|plain|squashfs] [--memtest memtest86|memtest86+] [--iso-volume STRING] [--net-server HOSTNAME|IP] [--net-path DIRECTORY] [--source enabled|disabled] [--bootloader grub|syslinux] [--grub-splash FILE] [--syslinux-splash FILE] [-b|--binary-images hdd|iso|usb-hdd|net] [-s|--source-images generic|hdd|iso|usb-hdd|net] [--includes PATH] [--templates PATH] [--breakpoints] [--debug] [--force] [--quiet] [--verbose] [--root-command sudo]" @@ -39,7 +41,7 @@ Local_arguments () { ARGUMENTS="`getopt --longoptions mode:,config:,apt:,apt-ftpproxy:,apt-httpproxy:,binary-indices:,apt-pdiffs:,apt-recommends:,apt-secure:,bootstrap:,cache:,debconf-frontend:,debconf-priority:,debconf-nowarnings:,genisoimage:,losetup:,tasksel:,root:,architecture:,distribution:,distribution-config:,flavour:,mirror-bootstrap:,mirror-bootstrap-security:,mirror-binary:,mirror-binary-security:,sections:,interactive:,kernel:,kernel-packages:,keyring-packages:,hooks:,language:,packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,bootappend:,encryption:,username:,hostname:,chroot-filesystem:,memtest:,iso-application:,iso-preparer:,iso-publisher:,iso-volume:,server-address:,server-path:,source:,bootloader:,grub-splash:,syslinux-splash:,binary-images:,binary-source:,includes:,templates:,help,usage,version,force,breakpoints,debug,quiet,verbose,root-command:,initramfs: --name=${PROGRAM} --options r:a:d:f:m:k:l:p:e:b:s:huv --shell sh -- "${@}"`" - if [ "${?}" != "0" ] + if [ "${?}" -ne "0" ] then echo "Terminating." >&2 exit 1 @@ -355,10 +357,7 @@ Main () Set_defaults - if [ -z "${ROOT}" ] - then - ROOT="${LIVE_ROOT}" - fi + ROOT="${ROOT:-$LIVE_ROOT}" # Source existing configuration Read_conffile "${ROOT}"/config/common |