From 3b80c5c5d9c9d2eec91910b70a120da5943c7fac Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 5 Feb 2010 17:10:44 +0100 Subject: Dropping lh_ prefix from internal helpers, this is not user visible. --- helpers/binary | 96 +++ helpers/binary_chroot | 119 +++ helpers/binary_debian-installer | 680 +++++++++++++++++ helpers/binary_disk | 137 ++++ helpers/binary_encryption | 146 ++++ helpers/binary_grub | 339 +++++++++ helpers/binary_grub2 | 309 ++++++++ helpers/binary_includes | 166 +++++ helpers/binary_iso | 219 ++++++ helpers/binary_linux-image | 81 ++ helpers/binary_local-hooks | 57 ++ helpers/binary_local-includes | 55 ++ helpers/binary_local-packageslists | 110 +++ helpers/binary_manifest | 70 ++ helpers/binary_md5sum | 73 ++ helpers/binary_memtest | 119 +++ helpers/binary_net | 167 +++++ helpers/binary_rootfs | 453 ++++++++++++ helpers/binary_silo | 272 +++++++ helpers/binary_syslinux | 659 +++++++++++++++++ helpers/binary_tar | 52 ++ helpers/binary_usb-hdd | 280 +++++++ helpers/binary_virtual-hdd | 110 +++ helpers/binary_win32-loader | 97 +++ helpers/binary_yaboot | 313 ++++++++ helpers/bootstrap | 34 + helpers/bootstrap_cache | 93 +++ helpers/bootstrap_cdebootstrap | 180 +++++ helpers/bootstrap_copy | 55 ++ helpers/bootstrap_debootstrap | 161 ++++ helpers/build | 67 ++ helpers/chroot | 78 ++ helpers/chroot_apt | 242 ++++++ helpers/chroot_cache | 89 +++ helpers/chroot_debianchroot | 80 ++ helpers/chroot_devpts | 85 +++ helpers/chroot_dpkg | 81 ++ helpers/chroot_hacks | 188 +++++ helpers/chroot_hooks | 71 ++ helpers/chroot_hostname | 94 +++ helpers/chroot_hosts | 97 +++ helpers/chroot_install-packages | 65 ++ helpers/chroot_interactive | 61 ++ helpers/chroot_linux-image | 107 +++ helpers/chroot_local-hooks | 69 ++ helpers/chroot_local-includes | 49 ++ helpers/chroot_local-packages | 47 ++ helpers/chroot_local-packageslists | 51 ++ helpers/chroot_local-patches | 65 ++ helpers/chroot_local-preseed | 64 ++ helpers/chroot_localization | 655 +++++++++++++++++ helpers/chroot_packages | 46 ++ helpers/chroot_packageslists | 51 ++ helpers/chroot_preseed | 65 ++ helpers/chroot_proc | 96 +++ helpers/chroot_resolv | 95 +++ helpers/chroot_selinuxfs | 96 +++ helpers/chroot_sources | 466 ++++++++++++ helpers/chroot_symlinks | 58 ++ helpers/chroot_sysfs | 90 +++ helpers/chroot_sysv-rc | 86 +++ helpers/chroot_sysvinit | 60 ++ helpers/chroot_tasks | 81 ++ helpers/clean | 154 ++++ helpers/config | 1304 +++++++++++++++++++++++++++++++++ helpers/lh | 12 +- helpers/lh_binary | 96 --- helpers/lh_binary_chroot | 119 --- helpers/lh_binary_debian-installer | 680 ----------------- helpers/lh_binary_disk | 137 ---- helpers/lh_binary_encryption | 146 ---- helpers/lh_binary_grub | 339 --------- helpers/lh_binary_grub2 | 309 -------- helpers/lh_binary_includes | 166 ----- helpers/lh_binary_iso | 219 ------ helpers/lh_binary_linux-image | 81 -- helpers/lh_binary_local-hooks | 57 -- helpers/lh_binary_local-includes | 55 -- helpers/lh_binary_local-packageslists | 110 --- helpers/lh_binary_manifest | 70 -- helpers/lh_binary_md5sum | 73 -- helpers/lh_binary_memtest | 119 --- helpers/lh_binary_net | 167 ----- helpers/lh_binary_rootfs | 453 ------------ helpers/lh_binary_silo | 272 ------- helpers/lh_binary_syslinux | 659 ----------------- helpers/lh_binary_tar | 52 -- helpers/lh_binary_usb-hdd | 280 ------- helpers/lh_binary_virtual-hdd | 110 --- helpers/lh_binary_win32-loader | 97 --- helpers/lh_binary_yaboot | 313 -------- helpers/lh_bootstrap | 34 - helpers/lh_bootstrap_cache | 93 --- helpers/lh_bootstrap_cdebootstrap | 180 ----- helpers/lh_bootstrap_copy | 55 -- helpers/lh_bootstrap_debootstrap | 161 ---- helpers/lh_build | 67 -- helpers/lh_chroot | 78 -- helpers/lh_chroot_apt | 242 ------ helpers/lh_chroot_cache | 89 --- helpers/lh_chroot_debianchroot | 80 -- helpers/lh_chroot_devpts | 85 --- helpers/lh_chroot_dpkg | 81 -- helpers/lh_chroot_hacks | 188 ----- helpers/lh_chroot_hooks | 71 -- helpers/lh_chroot_hostname | 94 --- helpers/lh_chroot_hosts | 97 --- helpers/lh_chroot_install-packages | 65 -- helpers/lh_chroot_interactive | 61 -- helpers/lh_chroot_linux-image | 107 --- helpers/lh_chroot_local-hooks | 69 -- helpers/lh_chroot_local-includes | 49 -- helpers/lh_chroot_local-packages | 47 -- helpers/lh_chroot_local-packageslists | 51 -- helpers/lh_chroot_local-patches | 65 -- helpers/lh_chroot_local-preseed | 64 -- helpers/lh_chroot_localization | 655 ----------------- helpers/lh_chroot_packages | 46 -- helpers/lh_chroot_packageslists | 51 -- helpers/lh_chroot_preseed | 65 -- helpers/lh_chroot_proc | 96 --- helpers/lh_chroot_resolv | 95 --- helpers/lh_chroot_selinuxfs | 96 --- helpers/lh_chroot_sources | 466 ------------ helpers/lh_chroot_symlinks | 58 -- helpers/lh_chroot_sysfs | 90 --- helpers/lh_chroot_sysv-rc | 86 --- helpers/lh_chroot_sysvinit | 60 -- helpers/lh_chroot_tasks | 81 -- helpers/lh_clean | 154 ---- helpers/lh_config | 1304 --------------------------------- helpers/lh_local | 18 - helpers/lh_source | 54 -- helpers/lh_source_debian | 153 ---- helpers/lh_source_debian-live | 74 -- helpers/lh_source_disk | 104 --- helpers/lh_source_iso | 109 --- helpers/lh_source_md5sum | 78 -- helpers/lh_source_net | 61 -- helpers/lh_source_tar | 62 -- helpers/lh_source_usb-hdd | 139 ---- helpers/lh_source_virtual-hdd | 114 --- helpers/lh_testroot | 31 - helpers/local | 18 + helpers/source | 54 ++ helpers/source_debian | 153 ++++ helpers/source_debian-live | 74 ++ helpers/source_disk | 104 +++ helpers/source_iso | 109 +++ helpers/source_md5sum | 78 ++ helpers/source_net | 61 ++ helpers/source_tar | 62 ++ helpers/source_usb-hdd | 139 ++++ helpers/source_virtual-hdd | 114 +++ helpers/testroot | 31 + 155 files changed, 11858 insertions(+), 11858 deletions(-) create mode 100755 helpers/binary create mode 100755 helpers/binary_chroot create mode 100755 helpers/binary_debian-installer create mode 100755 helpers/binary_disk create mode 100755 helpers/binary_encryption create mode 100755 helpers/binary_grub create mode 100755 helpers/binary_grub2 create mode 100755 helpers/binary_includes create mode 100755 helpers/binary_iso create mode 100755 helpers/binary_linux-image create mode 100755 helpers/binary_local-hooks create mode 100755 helpers/binary_local-includes create mode 100755 helpers/binary_local-packageslists create mode 100755 helpers/binary_manifest create mode 100755 helpers/binary_md5sum create mode 100755 helpers/binary_memtest create mode 100755 helpers/binary_net create mode 100755 helpers/binary_rootfs create mode 100755 helpers/binary_silo create mode 100755 helpers/binary_syslinux create mode 100755 helpers/binary_tar create mode 100755 helpers/binary_usb-hdd create mode 100755 helpers/binary_virtual-hdd create mode 100755 helpers/binary_win32-loader create mode 100755 helpers/binary_yaboot create mode 100755 helpers/bootstrap create mode 100755 helpers/bootstrap_cache create mode 100755 helpers/bootstrap_cdebootstrap create mode 100755 helpers/bootstrap_copy create mode 100755 helpers/bootstrap_debootstrap create mode 100755 helpers/build create mode 100755 helpers/chroot create mode 100755 helpers/chroot_apt create mode 100755 helpers/chroot_cache create mode 100755 helpers/chroot_debianchroot create mode 100755 helpers/chroot_devpts create mode 100755 helpers/chroot_dpkg create mode 100755 helpers/chroot_hacks create mode 100755 helpers/chroot_hooks create mode 100755 helpers/chroot_hostname create mode 100755 helpers/chroot_hosts create mode 100755 helpers/chroot_install-packages create mode 100755 helpers/chroot_interactive create mode 100755 helpers/chroot_linux-image create mode 100755 helpers/chroot_local-hooks create mode 100755 helpers/chroot_local-includes create mode 100755 helpers/chroot_local-packages create mode 100755 helpers/chroot_local-packageslists create mode 100755 helpers/chroot_local-patches create mode 100755 helpers/chroot_local-preseed create mode 100755 helpers/chroot_localization create mode 100755 helpers/chroot_packages create mode 100755 helpers/chroot_packageslists create mode 100755 helpers/chroot_preseed create mode 100755 helpers/chroot_proc create mode 100755 helpers/chroot_resolv create mode 100755 helpers/chroot_selinuxfs create mode 100755 helpers/chroot_sources create mode 100755 helpers/chroot_symlinks create mode 100755 helpers/chroot_sysfs create mode 100755 helpers/chroot_sysv-rc create mode 100755 helpers/chroot_sysvinit create mode 100755 helpers/chroot_tasks create mode 100755 helpers/clean create mode 100755 helpers/config delete mode 100755 helpers/lh_binary delete mode 100755 helpers/lh_binary_chroot delete mode 100755 helpers/lh_binary_debian-installer delete mode 100755 helpers/lh_binary_disk delete mode 100755 helpers/lh_binary_encryption delete mode 100755 helpers/lh_binary_grub delete mode 100755 helpers/lh_binary_grub2 delete mode 100755 helpers/lh_binary_includes delete mode 100755 helpers/lh_binary_iso delete mode 100755 helpers/lh_binary_linux-image delete mode 100755 helpers/lh_binary_local-hooks delete mode 100755 helpers/lh_binary_local-includes delete mode 100755 helpers/lh_binary_local-packageslists delete mode 100755 helpers/lh_binary_manifest delete mode 100755 helpers/lh_binary_md5sum delete mode 100755 helpers/lh_binary_memtest delete mode 100755 helpers/lh_binary_net delete mode 100755 helpers/lh_binary_rootfs delete mode 100755 helpers/lh_binary_silo delete mode 100755 helpers/lh_binary_syslinux delete mode 100755 helpers/lh_binary_tar delete mode 100755 helpers/lh_binary_usb-hdd delete mode 100755 helpers/lh_binary_virtual-hdd delete mode 100755 helpers/lh_binary_win32-loader delete mode 100755 helpers/lh_binary_yaboot delete mode 100755 helpers/lh_bootstrap delete mode 100755 helpers/lh_bootstrap_cache delete mode 100755 helpers/lh_bootstrap_cdebootstrap delete mode 100755 helpers/lh_bootstrap_copy delete mode 100755 helpers/lh_bootstrap_debootstrap delete mode 100755 helpers/lh_build delete mode 100755 helpers/lh_chroot delete mode 100755 helpers/lh_chroot_apt delete mode 100755 helpers/lh_chroot_cache delete mode 100755 helpers/lh_chroot_debianchroot delete mode 100755 helpers/lh_chroot_devpts delete mode 100755 helpers/lh_chroot_dpkg delete mode 100755 helpers/lh_chroot_hacks delete mode 100755 helpers/lh_chroot_hooks delete mode 100755 helpers/lh_chroot_hostname delete mode 100755 helpers/lh_chroot_hosts delete mode 100755 helpers/lh_chroot_install-packages delete mode 100755 helpers/lh_chroot_interactive delete mode 100755 helpers/lh_chroot_linux-image delete mode 100755 helpers/lh_chroot_local-hooks delete mode 100755 helpers/lh_chroot_local-includes delete mode 100755 helpers/lh_chroot_local-packages delete mode 100755 helpers/lh_chroot_local-packageslists delete mode 100755 helpers/lh_chroot_local-patches delete mode 100755 helpers/lh_chroot_local-preseed delete mode 100755 helpers/lh_chroot_localization delete mode 100755 helpers/lh_chroot_packages delete mode 100755 helpers/lh_chroot_packageslists delete mode 100755 helpers/lh_chroot_preseed delete mode 100755 helpers/lh_chroot_proc delete mode 100755 helpers/lh_chroot_resolv delete mode 100755 helpers/lh_chroot_selinuxfs delete mode 100755 helpers/lh_chroot_sources delete mode 100755 helpers/lh_chroot_symlinks delete mode 100755 helpers/lh_chroot_sysfs delete mode 100755 helpers/lh_chroot_sysv-rc delete mode 100755 helpers/lh_chroot_sysvinit delete mode 100755 helpers/lh_chroot_tasks delete mode 100755 helpers/lh_clean delete mode 100755 helpers/lh_config delete mode 100755 helpers/lh_local delete mode 100755 helpers/lh_source delete mode 100755 helpers/lh_source_debian delete mode 100755 helpers/lh_source_debian-live delete mode 100755 helpers/lh_source_disk delete mode 100755 helpers/lh_source_iso delete mode 100755 helpers/lh_source_md5sum delete mode 100755 helpers/lh_source_net delete mode 100755 helpers/lh_source_tar delete mode 100755 helpers/lh_source_usb-hdd delete mode 100755 helpers/lh_source_virtual-hdd delete mode 100755 helpers/lh_testroot create mode 100755 helpers/local create mode 100755 helpers/source create mode 100755 helpers/source_debian create mode 100755 helpers/source_debian-live create mode 100755 helpers/source_disk create mode 100755 helpers/source_iso create mode 100755 helpers/source_md5sum create mode 100755 helpers/source_net create mode 100755 helpers/source_tar create mode 100755 helpers/source_usb-hdd create mode 100755 helpers/source_virtual-hdd create mode 100755 helpers/testroot diff --git a/helpers/binary b/helpers/binary new file mode 100755 index 000000000..33ee5d6ee --- /dev/null +++ b/helpers/binary @@ -0,0 +1,96 @@ +#!/bin/sh + +# lh_binary(1) - build binary images +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build binary images')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Setup cleanup function +Setup_cleanup + +# Preparing root filesystem +lh binary_chroot ${*} + +if [ "${LH_CHROOT_BUILD}" = "true" ] +then + # Configuring chroot + lh chroot_devpts install ${*} + lh chroot_proc install ${*} + lh chroot_selinuxfs install ${*} + lh chroot_sysfs install ${*} + lh chroot_hosts install ${*} + lh chroot_resolv install ${*} + lh chroot_hostname install ${*} + lh chroot_apt install-binary ${*} + lh chroot_sources install ${*} +fi + +# Building root filesystem +lh binary_rootfs ${*} +lh binary_manifest ${*} +lh binary_encryption ${*} + +# Prepare images +lh binary_local-packageslists ${*} +lh binary_linux-image ${*} +lh binary_debian-installer ${*} +lh binary_memtest ${*} +lh binary_grub ${*} +lh binary_grub2 ${*} +lh binary_syslinux ${*} +lh binary_yaboot ${*} +lh binary_silo ${*} +lh binary_disk ${*} +lh binary_win32-loader ${*} +lh binary_includes ${*} +lh binary_local-includes ${*} +lh binary_local-hooks ${*} +lh binary_md5sum ${*} + +if [ "${LH_CHROOT_BUILD}" != "true" ] +then + lh chroot_devpts install ${*} + lh chroot_proc install ${*} + lh chroot_selinuxfs install ${*} + lh chroot_sysfs install ${*} +fi + +# Building images +lh binary_iso ${*} +lh binary_net ${*} +lh binary_tar ${*} +lh binary_usb-hdd ${*} +lh binary_virtual-hdd ${*} + +if [ "${LH_CHROOT_BUILD}" = "true" ] +then + # Deconfiguring chroot + rm -f .stage/chroot_sources + lh chroot_hostname remove ${*} + lh chroot_resolv remove ${*} + lh chroot_hosts remove ${*} +fi + +lh chroot_apt remove ${*} +lh chroot_sysfs remove ${*} +lh chroot_selinuxfs remove ${*} +lh chroot_proc remove ${*} +lh chroot_devpts remove ${*} diff --git a/helpers/binary_chroot b/helpers/binary_chroot new file mode 100755 index 000000000..c65b7b56e --- /dev/null +++ b/helpers/binary_chroot @@ -0,0 +1,119 @@ +#!/bin/sh + +# lh_binary_chroot(1) - copy chroot into chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'copy chroot into chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin copying chroot..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_chroot + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Normally, virtual filesystems are not mounted here, but people tend to be lazy +if [ -f chroot/proc/version ] +then + if [ "${LH_USE_FAKEROOT}" != "true" ] +then + ${LH_ROOT_COMMAND} umount chroot/proc + else + rm -rf chroot/proc + mkdir -p chroot/proc + fi +fi + +if [ -d chroot/sys/kernel ] +then + if [ "${LH_USE_FAKEROOT}" != "true" ] + then + ${LH_ROOT_COMMAND} umount chroot/sys + else + rm -rf chroot/sys + mkdir -p chroot/sys + fi +fi + +# Copying /dev if using fakeroot +if [ "${LH_USE_FAKEROOT}" = "true" ] +then + rm -rf chroot/dev + find /dev | cpio -dmpu chroot +fi + +if [ "${LH_CHROOT_BUILD}" = "false" ] +then + exit 0 +fi + +if [ "${LH_CACHE}" = "true" ] && Find_files cache/stages_rootfs/filesystem* +then + exit 0 +fi + +Echo_message "This may take a while." + +# Removing old chroot +${LH_ROOT_COMMAND} rm -rf chroot/chroot +${LH_ROOT_COMMAND} rm -rf chroot.tmp + +# Copying new chroot +if [ -d cache/stages_bootstrap ] && [ "${LH_CHROOT_FILESYSTEM}" != "plain" ] +then + ${LH_ROOT_COMMAND} mv chroot chroot.tmp + ${LH_ROOT_COMMAND} cp -a cache/stages_bootstrap chroot + ${LH_ROOT_COMMAND} touch chroot/chroot.cache +else + ${LH_ROOT_COMMAND} cp -a chroot chroot.tmp +fi + +${LH_ROOT_COMMAND} mv chroot.tmp chroot/chroot + +if [ -f config/binary_rootfs/exclude ] +then + # Read exclude file and expand wildcards. + for EXCLUDE in $(cat config/binary_rootfs/exclude) + do + if [ -e chroot/chroot/"${EXCLUDE}" ] + then + # Run "rm" inside the chroot so it cannot possibly remove host files. + Chroot chroot "rm -r chroot/${EXCLUDE}" + else + Echo_warning "Excluded path does not exist: %s" "${EXCLUDE}" + fi + done +fi + +if [ -n "${LH_ROOT_COMMAND}" ] +then + ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot +fi + +# Creating stage file +Create_stagefile .stage/binary_chroot diff --git a/helpers/binary_debian-installer b/helpers/binary_debian-installer new file mode 100755 index 000000000..cb1af389c --- /dev/null +++ b/helpers/binary_debian-installer @@ -0,0 +1,680 @@ +#!/bin/sh + +# lh_binary_debian-installer(1) - install debian-installer into binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'install debian-installer into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + +if [ "${_DEBUG}" = "true" ] +then + WGET_OPTIONS="${WGET_OPTIONS} --verbose" +elif [ "${_QUIET}" = "true" ] +then + WGET_OPTIONS="${WGET_OPTIONS} --quiet" +else + WGET_OPTIONS="${WGET_OPTIONS} --no-verbose" +fi + +# Check d-i configuration +case "${LH_DEBIAN_INSTALLER}" in + true|cdrom|netinst|netboot|businesscard|live) + ;; + + false) + exit 0 + ;; + + *) + Echo_error "debian-installer flavour %s not supported." "${LH_DEBIAN_INSTALLER}" + exit 1 + ;; +esac + +Echo_message "Begin installing debian-installer..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_debian-installer + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Checking depends +Check_package chroot/usr/bin/wget wget +Check_package chroot/usr/bin/apt-ftparchive apt-utils + +# Restoring cache +Restore_cache cache/packages_binary + +# Installing depends +Install_package + +# Setting destination directory +case "${LH_BINARY_IMAGES}" in + net) + DESTDIR="tftpboot/debian-install/${LH_ARCHITECTURE}" + ;; + + tar|usb-hdd) + DESTDIR="binary/install" + ;; + + *) + DESTDIR="binary/install" + ;; +esac + +# Set d-i image type +case "${LH_DEBIAN_INSTALLER}" in + businesscard|netboot|netinst) + DI_IMAGE_TYPE="netboot" + ;; + *) + case "${LH_BINARY_IMAGES}" in + net) + DI_IMAGE_TYPE="netboot" + ;; + + *) + DI_IMAGE_TYPE="cdrom" + ;; + esac + ;; +esac + +# Set architecture-specific variables +case "${LH_ARCHITECTURE}" in + powerpc) + case "${DI_IMAGE_TYPE}" in + cdrom) + DI_REMOTE_BASE="${LH_ARCHITECTURE}/cdrom" + ;; + + netboot) + DI_REMOTE_BASE="${LH_ARCHITECTURE}/netboot" + ;; + esac + + DI_REMOTE_KERNEL="vmlinux" + DI_REMOTE_BASE_GTK="${DI_REMOTE_BASE}/gtk" + ;; + + sparc) + DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" + DI_REMOTE_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})" + DI_REMOTE_BASE_GTK="none" + + DI_REMOTE_BASE="cdrom" + ;; + *) + case "${DI_IMAGE_TYPE}" in + netboot) + DI_REMOTE_BASE="netboot/debian-installer/${LH_ARCHITECTURE}" + DI_REMOTE_BASE_GTK="netboot/gtk/debian-installer/${LH_ARCHITECTURE}" + DI_REMOTE_KERNEL="linux" + ;; + + cdrom) + DI_REMOTE_BASE="cdrom" + DI_REMOTE_BASE_GTK="cdrom/gtk" + DI_REMOTE_KERNEL="vmlinuz" + ;; + esac + ;; +esac + +Check_multiarchitecture + +Install_file() { + local FILE + FILE="${1}" + + local TARGET + TARGET="${2}" + + SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')" + + if [ -z "${SOURCE}" ] + then + SOURCE="$(basename ${FILE} | awk -F_ '{ print $1 }')" + fi + + case "${SOURCE}" in + lib?*) + LETTER="$(echo ${SOURCE} | sed 's|\(....\).*|\1|')" + ;; + + *) + LETTER="$(echo ${SOURCE} | sed 's|\(.\).*|\1|')" + ;; + esac + + # Install directory + mkdir -p "${TARGET}"/"${LETTER}"/"${SOURCE}" + + # Move files + cp "${FILE}" "${TARGET}"/"${LETTER}"/"${SOURCE}" +} + +# Set absolute directory for caching; we require it when we call Download_file +# from a non-standard cwd. +_LH_CACHE_DIR="$(pwd)/cache/binary_debian-installer" + +Download_file () { + local _LH_TARGET + _LH_TARGET="${1}" + + local _LH_URL + _LH_URL="${2}" + + _LH_CACHE_FILE="${_LH_CACHE_DIR}/$(echo "${_LH_URL}" | sed 's|/|_|g')" + + if [ ! -f "${_LH_CACHE_FILE}" ] + then + mkdir -p ${_LH_CACHE_DIR} + if ! wget ${WGET_OPTIONS} -O "${_LH_CACHE_FILE}" "${_LH_URL}" + then + rm -f "${_LH_CACHE_FILE}" + + Echo_error "Could not download file: %s" "${_LH_URL}" + exit 1 + fi + fi + + if [ "$(stat --printf %d "${_LH_CACHE_DIR}")" = "$(stat --printf %d ./)" ] + then + CP_OPTIONS="-l" + fi + + cp -f ${CP_OPTIONS} -- "${_LH_CACHE_FILE}" "${_LH_TARGET}" +} + +VMLINUZ_DI="vmlinuz" +INITRD_DI="initrd.gz" +DESTDIR_DI="${DESTDIR}" + +VMLINUZ_GI="gtk/vmlinuz" +INITRD_GI="gtk/initrd.gz" +DESTDIR_GI="${DESTDIR}/gtk" + +if [ "${LH_DEBIAN_INSTALLER_DISTRIBUTION}" = "daily" ] +then + LH_DEBIAN_INSTALLER_DISTRIBUTION="sid" + + # Debian Installer daily builds + case "${LH_ARCHITECTURE}" in + alpha|amd64|hppa|ia64|mips|mipsel|powerpc) + URL="http://d-i.debian.org/daily-images/${LH_ARCHITECTURE}/daily/" + ;; + + arm|armel) + URL="http://people.debian.org/~kmuto/d-i/images/daily/" + ;; + + i386) + URL="http://people.debian.org/~joeyh/d-i/images/daily/" + ;; + + m68k) + URL="http://people.debian.org/~smarenka/d-i/images-m68k/daily/" + ;; + + s390) + URL="http://lophos.multibuild.org/d-i/images/daily/" + ;; + + sparc) + URL="http://people.debian.org/~stappers/d-i/images/daily/" + ;; + + *) + Echo_error "No daily-builds found for your architecture." + exit 1 + ;; + esac +else + URL="${LH_MIRROR_CHROOT}/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/installer-${LH_ARCHITECTURE}/current/images/" +fi + +mkdir -p "${DESTDIR_DI}" + +if [ "${LH_ARCHITECTURE}" = "sparc" ] && [ "${DI_IMAGE_TYPE}" = "netboot" ] +then + # There are no prepared kernel/initrd pairs for sparc netboot so we + # must unpack them from a mini.iso + Download_file mini.iso ${URL}/mini.iso + + mkdir mini.tmp + ${LH_ROOT_COMMAND} mount -o loop -t iso9660 mini.iso mini.tmp + + cp mini.tmp/boot/vmlinuz-${DEFAULT_FLAVOUR} "${DESTDIR}"/"${VMLINUZ_DI}" + cp mini.tmp/boot/initrd.gz "${DESTDIR}"/"${INITRD_DI}" + + ${LH_ROOT_COMMAND} umount mini.tmp + rm -rf mini.tmp mini.iso +else + # Downloading debian-installer + Download_file "${DESTDIR}"/"${VMLINUZ_DI}" ${URL}/${DI_REMOTE_BASE}/${DI_REMOTE_KERNEL} + Download_file "${DESTDIR}"/"${INITRD_DI}" ${URL}/${DI_REMOTE_BASE}/initrd.gz + + # Downloading graphical-installer + DOWNLOAD_GTK_INSTALLER=0 + if [ "${LH_DEBIAN_INSTALLER_GUI}" = "true" ] + then + case "${LH_ARCHITECTURE}" in + amd64|i386) + DOWNLOAD_GTK_INSTALLER=1 + ;; + + powerpc) + if [ "${LH_DEBIAN_INSTALLER}" = "netboot" ] + then + DOWNLOAD_GTK_INSTALLER=1 + fi + ;; + esac + fi + + if [ ${DOWNLOAD_GTK_INSTALLER} -eq 1 ] + then + mkdir -p "${DESTDIR_GI}" + Download_file "${DESTDIR}"/"${VMLINUZ_GI}" ${URL}/${DI_REMOTE_BASE_GTK}/${DI_REMOTE_KERNEL} + Download_file "${DESTDIR}"/"${INITRD_GI}" ${URL}/${DI_REMOTE_BASE_GTK}/initrd.gz + fi +fi + +# Only download additional packages if appropriate +if [ "${DI_IMAGE_TYPE}" != "netboot" ] +then + # Downloading additional packages + mkdir -p chroot/binary.deb/archives/partial + mkdir -p binary/pool/main + mv chroot/var/lib/dpkg/status chroot/var/lib/dpkg/status.tmp + touch chroot/var/lib/dpkg/status + + case "${LH_ARCHITECTURE}" in + amd64) + DI_REQ_PACKAGES="lilo grub" + + case "${LH_MODE}" in + ubuntu) + DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-generic" + ;; + + *) + DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-amd64" + ;; + esac + ;; + + i386) + DI_REQ_PACKAGES="elilo lilo grub" + + case "${LH_MODE}" in + ubuntu) + DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-generic" + ;; + + *) + DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-486 linux-image-2.6-686" + ;; + esac + ;; + + sparc) + DI_REQ_PACKAGES="silo" + DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-sparc64 linux-image-2.6-sparc64-smp" + ;; + + powerpc) + DI_REQ_PACKAGES="yaboot" + DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-powerpc linux-image-2.6-powerpc64 linux-image-2.6-powerpc-smp" + ;; + esac + + DI_PACKAGES="${DI_PACKAGES} busybox cryptsetup lvm2" + + # Set apt command prefix + _LH_APT_COMMAND="apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb -o APT::Install-Recommends=false --download-only" + + if [ "${LH_DEBIAN_INSTALLER}" = "live" ] + then + # We don't want to duplicate .debs of packages in binary/pool that are already + # installed to target/ via live-installer. + # + # However, we need to force various packages' inclusion in binary/pool/main as + # d-i does not support (for example) re-installing grub from target/ - the grub + # .debs must actually exist. + + # Modify dpkg status to show the required packages are not installed. + cp chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status + for PACKAGE in ${DI_REQ_PACKAGES} + do + awk -v f=0 ' + f == 1 { print "Status: purge ok not-installed"; f=0; next } + /Package: '"${PACKAGE}"'/ { f=1; } + { print } + ' chroot/var/lib/dpkg/status > chroot/var/lib/dpkg/status.awk + mv chroot/var/lib/dpkg/status.awk chroot/var/lib/dpkg/status + done + + # Download .deb's that we just marked as "purged" which caused broken dependencies + Chroot chroot ${_LH_APT_COMMAND} -f dist-upgrade + + # Revert dpkg status file + mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status + + # Download .debs of the required packages + Chroot chroot ${_LH_APT_COMMAND} install ${DI_REQ_PACKAGES} + else + # Download .debs of the required packages + Chroot chroot ${_LH_APT_COMMAND} install ${DI_PACKAGES} + + # Revert dpkg status file + mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status + fi + + mv chroot/binary.deb ./ + + if Find_files binary.deb/archives/*.deb + then + for FILE in binary.deb/archives/*.deb + do + Install_file "${FILE}" "binary/pool/main" + done + fi + + if [ "${LH_DEBIAN_INSTALLER}" != "live" ] + then + # Including base debian packages + if [ -d cache/packages_bootstrap ] + then + for FILE in cache/packages_bootstrap/*.deb + do + Install_file "${FILE}" "binary/pool/main" + done + else + Echo_error "Could not find cache/packages_bootstrap." + Echo_error "You selected values of LH_CACHE, LH_CACHE_PACKAGES, LH_CACHE_STAGES and LH_DEBIAN_INSTALLER which will result in 'bootstrap' packages not being cached - these are required when integrating the Debian Installer." + exit 1 + fi + fi + + # Including local debs + if Find_files config/binary_local-debs/*_"${LH_ARCHITECTURE}".deb + then + for FILE in config/binary_local-debs/*_"${LH_ARCHITECTURE}".deb + do + Install_file "${FILE}" "binary/pool/main" + done + fi + + if Find_files config/binary_local-debs/*_all.deb + then + for FILE in config/binary_local-debs/*_all.deb + do + Install_file "${FILE}" "binary/pool/main" + done + fi + + # Generating deb indices + mkdir -p binary/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE} + + mv binary chroot/root + echo "cd /root/binary && apt-ftparchive packages pool/main > dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages" > chroot/binary.sh + Chroot chroot "sh binary.sh" + rm -f chroot/binary.sh + mv chroot/root/binary ./ + + gzip -9 -c binary/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages > binary/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages.gz + + # Fetching release + Download_file binary/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Release "${LH_MIRROR_CHROOT}"/dists/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/main/binary-"${LH_ARCHITECTURE}"/Release + + mkdir binary.udeb + cd binary.udeb + + # Downloading udeb indices + Download_file Packages.gz "${LH_MIRROR_CHROOT}"/dists/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LH_ARCHITECTURE}"/Packages.gz + gunzip -c Packages.gz > Packages + + # Sorting udebs + UDEBS="$(awk '/Filename: / { print $2 }' Packages)" + + # Downloading udebs + for UDEB in ${UDEBS} + do + if [ -f ../cache/packages_debian-installer.udeb/"$(basename ${UDEB})" ] + then + # Copying cached udebs + cp ../cache/packages_debian-installer.udeb/"$(basename ${UDEB})" ./ + else + # Downloading udebs + wget ${WGET_OPTIONS} "${LH_MIRROR_CHROOT}"/${UDEB} + fi + done + + # Caching udebs + rm -rf ../cache/packages_debian-installer.udeb + mkdir -p ../cache/packages_debian-installer.udeb + cp *.udeb ../cache/packages_debian-installer.udeb + + # Including local udebs + if Find_files ../config/binary_local-udebs/*_"${LH_ARCHITECTURE}".udeb + then + for FILE in ../config/binary_local-udebs/*_"${LH_ARCHITECTURE}".udeb + do + Install_file "${FILE}" "pool/main" + + # Prefer local udebs over downloaded udebs + rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb + done + fi + + if Find_files ../config/binary_local-udebs/*_all.udeb + then + for FILE in ../config/binary_local-udebs/*_all.udeb + do + Install_file "${FILE}" "pool/main" + + # Prefer local udebs over downloaded udebs + rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb + done + fi + + # Excluding udebs + grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/udeb_exclude > exclude || true + grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/exclude-udebs >> exclude || true + grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/exclude-udebs-${LH_ARCHITECTURE} >> exclude || true + + # Local exclude file + if [ -e ../config/binary_debian-installer/udeb_exclude ] + then + cat ../config/binary_debian-installer/udeb_exclude >> exclude + fi + + # Excluding udebs from excludes because we want them to be in the image on purpose + sed -i -e 's|di-utils-exit-installer||' exclude # used for live-installer-launcher + + while read EXCLUDE + do + if [ "${LH_DEBIAN_INSTALLER}" = "live" ] && [ "${EXCLUDE}" = "live-installer" ] + then + continue + fi + + rm -f ${EXCLUDE}_*.udeb + done < exclude + + # Enable live-installer + if [ "${LH_DEBIAN_INSTALLER}" = "live" ] + then + # Remove local udebs + rm -f pool/main/b/base-installer/bootstrap-base_*.udeb + + # Remove d-i udebs + rm -f bootstrap-base_*.udeb + fi + + # Moving udebs + for UDEB in ${UDEBS} + do + if [ -f "$(basename ${UDEB})" ] + then + mkdir -p $(dirname ${UDEB}) + mv "$(basename ${UDEB})" "$(dirname ${UDEB})" + fi + done + + # Creating udeb indices + mkdir -p dists/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LH_ARCHITECTURE}" + cd "${OLDPWD}" + + mv binary.udeb chroot/root + echo "cd /root/binary.udeb && apt-ftparchive packages pool/main > dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LH_ARCHITECTURE}/Packages" > chroot/binary.sh + Chroot chroot "sh binary.sh" + rm -f chroot/binary.sh + mv chroot/root/binary.udeb ./ + + cd binary.udeb + gzip -9 -c dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LH_ARCHITECTURE}/Packages > dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LH_ARCHITECTURE}/Packages.gz + + rm -f Packages* exclude + find . | cpio -dmpu "${OLDPWD}"/binary + cd "${OLDPWD}" + + rm -rf binary.udeb + rm -rf binary.deb + + # Generating release file + mv binary chroot/root + +cat > chroot/binary.sh << EOF +cd /root/binary && apt-ftparchive \ + -o APT::FTPArchive::Release::Origin="Debian" \ + -o APT::FTPArchive::Release::Label="Debian" \ + -o APT::FTPArchive::Release::Suite="${LH_DEBIAN_INSTALLER_DISTRIBUTION}" \ + -o APT::FTPArchive::Release::Version="4.0" \ + -o APT::FTPArchive::Release::Codename="${LH_DEBIAN_INSTALLER_DISTRIBUTION}" \ + -o APT::FTPArchive::Release::Date="$(date -R)" \ + -o APT::FTPArchive::Release::Architectures="${LH_ARCHITECTURE}" \ + -o APT::FTPArchive::Release::Components="main" \ + -o APT::FTPArchive::Release::Description="Last updated: $(date -R)" \ + release dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION} > dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/Release +EOF + + Chroot chroot "sh binary.sh" + rm -f chroot/binary.sh + mv chroot/root/binary ./ + + # Creating dist symlinks + for DISTRIBUTION in frozen stable testing unstable + do + ln -s ${LH_DEBIAN_INSTALLER_DISTRIBUTION} binary/dists/${DISTRIBUTION} + done + + if [ "${LH_BINARY_IMAGES}" != "usb-hdd" ] + then + ln -s . binary/debian + fi + + # Including preseeding files + if Find_files config/binary_debian-installer/*.cfg + then + cp config/binary_debian-installer/*.cfg binary/install + fi +fi + +Repack_initrd() +{ + local TARGET_INITRD + local INCLUDE_PATH + TARGET_INITRD="${1}" + INCLUDE_PATH="${2}" + REPACK_TMPDIR="unpacked-initrd" + + if [ -d "${INCLUDE_PATH}" ] + then + INCLUDE_PATH=$(readlink -f ${INCLUDE_PATH}) + fi + + # cpio does not have a "extract to directory", so we must change directory + mkdir -p ${REPACK_TMPDIR} + cd ${REPACK_TMPDIR} + + gzip -d < ../${TARGET_INITRD} | cpio -i --make-directories --no-absolute-filenames + if [ ! -d "${INCLUDE_PATH}" ] + then + # Invoked the old way, just copy the preseeds + cp ../config/binary_debian-installer/*.cfg . + else + # New way, include target directory content in the initrd + REPACK_TMPDIR_ABS="${PWD}" + cd "${INCLUDE_PATH}" + find -print0 | cpio -pumd0 --no-preserve-owner "${REPACK_TMPDIR_ABS}/" + cd "${OLDPWD}" + fi + find -print0 | cpio -H newc -o0 | gzip -9 > ../${TARGET_INITRD} + + cd .. + rm -rf ${REPACK_TMPDIR} +} + +# Preseed d-i by repacking the initrd in certain situations +if [ "${DI_IMAGE_TYPE}" = "netboot" ] && [ -e config/binary_debian-installer/preseed.cfg ] +then + Repack_initrd "${DESTDIR}"/"${INITRD_DI}" + + if [ -e "${DESTDIR}"/"${INITRD_GI}" ] + then + Repack_initrd "${DESTDIR}"/"${INITRD_GI}" + fi +fi + +# Include content of config/binary_debian-installer-includes if exists and not empty +if [ -d config/binary_debian-installer-includes ] && [ -n "$(ls -A config/binary_debian-installer-includes)" ] +then + Repack_initrd "${DESTDIR}"/"${INITRD_DI}" config/binary_debian-installer-includes + + if [ -e "${DESTDIR}"/"${INITRD_GI}" ] + then + Repack_initrd "${DESTDIR}"/"${INITRD_GI}" config/binary_debian-installer-includes + fi +fi + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/binary_debian-installer diff --git a/helpers/binary_disk b/helpers/binary_disk new file mode 100755 index 000000000..2bbd73d98 --- /dev/null +++ b/helpers/binary_disk @@ -0,0 +1,137 @@ +#!/bin/sh + +# lh_binary_disk (1) - install disk information into binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'install disk information into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +case "${LH_BINARY_IMAGES}" in + iso|usb-hdd) + ;; + *) + exit 0 + ;; +esac + +Echo_message "Begin installing disk information..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_disk + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +mkdir -p binary/.disk + +ARCHITECTURE="$(echo ${LH_ARCHITECTURE} | sed -e 's| |/|g')" +DISTRIBUTION="$(echo ${LH_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')" +DISTRIBUTION="${DISTRIBUTION}$(echo ${LH_DISTRIBUTION} | cut -b 2-)" +eval VERSION="$`echo RELEASE_${LH_DISTRIBUTION}`" + +TITLE="Debian GNU/Linux" +case "${LH_MODE}" in + debian) + STRING="Official Snapshot ${ARCHITECTURE}" + TRACE="project/trace/ftp-master.debian.org" + ;; + + debian-release) + STRING="Official ${ARCHITECTURE}" + TRACE="project/trace/ftp-master.debian.org" + ;; + + ubuntu) + TITLE="Ubuntu GNU/Linux" + STRING="Build ${ARCHITECTURE}" + TRACE="" + ;; + + *) + STRING="Snapshot ${ARCHITECTURE}" + TRACE="" + ;; +esac + +if [ -n "${TRACE}" ] +then + echo "$(wget -q ${LH_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \ + > binary/.disk/archive_trace +fi + +case "${LH_DEBIAN_INSTALLER}" in + cdrom) + echo "main" > binary/.disk/base_components + + touch binary/.disk/base_installable + + echo "full_cd" > binary/.disk/cd_type + + echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/CD Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info + + cp "${LH_BASE}"/data/debian-cd/${LH_DISTRIBUTION}/${LH_ARCHITECTURE}_udeb_include binary/.disk/udeb_include + ;; + + true|netinst|live) + echo "main" > binary/.disk/base_components + + touch binary/.disk/base_installable + + echo "not_complete" > binary/.disk/cd_type + + if [ "${LH_DEBIAN_INSTALLER}" = "live" ] + then + echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/INSTALL Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info + else + echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/NETINST Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info + + fi + + cp "${LH_BASE}"/data/debian-cd/${LH_DISTRIBUTION}/${LH_ARCHITECTURE}_netinst_udeb_include binary/.disk/udeb_include + + if [ "${LH_DEBIAN_INSTALLER}" = "live" ] + then + echo "live-installer" >> binary/.disk/udeb_include + fi + ;; + + businesscard) + echo "main" > binary/.disk/base_components + + echo "not_complete" > binary/.disk/cd_type + + echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/BC Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info + + cp "${LH_BASE}"/data/debian-cd/${LH_DISTRIBUTION}/${LH_ARCHITECTURE}_businesscard_udeb_include binary/.disk/udeb_include + ;; + + false) + echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info + ;; +esac + +# Creating stage file +Create_stagefile .stage/binary_disk diff --git a/helpers/binary_encryption b/helpers/binary_encryption new file mode 100755 index 000000000..2990afa79 --- /dev/null +++ b/helpers/binary_encryption @@ -0,0 +1,146 @@ +#!/bin/sh + +# lh_binary_encryption(1) - encrypts rootfs +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'encrypts rootfs')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + +case "${LH_ENCRYPTION}" in + aes128|aes192|aes256) + ;; + ""|false) + exit 0 + ;; + *) + Echo_error "Encryption type %s not supported." "${LH_ENCRYPTION}" + exit 1 + ;; +esac + +case "${LH_CHROOT_FILESYSTEM}" in + ext2|squashfs) + ;; + + *) + Echo_error "Encryption not yet supported on %s filesystems." "${LH_CHROOT_FILESYSTEM}" + exit 1 + ;; +esac + +Echo_message "Begin encrypting root filesystem image..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap .stage/binary_rootfs + +# Checking stage file +Check_stagefile .stage/binary_encryption + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +case "${LH_INITRAMFS}" in + casper) + INITFS="casper" + ;; + + live-initramfs) + INITFS="live" + ;; +esac + +# Checking depends +Check_package chroot/usr/bin/aespipe aespipe + +# Restoring cache +Restore_cache cache/packages_binary + +# Installing depends +Install_package + +Echo_message "Encrypting binary/%s/filesystem.%s with %s..." "${INITFS}" "${LH_CHROOT_FILESYSTEM}" "${LH_ENCRYPTION}" + +if [ "${LH_CHROOT_BUILD}" = "true" ] +then + # Moving image + mv binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} chroot +fi + +while true +do + echo + echo " **************************************" + Echo " ** Configuring encrypted filesystem **" + echo " **************************************" + Echo " (Passwords must be at least 20 characters long)" + echo + + case "${LH_CHROOT_BUILD}" in + true) + if Chroot chroot aespipe -e ${LH_ENCRYPTION} -T \ + < chroot/filesystem.${LH_CHROOT_FILESYSTEM} \ + > chroot/filesystem.${LH_CHROOT_FILESYSTEM}.tmp + then + mv chroot/filesystem.${LH_CHROOT_FILESYSTEM}.tmp binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} + break + fi + ;; + false) + if aespipe -e ${LH_ENCRYPTION} -T \ + < binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} \ + > binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM}.tmp + then + mv binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM}.tmp binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} + break + fi + ;; + esac + + printf "\nThere was an error configuring encryption ... Retry? [Y/n] " + read ANSWER + + if [ "$(echo "${ANSWER}" | cut -b1 | tr A-Z a-z)" = "n" ] + then + unset ANSWER + break + fi +done + +# Cleanup temporary filesystems +rm -f chroot/filesystem.${LH_CHROOT_FILESYSTEM} +rm -f chroot/filesystem.${LH_CHROOT_FILESYSTEM}.tmp +rm -f binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM}.tmp + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/binary_encryption diff --git a/helpers/binary_grub b/helpers/binary_grub new file mode 100755 index 000000000..35fa43d43 --- /dev/null +++ b/helpers/binary_grub @@ -0,0 +1,339 @@ +#!/bin/sh + +# lh_binary_grub(1) - installs grub into binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'installs grub into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BOOTLOADER}" != "grub" ] +then + exit 0 +fi + +Echo_message "Begin installing grub..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_grub + +# Checking grub templates +Check_templates grub + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Check architecture +Check_architecture amd64 i386 +Check_crossarchitecture + +# Checking depends +Check_package chroot/usr/sbin/grub grub + +# Restoring cache +Restore_cache cache/packages_binary + +# Installing depends +Install_package + +# Local functions +Grub_live_entry () +{ + LABEL="${1}" + KERNEL="${2}" + INITRD="${3}" + APPEND="${4}" + + LINUX_LIVE="${LINUX_LIVE}\ntitle\t\tDebian GNU/Linux - ${LABEL}" + LINUX_LIVE="${LINUX_LIVE}\nkernel\t\t/${KERNEL} boot=${INITFS} LH_BOOTAPPEND_LIVE ${APPEND}" + LINUX_LIVE="${LINUX_LIVE}\ninitrd\t\t/${INITRD}" +} + +Grub_install_entry () +{ + LABEL="${1}" + KERNEL="${2}" + INITRD="${3}" + APPEND="${4}" + + QAPPEND="quiet" + + for TYPE in Install Expert Rescue Auto + do + case "${TYPE}" in + Install) + TAPPEND="${APPEND} ${QAPPEND}" + ;; + + Expert) + TAPPEND="priority=low ${APPEND}" + ;; + + Rescue) + TAPPEND="rescue/enable=true ${APPEND} ${QAPPEND}" + ;; + + Auto) + TAPPEND="auto=true priority=critical ${APPEND} ${QAPPEND}" + ;; + esac + + case "${LABEL}" in + Text) + TYPE_SUFFIX="" + ;; + GUI) + TYPE_SUFFIX="gui" + ;; + esac + + + LINUX_INSTALL="${LINUX_INSTALL}\ntitle\t\t${LABEL} ${TYPE}" + LINUX_INSTALL="${LINUX_INSTALL}\nkernel\t\t/${KERNEL} ${TAPPEND} ${LH_BOOTAPPEND_INSTALL}" + LINUX_INSTALL="${LINUX_INSTALL}\ninitrd\t\t/${INITRD}" + done +} + +case "${LH_INITRAMFS}" in + casper) + INITFS="casper" + ;; + + live-initramfs) + INITFS="live" + ;; +esac + +# Setting destination directory +case "${LH_BINARY_IMAGES}" in + iso|tar) + case "${LH_INITRAMFS}" in + casper) + DESTDIR_LIVE="binary/casper" + ;; + + live-initramfs) + DESTDIR_LIVE="binary/live" + ;; + esac + + DESTDIR_INSTALL="binary/install" + ;; + + usb-hdd|net) + Echo_warning "Bootloader in this image type not yet supported by live-helper." + Echo_warning "This would produce a not bootable image, aborting (FIXME)." + exit 1 + ;; +esac + +Check_multiarchitecture + +# Creating directory +mkdir -p "${DESTDIR_LIVE}" + +# Setting boot parameters + +case "${LH_ENCRYPTION}" in + ""|false) + ;; + *) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} encryption=${LH_ENCRYPTION}" +esac + +if [ -n "${LH_USERNAME}" ] +then + case "${LH_INITRAMFS}" in + casper) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" + ;; + + live-initramfs) + if [ "${LH_USERNAME}" != "user" ] + then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" + fi + ;; + esac +fi + +if [ -n "${LH_HOSTNAME}" ] +then + case "${LH_INITRAMFS}" in + casper) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" + ;; + + live-initramfs) + if [ "${LH_HOSTNAME}" != "debian" ] + then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" + fi + ;; + esac +fi + +if [ "${LH_UNION_FILESYSTEM}" != "unionfs" ] +then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}" +fi + +if [ -n "${LH_NET_COW_PATH}" ] +then + Echo_error "Net cow not yet supported on grub" + exit 1 +fi + +if [ "${LH_EXPOSED_ROOT}" != "false" ] +then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} exposedroot" +fi + +LH_BOOTAPPEND_LIVE="$(echo ${LH_BOOTAPPEND_LIVE} | sed -e 's| ||')" + +# Parameters are listed at: linux/Documentation/kernel-parameters.txt +FAILSAFE="noapic noapm nodma nomce nolapic nosmp vga=normal" + +# Assembling kernel configuration + +# Default entries +DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" +DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})" +DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinuz-||')" + +Grub_live_entry "live" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" +Grub_live_entry "live (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" "${FAILSAFE}" + +for KERNEL in chroot/boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + Grub_live_entry "live, kernel ${VERSION}" "$(basename ${DESTDIR_LIVE})/$(basename ${KERNEL})" "$(basename ${DESTDIR_LIVE})/initrd.img-${VERSION}" + Grub_live_entry "live, kernel ${VERSION} (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/$(basename ${KERNEL})" "$(basename ${DESTDIR_LIVE})/initrd.img-${VERSION}" "${FAILSAFE}" +done + +LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" + +# Assembling debian-installer configuration +if [ "${LH_DEBIAN_INSTALLER}" != "false" ] +then + LINUX_LIVE="title\t\tLive:\nroot\n\n${LINUX_LIVE}" + LINUX_INSTALL="title\t\tInstaller:\nroot" + + VMLINUZ_DI="install/vmlinuz" + INITRD_DI="install/initrd.gz" + APPEND_DI="vga=normal" + + VMLINUZ_GI="install/gtk/vmlinuz" + INITRD_GI="install/gtk/initrd.gz" + APPEND_GI="video=vesa:ywrap,mtrr vga=788" + + if [ -f "binary/boot/${VMLINUZ_DI}" ] && [ -f "binary/boot/${INITRD_DI}" ] + then + Grub_install_entry "Text" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" + fi + + if [ -f "binary/boot/${VMLINUZ_GI}" ] && [ -f "binary/boot/${INITRD_GI}" ] + then + Grub_install_entry "GUI" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}" + fi +fi + +LINUX_INSTALL="$(/bin/echo ${LINUX_INSTALL} | sed -e 's|binary||g' -e 's|//|/|g')" + +# Assembling memtest configuration +if [ -f "${DESTDIR_LIVE}"/memtest ] +then + MEMTEST="title\t\tOther:\nroot" + MEMTEST="${MEMTEST}\n\ntitle\t\t${LH_MEMTEST}\nkernel\t\t/$(basename ${DESTDIR_LIVE})/memtest" + MEMTEST="$(/bin/echo ${MEMTEST} | sed -e 's|//|/|g')" +fi + +# Copying templates +mkdir -p binary/boot/grub +cp -r "${TEMPLATES}"/* binary/boot/grub + +case ${LH_BINARY_IMAGES} in + iso) + FILES="chroot/usr/lib/grub/*/stage2_eltorito" + ;; + + tar|usb-hdd) + FILES="chroot/usr/lib/grub/*/stage1 chroot/usr/lib/grub/*/e2fs_stage1_5 chroot/usr/lib/grub/*/stage2" + ;; +esac + +if [ "${LH_CHROOT_BUILD}" = "false" ] +then + FILES="$(echo ${FILES} | sed -e 's|chroot||g')" +fi + +# Copying grub +cp ${FILES} binary/boot/grub + +# Copying local configuration file +if [ -f config/binary_grub/menu.lst ] +then + cp config/binary_grub/menu.lst binary/boot/grub/menu.lst +fi + +# Copying splash screen +if [ -f config/binary_grub/splash.xpm.gz ] +then + LH_GRUB_SPLASH="config/binary_grub/splash.xpm.gz" +elif [ -f config/binary_grub/splash.xpm ] +then + LH_GRUB_SPLASH="config/binary_grub/splash.xpm" +fi + +if [ -n "${LH_GRUB_SPLASH}" ] +then + if [ "${LH_GRUB_SPLASH}" = "none" ] + then + # Removing splash file + rm -f binary/boot/grub/splash.xpm.gz + + # Removing splash entry + sed -i -e "s|splashimage.*||" binary/boot/grub/menu.lst + else + # Overwriting splash file + cp -f "${LH_GRUB_SPLASH}" binary/boot/grub + sed -i -e "s|splashimage.*|splashimage /boot/grub/$(basename ${LH_GRUB_SPLASH})|" binary/boot/grub/menu.lst + fi +fi + +sed -i -e "s|LINUX_LIVE|${LINUX_LIVE}|" -e "s|LINUX_INSTALL|${LINUX_INSTALL}|" -e "s|MEMTEST|${MEMTEST}|" binary/boot/grub/menu.lst +sed -i -e "s|LH_BOOTAPPEND_INSTALL|${LH_BOOTAPPEND_INSTALL}|" -e "s|LH_BOOTAPPEND_LIVE|${LH_BOOTAPPEND_LIVE}|" binary/boot/grub/menu.lst + +sed -i -e 's|\ $||g' binary/boot/grub/menu.lst + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/binary_grub diff --git a/helpers/binary_grub2 b/helpers/binary_grub2 new file mode 100755 index 000000000..76b93734c --- /dev/null +++ b/helpers/binary_grub2 @@ -0,0 +1,309 @@ +#!/bin/sh + +# lh_binary_grub2(1) - installs grub2 into binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'installs grub2 into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BOOTLOADER}" != "grub2" ] +then + exit 0 +fi + +Echo_message "Begin installing grub2..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_grub + +# Checking grub2 templates +Check_templates grub2 + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Check architecture +Check_architecture amd64 i386 +Check_crossarchitecture + +# Checking depends +Check_package chroot/usr/bin/grub-mkimage grub-pc + +# Restoring cache +Restore_cache cache/packages_binary + +# Installing depends +Install_package + +# Local functions +Grub_live_entry () +{ + LABEL="${1}" + KERNEL="${2}" + INITRD="${3}" + APPEND="${4}" + + LINUX_LIVE="${LINUX_LIVE}\nmenuentry \"Debian GNU/Linux - ${LABEL}\" {" + LINUX_LIVE="${LINUX_LIVE}\nlinux\t\t/${KERNEL} boot=${INITFS} LH_BOOTAPPEND_LIVE ${APPEND}" + LINUX_LIVE="${LINUX_LIVE}\ninitrd\t\t/${INITRD}" + LINUX_LIVE="${LINUX_LIVE}\n}" +} + +Grub_install_entry () +{ + LABEL="${1}" + KERNEL="${2}" + INITRD="${3}" + APPEND="${4}" + + if [ "${LABEL}" != "rescue" ] && [ "${LABEL}" != "rescuegui" ] + then + APPEND="${APPEND} quiet" + fi + + LINUX_INSTALL="${LINUX_INSTALL}\nmenuentry \"Debian GNU/Linux - ${LABEL}\" {" + LINUX_INSTALL="${LINUX_INSTALL}\nlinux\t\t/${KERNEL} ${APPEND} LH_BOOTAPPEND_INSTALL" + LINUX_INSTALL="${LINUX_INSTALL}\ninitrd\t\t/${INITRD}" + LINUX_INSTALL="${LINUX_INSTALL}\n}" +} + +case "${LH_INITRAMFS}" in + casper) + INITFS="casper" + ;; + + live-initramfs) + INITFS="live" + ;; +esac + +# Setting destination directory +case "${LH_BINARY_IMAGES}" in + iso|tar) + case "${LH_INITRAMFS}" in + casper) + DESTDIR_LIVE="binary/casper" + ;; + + live-initramfs) + DESTDIR_LIVE="binary/live" + ;; + esac + + DESTDIR_INSTALL="binary/install" + ;; + + usb-hdd|net) + Echo_warning "Bootloader in this image type not yet supported by live-helper." + Echo_warning "This would produce a not bootable image, aborting (FIXME)." + exit 1 + ;; +esac + +Check_multiarchitecture + +# Creating directory +mkdir -p "${DESTDIR_LIVE}" + +# Setting boot parameters + +case "${LH_ENCRYPTION}" in + ""|false) + ;; + *) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} encryption=${LH_ENCRYPTION}" +esac + +if [ -n "${LH_USERNAME}" ] +then + case "${LH_INITRAMFS}" in + casper) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" + ;; + + live-initramfs) + if [ "${LH_USERNAME}" != "user" ] + then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" + fi + ;; + esac +fi + +if [ -n "${LH_HOSTNAME}" ] +then + case "${LH_INITRAMFS}" in + casper) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" + ;; + + live-initramfs) + if [ "${LH_HOSTNAME}" != "debian" ] + then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" + fi + ;; + esac +fi + +if [ "${LH_UNION_FILESYSTEM}" != "unionfs" ] +then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}" +fi + +if [ -n "${LH_NET_COW_PATH}" ] +then + Echo_error "Net cow not yet supported on grub" + exit 1 +fi + +if [ "${LH_EXPOSED_ROOT}" != "false" ] +then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} exposedroot" +fi + +LH_BOOTAPPEND_LIVE="$(echo ${LH_BOOTAPPEND_LIVE} | sed -e 's| ||')" + +# Parameters are listed at: linux/Documentation/kernel-parameters.txt +FAILSAFE="noapic noapm nodma nomce nolapic nosmp vga=normal" + +# Assembling kernel configuration + +# Default entries +DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" +DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})" +DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinuz-||')" + +Grub_live_entry "live" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" +Grub_live_entry "live (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" "${FAILSAFE}" + +for KERNEL in chroot/boot/vmlinuz-* +do + VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" + + Grub_live_entry "live, kernel ${VERSION}" "$(basename ${DESTDIR_LIVE})/$(basename ${KERNEL})" "$(basename ${DESTDIR_LIVE})/initrd.img-${VERSION}" + Grub_live_entry "live, kernel ${VERSION} (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/$(basename ${KERNEL})" "$(basename ${DESTDIR_LIVE})/initrd.img-${VERSION}" "${FAILSAFE}" +done + +LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" + +# Assembling debian-installer configuration +if [ "${LH_DEBIAN_INSTALLER}" != "false" ] +then + LINUX_LIVE="#\t \"Live\"\n${LINUX_LIVE}" + LINUX_INSTALL="#\t \"Installer\"\n" + + VMLINUZ_DI="install/vmlinuz" + INITRD_DI="install/initrd.gz" + APPEND_DI="vga=normal" + + VMLINUZ_GI="install/gtk/vmlinuz" + INITRD_GI="install/gtk/initrd.gz" + APPEND_GI="video=vesa:ywrap,mtrr vga=788" + + Grub_install_entry "install" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" + Grub_install_entry "installgui" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}" + Grub_install_entry "expert" "${VMLINUZ_DI}" "${INITRD_DI}" "priority=low ${APPEND_DI}" + Grub_install_entry "expertgui" "${VMLINUZ_GI}" "${INITRD_GI}" "priority=low ${APPEND_GI}" + Grub_install_entry "rescue" "${VMLINUZ_DI}" "${INITRD_DI}" "rescue/enable=true ${APPEND_DI}" + Grub_install_entry "rescuegui" "${VMLINUZ_GI}" "${INITRD_GI}" "rescue/enable=true ${APPEND_GI}" + Grub_install_entry "auto" "${VMLINUZ_DI}" "${INITRD_DI}" "auto=true priority=critical ${APPEND_DI}" + Grub_install_entry "autogui" "${VMLINUZ_GI}" "${INITRD_GI}" "auto=true priority=critical ${APPEND_GI}" +fi + +LINUX_INSTALL="$(/bin/echo ${LINUX_INSTALL} | sed -e 's|binary||g' -e 's|//|/|g')" + +# Assembling memtest configuration +if [ -f "${DESTDIR_LIVE}"/memtest ] +then + MEMTEST="#\t \"Other\"\n" + MEMTEST="${MEMTEST}\nmenuentry\t\"${LH_MEMTEST}\" {\nlinux16\t$(basename ${DESTDIR_LIVE})/memtest\n}" + MEMTEST="$(/bin/echo ${MEMTEST} | sed -e 's|//|/|g')" +fi + +# Copying templates +mkdir -p binary/boot/grub +cp -r "${TEMPLATES}"/* binary/boot/grub + +case ${LH_BINARY_IMAGES} in + iso) + FILES="chroot/usr/lib/grub/i386-pc/*.mod chroot/usr/lib/grub/i386-pc/*.lst chroot/usr/lib/grub/i386-pc/efiemu??.o chroot/usr/share/grub/*.pf2" + ;; + + tar|usb-hdd) + FILES="chroot/usr/lib/grub/i386-pc/*" + ;; +esac + +if [ "${LH_CHROOT_BUILD}" = "false" ] +then + FILES="$(echo ${FILES} | sed -e 's|chroot||g')" +fi + +# Copying grub +cp ${FILES} binary/boot/grub + +# Copying local configuration file +if [ -f config/binary_grub/grub.cfg ] +then + cp config/binary_grub/grub.cfg binary/boot/grub/grub.cfg +fi + +# Copying splash screen +if [ -f config/binary_grub/splash.tga ] +then + LH_GRUB_SPLASH="config/binary_grub/splash.tga" +fi + +if [ -n "${LH_GRUB_SPLASH}" ] +then + if [ "${LH_GRUB_SPLASH}" = "none" ] + then + # Removing splash file + rm -f binary/boot/grub/splash.tga + + # Removing splash entry + sed -i -e "s|background_image.*||" binary/boot/grub/grub.cfg + else + # Overwriting splash file + cp -f "${LH_GRUB_SPLASH}" binary/boot/grub + sed -i -e "s|background_image .*.tga|background_image \$\(root\)/boot/grub/$(basename ${LH_GRUB_SPLASH})|" binary/boot/grub/grub.cfg + fi +fi + +sed -i -e "s|LINUX_LIVE|${LINUX_LIVE}|" -e "s|LINUX_INSTALL|${LINUX_INSTALL}|" -e "s|MEMTEST|${MEMTEST}|" binary/boot/grub/grub.cfg +sed -i -e "s|LH_BOOTAPPEND_INSTALL|${LH_BOOTAPPEND_INSTALL}|" -e "s|LH_BOOTAPPEND_LIVE|${LH_BOOTAPPEND_LIVE}|" binary/boot/grub/grub.cfg + +sed -i -e 's|\ $||g' binary/boot/grub/grub.cfg + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/binary_grub diff --git a/helpers/binary_includes b/helpers/binary_includes new file mode 100755 index 000000000..196f9027b --- /dev/null +++ b/helpers/binary_includes @@ -0,0 +1,166 @@ +#!/bin/sh + +# lh_binary_includes(1) - copy files into binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'copy files into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_INCLUDES}" = "none" ] +then + exit 0 +fi + +Echo_message "Begin copying binary includes..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_includes + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Check user includes +if [ ! -d "${LH_INCLUDES}" ] +then + if [ -d ../"${LH_INCLUDES}" ] + then + LH_INCLUDES="../${LH_INCLUDES}" + else + Echo_error "user specified includes not accessible in %s" "${LH_INCLUDES}" + exit 1 + fi +fi + +# Checking local includes +if [ -d config/includes/"${LH_DISTRIBUTION}" ] +then + LH_INCLUDES="config/includes" +fi + +# Assemble architecture +case "${LH_ARCHITECTURE}" in + amd64) + ARCH="amd" + ;; + + i386) + ARCH="386" + ;; + + powerpc) + ARCH="ppc" + ;; + + sparc) + ARCH="spa" + ;; +esac + +# Working arround vfat limitations +if [ "${LH_BINARY_IMAGE}" = "usb-hdd" ] +then + case "${LH_BINARY_FILESYSTEM}" in + fat*) + CP_OPTIONS="-L" + ;; + esac +fi + +# Copying common templates +if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common ] && \ +Find_files "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common/* +then + cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common/* binary +fi + +if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common."${ARCH}" ] && \ +Find_files "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common."${ARCH}"/* +then + cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common."${ARCH}"/* binary +fi + +# Copying live templates +if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live ] && \ +Find_files "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live/* +then + cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live/* binary +fi + +if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live."${ARCH}" ] && \ +Find_files "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live."${ARCH}"/* +then + cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live."${ARCH}"/* binary +fi + +if [ "${LH_DEBIAN_INSTALLER}" != "false" ] +then + # Copying install templates + if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install ] && \ + Find_files "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install/* + then + cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install/* binary + fi + + if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install."${ARCH}" ] && \ + Find_files "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install."${ARCH}"/* + then + cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install."${ARCH}"/* binary + fi + + # Adjusting install templates + ARCHITECTURE="$(echo ${LH_ARCHITECTURE} | sed -e 's| |/|g')" + DISTRIBUTION="$(echo ${LH_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')" + DISTRIBUTION="${DISTRIBUTION}$(echo ${LH_DISTRIBUTION} | cut -b 2-)" + eval VERSION="$`echo RELEASE_${LH_DISTRIBUTION}`" + + if [ -d binary/pool/main/l/live-installer ] + then + TYPE="LIVE/INSTALL" + fi + + TYPE="LIVE/NETINST" + + DEBIAN_NAME="Debian GNU/Linux ${VERSION} \"${DISTRIBUTION}\" - Official ${ARCHITECTURE} ${TYPE} Binary $(date +%Y%m%d-%H:%M)" + DEBIAN_DATE="$(date +%Y%m%d-%H:%M)" + + if [ "${LH_ARCHITECTURE}" = "i386" ] + then + DEBIAN_TOOLS_HTML="

\n  \n /tools/\n \n\n and\n  \n /install/floppy/\n " + DEBIAN_TOOLS_TXT="/tools/ and /install/floppy/" + else + DEBIAN_TOOLS_HTML="

\n  \n /tools/\n \n\n\n\n\n\n" + DEBIAN_TOOLS_TXT="/tools/" + fi + + if [ -f binary/README.html ] + then + sed -i -e "s|DEBIAN_NAME|${DEBIAN_NAME}|g" -e "s|DEBIAN_DATE|${DEBIAN_DATE}|g" -e "s|DEBIAN_TOOLS|${DEBIAN_TOOLS_HTML}|g" binary/README.html + sed -i -e "s|DEBIAN_NAME|${DEBIAN_NAME}|g" -e "s|DEBIAN_DATE|${DEBIAN_DATE}|g" -e "s|DEBIAN_TOOLS|${DEBIAN_TOOLS_TXT}|g" binary/README.txt + fi +fi + +# Creating stage file +Create_stagefile .stage/binary_includes diff --git a/helpers/binary_iso b/helpers/binary_iso new file mode 100755 index 000000000..4012a7021 --- /dev/null +++ b/helpers/binary_iso @@ -0,0 +1,219 @@ +#!/bin/sh + +# lh_binary_iso(1) - build iso binary image +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build iso binary image')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if ! In_list iso "${LH_BINARY_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building binary iso image..." + +# Requiring stage file +Require_stagefile .stage/config .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/genisoimage genisoimage + +if [ "${LH_BINARY_ISO_HYBRID}" = "true" ] +then + Check_package chroot/usr/bin/isohybrid syslinux-common +fi + +# Restoring cache +Restore_cache cache/packages_binary + +# Installing depends +Install_package + +# Remove old iso image +if [ -f binary.iso ] +then + rm -f binary.iso +fi + +# Handle genisoimage generic options +GENISOIMAGE_OPTIONS="-J -l -cache-inodes -allow-multidot" + +# Handle genisoimage live-helper specific options +if [ "${_QUIET}" = "true" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -quiet" +fi + +if [ "${_VERBOSE}" = "true" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v" +fi + +if [ -n "${LH_ISO_APPLICATION}" ] && [ "${LH_ISO_APPLICATION}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LH_ISO_APPLICATION}\"" +fi + +if [ -n "${LH_ISO_PREPARER}" ] && [ "${LH_ISO_PREPARER}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LH_ISO_PREPARER}\"" +fi + +if [ -n "${LH_ISO_PUBLISHER}" ] && [ "${LH_ISO_PUBLISHER}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LH_ISO_PUBLISHER}\"" +fi + +if [ -n "${LH_ISO_VOLUME}" ] && [ "${LH_ISO_VOLUME}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LH_ISO_VOLUME}\"" +fi + +# Handle genisoimage architecture specific options +case "${LH_BOOTLOADER}" in + grub) + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table" + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b boot/grub/stage2_eltorito" + GENISOIMAGE_EXCLUDE="boot/grub/stage2_eltorito" + ;; + + grub2) + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table" + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b boot/grub/grub_eltorito -J" + GENISOIMAGE_EXCLUDE="boot/grub/grub_eltorito" + ;; + + silo) + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -G boot/isofs.b -B ..." + GENISOIMAGE_EXCLUDE="boot/isofs.b" + ;; + + syslinux) + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table" + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b isolinux/isolinux.bin -c isolinux/boot.cat" + GENISOIMAGE_EXCLUDE="isolinux/isolinux.bin" + ;; + + yaboot) + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r --iso-level 2 --netatalk -hfs -probe -map" + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} binary/yaboot/hfs.map --chrp-boot -part -no-desktop" + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -hfs-bless binary/yaboot -hfs-volid Debian/Live_powerpc" + GENISOIMAGE_EXCLUDE="yaboot/hfs.map" + ;; + + *) + Echo_warning "Bootloader on your architecture not yet supported by live-helper." + Echo_warning "This will produce a most likely not bootable image (Continuing in 5 seconds)." + sleep 5 + ;; +esac + +if In_list "stripped minimal" "${LH_PACKAGES_LISTS}" +then + if [ "${LH_DEBIAN_INSTALLER}" != "live" ] + then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m ${GENISOIMAGE_EXCLUDE}" + fi +fi + +if [ "${LH_BOOTLOADER}" = "grub2" ] +then + +cat > binary.sh << EOF +#!/bin/sh + +input_dir=/usr/lib/grub/i386-pc + +# build core.img +core_img=\$(mktemp) +grub-mkimage -d \${input_dir} -o \${core_img} biosdisk iso9660 + +# build grub_eltorito image +cat \${input_dir}/cdboot.img \${core_img} > binary/boot/grub/grub_eltorito + +rm -f \${core_img} + +for file in \${input_dir}/*.mod \${input_dir}/efiemu??.o \ + \${input_dir}/command.lst \${input_dir}/moddep.lst \${input_dir}/fs.lst \ + \${input_dir}/handler.lst \${input_dir}/parttool.lst +do + if test -f "\$file" + then + cp -f "\$file" binary/boot/grub + fi +done +EOF + +else + echo "#!/bin/sh" > binary.sh +fi + +cat >> binary.sh << EOF + +genisoimage ${GENISOIMAGE_OPTIONS} -o binary.iso binary +EOF + +if [ "${LH_BINARY_ISO_HYRBID}" = "true" ] +then + +cat >> binary.sh << EOF + +isohybrid binary.iso +EOF + +fi + +case "${LH_CHROOT_BUILD}" in + true) + # Moving image + mv binary.sh chroot + mv binary chroot + + Chroot chroot "sh binary.sh" + + # Move image + mv chroot/binary chroot/binary.iso ./ + rm -f chroot/binary.sh + ;; + + false) + sh binary.sh + rm -f binary.sh + ;; +esac + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/binary_iso diff --git a/helpers/binary_linux-image b/helpers/binary_linux-image new file mode 100755 index 000000000..d08ae18ca --- /dev/null +++ b/helpers/binary_linux-image @@ -0,0 +1,81 @@ +#!/bin/sh + +# lh_binary_linux-image(1) - install linux-image into binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'install linux-image into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + +Echo_message "Begin install linux-image..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_linux-image + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +case "${LH_INITRAMFS}" in + casper) + DESTDIR="binary/casper" + ;; + + live-initramfs) + DESTDIR="binary/live" + ;; +esac + +case "${LH_ARCHITECTURE}" in + powerpc) + LINUX="vmlinux" + ;; + + *) + LINUX="vmlinuz" + ;; +esac + +Check_multiarchitecture + +# Creating directory +mkdir -p "${DESTDIR}" + +# Installing linux-image +cp chroot/boot/"${LINUX}"-* "${DESTDIR}" +cp chroot/boot/initrd.img-* "${DESTDIR}" + +case "${LH_INITRAMFS}" in + live-initramfs) + cp chroot/usr/share/doc/live-initramfs/parameters.txt "${DESTDIR}"/parameters.txt || true + ;; +esac + +# Creating stage file +Create_stagefile .stage/binary_linux-image diff --git a/helpers/binary_local-hooks b/helpers/binary_local-hooks new file mode 100755 index 000000000..704879b7c --- /dev/null +++ b/helpers/binary_local-hooks @@ -0,0 +1,57 @@ +#!/bin/sh + +# lh_binary_local-hooks(1) - execute local hooks in binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'execute local hooks in binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin executing local hooks..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_local-hooks + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Processing local-hooks +if Find_files config/binary_local-hooks/* +then + for HOOK in config/binary_local-hooks/* + do + # Making hook executable + if [ ! -x "${HOOK}" ] + then + chmod +x "${HOOK}" + fi + + # Executing hook + ./"${HOOK}" || ( Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ) + done + + # Creating stage file + Create_stagefile .stage/binary_local-hooks +fi diff --git a/helpers/binary_local-includes b/helpers/binary_local-includes new file mode 100755 index 000000000..63986aeca --- /dev/null +++ b/helpers/binary_local-includes @@ -0,0 +1,55 @@ +#!/bin/sh + +# lh_binary_local-includes(1) - copy files into binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'copy files into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin copying binary local includes..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_local-includes + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if Find_files config/binary_local-includes/ +then + # Copying includes + cd config/binary_local-includes + find . | cpio -dmpu --no-preserve-owner "${OLDPWD}"/binary + cd "${OLDPWD}" + + # Removing symlinks + if [ "${LH_BINARY_IMAGES}" = "usb-hdd" ] + then + find binary -type l | xargs rm -f + fi + + # Creating stage file + Create_stagefile .stage/binary_local-includes +fi diff --git a/helpers/binary_local-packageslists b/helpers/binary_local-packageslists new file mode 100755 index 000000000..43d8005ba --- /dev/null +++ b/helpers/binary_local-packageslists @@ -0,0 +1,110 @@ +#!/bin/sh + +# lh_binary_local-packageslists(1) - install local packages lists into binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'install local packages into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin installing local packages lists..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_local-packageslists + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if Find_files config/binary_local-packageslists/* +then + # Restoring cache + Restore_cache cache/packages_chroot + + # Check depends + Check_package chroot/usr/bin/apt-ftparchive apt-utils + + # Installing depends + Install_package + + mkdir -p chroot/binary.deb/archives/partial + mv chroot/var/lib/dpkg/status chroot/var/lib/dpkg/status.tmp + touch chroot/var/lib/dpkg/status + + for PACKAGESLIST in config/binary_local-packageslists/* + do + # Generate package list + Expand_packagelist "${PACKAGESLIST}" "config/binary_local-packageslists" "config/chroot_local-packageslists" > chroot/root/"$(basename ${PACKAGESLIST})" + + # Downloading additional packages + Chroot chroot "xargs --arg-file=/root/$(basename ${PACKAGESLIST}) apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb --download-only install" + + # Remove package list + rm chroot/root/"$(basename ${PACKAGESLIST})" + done + + for FILE in chroot/binary.deb/archives/*.deb + do + SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')" + + if [ -z "${SOURCE}" ] + then + SOURCE="$(basename ${FILE} | awk -F_ '{ print $1 }')" + fi + + case "${SOURCE}" in + lib?*) + LETTER="$(echo ${SOURCE} | sed 's|\(....\).*|\1|')" + ;; + + *) + LETTER="$(echo ${SOURCE} | sed 's|\(.\).*|\1|')" + ;; + esac + + # Install directory + mkdir -p binary/pool/main/"${LETTER}"/"${SOURCE}" + + # Move files + mv "${FILE}" binary/pool/main/"${LETTER}"/"${SOURCE}" + done + + cd binary + mkdir -p dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE} + apt-ftparchive packages pool/main > dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages + gzip -9 -c dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages > dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages.gz + cd "${OLDPWD}" + + rm -rf chroot/binary.deb + mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status + + # Removing depends + Remove_package + + # Saving cache + Save_cache cache/packages_chroot + + # Creating stage file + Create_stagefile .stage/binary_local-packageslists +fi diff --git a/helpers/binary_manifest b/helpers/binary_manifest new file mode 100755 index 000000000..4c40115a7 --- /dev/null +++ b/helpers/binary_manifest @@ -0,0 +1,70 @@ +#!/bin/sh + +# lh_binary_manifest(1) - create manifest +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'create manifest')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + +Echo_message "Begin creating manifest..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_manifest + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +case "${LH_INITRAMFS}" in + casper) + INITFS="casper" + + # Add filesystem.manifest + Chroot chroot "dpkg --get-selections" | awk '{ print $1 }' | sort -u > binary/casper/filesystem.manifest + ;; + + live-initramfs) + INITFS="live" + ;; +esac + +# Add packages.list +cat > binary/${INITFS}/packages.txt << EOF +This file contains the list of all packages installed in this live system. + + +EOF + +Chroot chroot "dpkg -l" >> binary/${INITFS}/packages.txt + +cp binary/${INITFS}/packages.txt binary.packages + +# Creating stage file +Create_stagefile .stage/binary_manifest diff --git a/helpers/binary_md5sum b/helpers/binary_md5sum new file mode 100755 index 000000000..57087d8ee --- /dev/null +++ b/helpers/binary_md5sum @@ -0,0 +1,73 @@ +#!/bin/sh + +# lh_binary_md5sum(1) - create binary md5sums +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'create binary md5sums')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_CHECKSUMS}" != "true" ] || [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + +Echo_message "Begin creating binary md5sum.txt..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_md5sum + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Remove old md5sums +if [ -f binary/md5sum.txt ] +then + rm -f binary/md5sum.txt +fi + +# Calculating md5sums +cd binary +find . -type f \! -path './isolinux/isolinux.bin' \! -path './boot/grub/stage2_eltorito' -print0 | sort -z | xargs -0 md5sum > ../md5sum.txt + +cat > md5sum.txt << EOF +This file contains the list of md5 checksums of all files on this medium. + +You can verify them automatically with the 'integrity-check' boot parameter, +or, manually with: 'md5sum -c md5sum.txt'. + + +EOF + +cat ../md5sum.txt >> md5sum.txt +rm -f ../md5sum.txt + +# File list +find . | sed -e 's|^.||g' | grep "^/" | sort > ../binary.list + +cd "${OLDPWD}" + +# Creating stage file +Create_stagefile .stage/binary_md5sum diff --git a/helpers/binary_memtest b/helpers/binary_memtest new file mode 100755 index 000000000..581ec9a1f --- /dev/null +++ b/helpers/binary_memtest @@ -0,0 +1,119 @@ +#!/bin/sh + +# lh_binary_memtest(1) - installs a memtest into binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'installs a memtest into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] || [ "${LH_MEMTEST}" = "false" ] || [ "${LH_MEMTEST}" = "none" ] +then + exit 0 +fi + +Echo_message "Begin installing memtest..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_memtest + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ "${LH_ARCHITECTURE}" != "amd64" ] && [ "${LH_ARCHITECTURE}" != "i386" ] +then + Echo_warning "skipping binary_memtest, foreign architecture." + exit 0 +fi + +if [ "${LH_CHROOT_BUILD}" = "true" ] +then + + if [ -f chroot/usr/sbin/grub ] && [ ! -f chroot/boot/grub/menu.lst ] + then + GRUB="yes" + + mkdir -p chroot/boot/grub + touch chroot/boot/grub/menu.lst + fi +fi + +# Checking depends +case "${LH_MEMTEST}" in + memtest86) + Check_package chroot/boot/memtest86.bin memtest86 + ;; + + memtest86+) + Check_package chroot/boot/memtest86+.bin memtest86+ + ;; +esac + +# Restoring cache +Restore_cache cache/packages_binary + +# Installing depends +Install_package + +# Setting destination directory +case "${LH_INITRAMFS}" in + casper) + DESTDIR="binary/casper" + ;; + + live-initramfs) + DESTDIR="binary/live" + ;; +esac + +Check_multiarchitecture + +# Creating directory +mkdir -p "${DESTDIR}" + +# Installing memtest +case "${LH_CHROOT_BUILD}" in + true) + cp chroot/boot/${LH_MEMTEST}.bin "${DESTDIR}"/memtest + ;; + + false) + cp /boot/${LH_MEMTEST}.bin "${DESTDIR}"/memtest + ;; +esac + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +if [ "${GRUB}" ] +then + rm -rf chroot/boot/grub +fi + +# Creating stage file +Create_stagefile .stage/binary_memtest diff --git a/helpers/binary_net b/helpers/binary_net new file mode 100755 index 000000000..05ecce71e --- /dev/null +++ b/helpers/binary_net @@ -0,0 +1,167 @@ +#!/bin/sh + +# lh_binary_net(1) - build netboot binary image +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build netboot binary image')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if ! In_list net "${LH_BINARY_IMAGES}" +then + exit 0 +fi + +if [ "${LH_NET_TARBALL}" = "none" ] +then + exit 0 +fi + +Echo_message "Begin building binary netboot image..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_net + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ "${LH_ARCHITECTURE}" = "sparc" ] +then + # Checking depends + Check_package chroot/usr/bin/elftoaout sparc-utils + + # Restoring cache + Restore_cache cache/packages_binary + + # Installing depends + Install_package + + # Set target and source directories + DESTDIR="tftpboot" + case "${LH_INITRAMFS}" in + casper) + ORIGDIR="binary/casper" + ;; + + live-initramfs) + ORIGDIR="binary/live" + ;; + esac + + # Find defaults + DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" + DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})" + DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinuz-||')" + DEFAULT_MAP="$(echo chroot/boot/System.map-*${DEFAULT_FLAVOUR})" + + gzip -cd ${ORIGDIR}/${DEFAULT_KERNEL} > kernel.tmp + + mkdir -p ${DESTDIR} + rm -f ${DESTDIR}/boot.img + elftoaout -o ${DESTDIR}/boot.img kernel.tmp + + case "${DEFAULT_FLAVOUR}" in + sparc32) + piggyback ${DESTDIR}/boot.img ${DEFAULT_MAP} ${ORIGDIR}/${DEFAULT_INITRD} + ;; + sparc64) + piggyback64 ${DESTDIR}/boot.img ${DEFAULT_MAP} ${ORIGDIR}/${DEFAULT_INITRD} + ;; + *) + Echo_error "Invalid default kernel flavour for sparc \"%s\"" "${DEFAULT_FLAVOUR}" + exit 1; + ;; + esac + + # Pad boot.img + REMAINDER=$((( 4 - $(stat -c %s ${DESTDIR}/boot.img) % 4 ) % 4)) + dd if=/dev/zero bs=1 count=${REMAINDER} >> ${DESTDIR}/boot.img + + # No need for kernel and initrd images in the binary + rm -f ${ORIGDIR}/vmlinuz-* + rm -f ${ORIGDIR}/initrd.img-* + + # Clean temporaries + rm -f kernel.tmp + + # Saving cache + Save_cache cache/packages_binary + + # Removing depends + Remove_package +fi + +# Remove old binary +rm -f binary-net.tar.bz2 +rm -f binary-net.tar.gz +rm -f binary-net.tar + +# Creating image file +ROOT_DIR=$(basename ${LH_NET_ROOT_PATH}) +if [ "${ROOT_DIR}" = "chroot" ] +then + mv chroot chroot.tmp +fi + +if [ "${ROOT_DIR}" != "binary" ] +then + mv binary ${ROOT_DIR} +fi + +mkdir binary.tmp +mv ${ROOT_DIR} tftpboot binary.tmp +cd binary.tmp + +case "${LH_NET_TARBALL}" in + bzip2) + tar cfj ../binary-net-tar.bz2 * + ;; + + gzip) + tar cf ../binary-net.tar * + gzip ${GZIP_OPTIONS} ../binary-net.tar + ;; + + tar) + tar cf ../binary-net.tar * + ;; +esac + +mv * ../ +cd "${OLDPWD}" +rmdir binary.tmp + +if [ "${ROOT_DIR}" != "binary" ] +then + mv ${ROOT_DIR} binary +fi + +if [ "${ROOT_DIR}" = "chroot" ] +then + mv chroot.tmp chroot +fi + +# Creating stage file +Create_stagefile .stage/binary_net diff --git a/helpers/binary_rootfs b/helpers/binary_rootfs new file mode 100755 index 000000000..a862895fe --- /dev/null +++ b/helpers/binary_rootfs @@ -0,0 +1,453 @@ +#!/bin/sh + +# lh_binary_rootfs(1) - build rootfs image +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build rootfs image')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin building root filesystem image..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap .stage/binary_chroot + +# Checking stage file +Check_stagefile .stage/binary_rootfs + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +case "${LH_ARCHITECTURE}" in + amd64|i386) + LINUX="vmlinuz" + ;; + + powerpc) + LINUX="vmlinux" + ;; +esac + +case "${LH_INITRAMFS}" in + casper) + INITFS="casper" + ;; + + live-initramfs) + INITFS="live" + ;; +esac + +# Creating directory +mkdir -p binary/${INITFS} + +for STAGE in ${LH_CACHE_STAGES} +do + if [ "${STAGE}" = "rootfs" ] && [ -d cache/stages_rootfs ] + then + # Removing old chroot + rm -rf binary/"${INITFS}"/filesystem.* + + # Restoring old cache + mkdir -p binary/"${INITFS}" + ${LH_ROOT_COMMAND} cp -a cache/stages_rootfs/filesystem.* binary/"${INITFS}" + + if [ -n "${LH_ROOT_COMMAND}" ] + then + ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) binary + fi + + # Creating stage file + Create_stagefile .stage/binary_rootfs + exit 0 + fi +done + +# Handling chroot excludes +if [ "${LH_CHROOT_BUILD}" = "true" ] +then + if [ -f config/binary_rootfs/excludes ] + then + cp config/binary_rootfs/excludes chroot/chroot/excludes + chroot chroot/chroot /usr/bin/env -i xargs --arg-file=/excludes -I FILE bash -c 'rm -rf FILE' + rm -f chroot/chroot/excludes + fi + + if [ "${LH_DEBIAN_INSTALLER}" != "live" ] + then + case "${LH_PACKAGES_LISTS}" in + stripped|minimal) + # kernel images + rm -f chroot/chroot/boot/${LINUX}* + rm -f chroot/chroot/boot/initrd.img* + + # kernel symlinks + rm -f chroot/chroot/${LINUX}* + rm -f chroot/chroot/initrd.img* + ;; + esac + fi +else + if [ "${LH_CHROOT_FILESYSTEM}" != "squashfs" ] + then + Echo_warning "rootfs excludes are not supported on non-chrooted builds unless squashfs as chroot filesystem is used, thus ignoring excludes now." + fi +fi + +case "${LH_CHROOT_FILESYSTEM}" in + ext2|ext3) + # Checking depends + Check_package chroot/usr/bin/genext2fs genext2fs + + # Restoring cache + Restore_cache cache/packages_binary + + # Installing depends + Install_package + + # Remove old image + if [ -f binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} ] + then + rm -f binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} + fi + + DU_DIM="$(du -ks chroot/chroot | cut -f1)" + REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LH_CHROOT_FILESYSTEM})" + + RESERVED_PERCENTAGE="--reserved-percentage" + + case "${LH_CHROOT_BUILD}" in + true) + Chroot chroot "genext2fs --size-in-blocks=${REAL_DIM} ${RESERVED_PERCENTAGE}=0 --root=chroot filesystem.${LH_CHROOT_FILESYSTEM}" + + # Move image + mv chroot/filesystem.${LH_CHROOT_FILESYSTEM} binary/${INITFS} + + if [ -e chroot/chroot.cache ] + then + rm -f .lock + mv chroot/chroot chroot.tmp + + lh chroot_linux-image remove ${*} + lh chroot_sources remove ${*} + lh chroot_apt remove ${*} + lh chroot_hostname remove ${*} + lh chroot_resolv remove ${*} + lh chroot_hosts remove ${*} + lh chroot_sysv-rc remove ${*} + lh chroot_dpkg remove ${*} + lh chroot_debianchroot remove ${*} + lh chroot_sysfs remove ${*} + lh chroot_selinuxfs remove ${*} + lh chroot_proc remove ${*} + lh chroot_devpts remove ${*} + + rm -rf chroot + mv chroot.tmp chroot + + lh chroot_devpts install ${*} + lh chroot_proc install ${*} + lh chroot_selinuxfs install ${*} + lh chroot_sysfs install ${*} + lh chroot_debianchroot install ${*} + lh chroot_dpkg install ${*} + lh chroot_sysv-rc install ${*} + lh chroot_hosts install ${*} + lh chroot_resolv install ${*} + lh chroot_hostname install ${*} + lh chroot_apt install ${*} + lh chroot_sources install ${*} + lh chroot_linux-image install ${*} + + touch .lock + else + rm -rf chroot/chroot + fi + ;; + + false) + genext2fs --size-in-blocks=${REAL_DIM} ${RESERVED_PERCENTAGE}=0 --root=chroot binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} + ;; + esac + + # Saving cache + Save_cache cache/packages_binary + + # Removing depends + Remove_package + ;; + + jffs2) + # Checking depends + Check_package chroot/usr/sbin/mkfs.jffs2 mtd-tools + + # Restoring cache + Restore_cache cache/packages_binary + + # Installing depends + Install_package + + # Remove old jffs2 image + if [ -f binary/${INITFS}/filesystem.jffs2 ] + then + rm -f binary/${INITFS}/filesystem.jffs2 + fi + + if [ -n "${LH_JFFS2_ERASEBLOCK}" ] + then + JFFS2_OPTIONS="--eraseblock=${LH_JFFS2_ERASEBLOCK}" + fi + + case "${LH_CHROOT_BUILD}" in + true) + Chroot chroot "mkfs.jffs2 ${JFFS2_OPTIONS} --root=chroot --output filesystem.jffs2" + + # Move image + mv chroot/filesystem.jffs2 binary/${INITFS} + + if [ -e chroot/chroot.cache ] + then + rm -f .lock + mv chroot/chroot chroot.tmp + + lh chroot_linux-image remove ${*} + lh chroot_sources remove ${*} + lh chroot_apt remove ${*} + lh chroot_hostname remove ${*} + lh chroot_resolv remove ${*} + lh chroot_hosts remove ${*} + lh chroot_sysv-rc remove ${*} + lh chroot_dpkg remove ${*} + lh chroot_debianchroot remove ${*} + lh chroot_sysfs remove ${*} + lh chroot_selinuxfs remove ${*} + lh chroot_proc remove ${*} + lh chroot_devpts remove ${*} + + rm -rf chroot + mv chroot.tmp chroot + + lh chroot_devpts install ${*} + lh chroot_proc install ${*} + lh chroot_selinuxfs install ${*} + lh chroot_sysfs install ${*} + lh chroot_debianchroot install ${*} + lh chroot_dpkg install ${*} + lh chroot_sysv-rc install ${*} + lh chroot_hosts install ${*} + lh chroot_resolv install ${*} + lh chroot_hostname install ${*} + lh chroot_apt install ${*} + lh chroot_sources install ${*} + lh chroot_linux-image install ${*} + + touch .lock + else + rm -rf chroot/chroot + fi + ;; + + false) + mkfs.jffs2 ${JFFS2_OPTIONS} --root=chroot --output binary/${INITFS}/filesystem.jffs2 + ;; + esac + + # Saving cache + Save_cache cache/packages_binary + + # Removing depends + Remove_package + ;; + + plain) + if [ -d binary/${INITFS}/filesystem.dir ] + then + rm -rf binary/${INITFS}/filesystem.dir + fi + + case "${LH_CHROOT_BUILD}" in + true) + mv chroot/chroot binary/${INITFS}/filesystem.dir + ;; + + false) + cp -a chroot binary/${INITFS}/filesystem.dir + ;; + esac + ;; + + squashfs) + # Checking depends + Check_package chroot/usr/share/doc/squashfs-tools squashfs-tools + + # Restoring cache + Restore_cache cache/packages_binary + + # Installing depends + Install_package + + Echo_message "Preparing squashfs image..." + Echo_message "This may take a while." + + # Remove old squashfs image + if [ -f binary/${INITFS}/filesystem.squashfs ] + then + rm -f binary/${INITFS}/filesystem.squashfs + fi + + # Remove stale squashfs image + rm -f chroot/filesystem.squashfs + + MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -no-progress" + + if [ "${_VERBOSE}" = "true" ] + then + MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -info" + fi + + if [ -f config/binary_rootfs/squashfs.sort ] + then + MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -sort squashfs.sort" + cp config/binary_rootfs/squashfs.sort chroot #FIXME + fi + + case "${LH_CHROOT_BUILD}" in + true) + # Create image + Chroot chroot "mksquashfs chroot filesystem.squashfs ${MKSQUASHFS_OPTIONS}" + + # Move image + ${LH_ROOT_COMMAND} mv chroot/filesystem.squashfs binary/${INITFS} + ${LH_ROOT_COMMAND} rm -f chroot/squashfs.sort + + if [ -e chroot/chroot.cache ] + then + rm -f .lock + mv chroot/chroot chroot.tmp + + lh chroot_linux-image remove ${*} + lh chroot_sources remove ${*} + lh chroot_apt remove ${*} + lh chroot_hostname remove ${*} + lh chroot_resolv remove ${*} + lh chroot_hosts remove ${*} + lh chroot_sysv-rc remove ${*} + lh chroot_dpkg remove ${*} + lh chroot_debianchroot remove ${*} + lh chroot_sysfs remove ${*} + lh chroot_selinuxfs remove ${*} + lh chroot_proc remove ${*} + lh chroot_devpts remove ${*} + + rm -rf chroot + mv chroot.tmp chroot + + lh chroot_devpts install ${*} + lh chroot_proc install ${*} + lh chroot_selinuxfs install ${*} + lh chroot_sysfs install ${*} + lh chroot_debianchroot install ${*} + lh chroot_dpkg install ${*} + lh chroot_sysv-rc install ${*} + lh chroot_hosts install ${*} + lh chroot_resolv install ${*} + lh chroot_hostname install ${*} + lh chroot_apt install ${*} + lh chroot_sources install ${*} + lh chroot_linux-image install ${*} + + touch .lock + else + rm -rf chroot/chroot + fi + + ${LH_ROOT_COMMAND} chmod 0644 binary/${INITFS}/filesystem.squashfs + ;; + + false) + if [ -f config/binary_rootfs/excludes ] + then + case "${LH_DISTRIBUTION}" in + lenny|sid) + MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -wildcards -ef config/binary_rootfs/excludes" + ;; + esac + fi + + mksquashfs chroot binary/${INITFS}/filesystem.squashfs ${MKSQUASHFS_OPTIONS} + ;; + esac + + if [ -n "${LH_ROOT_COMMAND}" ] + then + ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) binary/${INITFS} + fi + + # Saving cache + Save_cache cache/packages_binary + + # Removing depends + Remove_package + ;; + + none) + if [ -d binary ] + then + rm -rf binary + fi + + case "${LH_CHROOT_BUILD}" in + true) + mv chroot/chroot binary + ;; + + false) + Echo_message "This may take a while." + cp -a chroot binary + ;; + esac + ;; + +esac + +for STAGE in ${LH_CACHE_STAGES} +do + if [ "${STAGE}" = "rootfs" ] + then + rm -rf cache/stages_rootfs + + mkdir -p cache/stages_rootfs + + if [ "${LH_CHROOT_FILESYSTEM}" != "none" ] + then + ${LH_ROOT_COMMAND} cp -a binary/"${INITFS}"/filesystem.* cache/stages_rootfs + fi + + if [ -n "${LH_ROOT_COMMAND}" ] + then + ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/stages_rootfs + fi + fi +done + +# Creating stage file +Create_stagefile .stage/binary_rootfs diff --git a/helpers/binary_silo b/helpers/binary_silo new file mode 100755 index 000000000..d79d0b74d --- /dev/null +++ b/helpers/binary_silo @@ -0,0 +1,272 @@ +#!/bin/sh + +# lh_binary_silo(1) - installs silo into binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'installs silo into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BOOTLOADER}" != "silo" ] +then + exit 0 +fi + +# Check image type +case "${LH_BINARY_IMAGES}" in + iso|usb-hdd|tar) + ;; + + net) + # silo not required for sparc netbooting + exit 0 + ;; +esac + +Echo_message "Begin installing silo..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_silo + +# Checking silo templates +Check_templates silo + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Check architecture +Check_architecture sparc + +# Checking depends +Check_package chroot/usr/sbin/silo silo + +# Restoring cache +Restore_cache cache/packages_binary + +# Installing depends +Install_package + +# Local functions +Silo_live_entry () +{ + LABEL="${1}" + KERNEL="${2}" + INITRD="${3}" + APPEND="${4}" + + DIRECTORY="/$(basename ${DESTDIR_LIVE})" + + LINUX_LIVE="${LINUX_LIVE}\nimage=${DIRECTORY}/${KERNEL}\n" + LINUX_LIVE="${LINUX_LIVE}\t label=${LABEL}\n" + LINUX_LIVE="${LINUX_LIVE}\t initrd=${DIRECTORY}/${INITRD}\n" + LINUX_LIVE="${LINUX_LIVE}\t append=\"boot=${INITFS} LH_BOOTAPPEND_LIVE ${APPEND}\"\n" +} + +Silo_install_entry () +{ + LABEL="${1}" + KERNEL="${2}" + INITRD="${3}" + APPEND="${4}" + + DIRECTORY="/$(basename ${DESTDIR_INSTALL})" + + if [ "${LABEL}" != "rescue" ] && [ "${LABEL}" != "rescuegui" ] + then + APPEND="${APPEND} quiet" + fi + + LINUX_INSTALL="${LINUX_INSTALL}\nimage=${DIRECTORY}/${KERNEL}\n" + LINUX_INSTALL="${LINUX_INSTALL}\t label=${LABEL}\n" + LINUX_INSTALL="${LINUX_INSTALL}\t initrd=${DIRECTORY}/${INITRD}\n" + LINUX_INSTALL="${LINUX_INSTALL}\t append=\"LH_BOOTAPPEND_LIVE ${APPEND} LH_BOOTAPPEND_INSTALL\"\n" +} + +# Setting destination directories +DESTDIR_INSTALL="binary/install" +case "${LH_INITRAMFS}" in + casper) + INITFS="casper" + DESTDIR_LIVE="binary/casper" + ;; + + live-initramfs) + INITFS="live" + DESTDIR_LIVE="binary/live" + ;; +esac + +# Creating directory +mkdir -p "${DESTDIR_LIVE}" + +# Setting boot parameters +case "${LH_ENCRYPTION}" in + ""|false) + ;; + *) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} encryption=${LH_ENCRYPTION}" + ;; +esac + +if [ -n "${LH_USERNAME}" ] +then + case "${LH_INITRAMFS}" in + casper) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" + ;; + + live-initramfs) + if [ "${LH_USERNAME}" != "user" ] + then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" + fi + ;; + esac +fi + +if [ -n "${LH_HOSTNAME}" ] +then + case "${LH_INITRAMFS}" in + casper) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" + ;; + + live-initramfs) + if [ "${LH_HOSTNAME}" != "debian" ] + then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" + fi + ;; + esac +fi + +if [ "${LH_UNION_FILESYSTEM}" != "unionfs" ] +then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}" +fi + +if [ -n "${LH_NET_COW_PATH}" ] +then + Echo_error "Net cow not supported on silo" + exit 1 +fi + +if [ "${LH_EXPOSED_ROOT}" != "false" ] +then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} exposedroot" +fi + +LH_BOOTAPPEND_LIVE="$(echo ${LH_BOOTAPPEND_LIVE} | sed -e 's| ||')" + +# Parameters are listed at: linux/Documentation/kernel-parameters.txt +FAILSAFE="noapic noapm nodma nomce nolapic nosmp vga=ofonly" + +# Assembling kernel configuration + +# Default entries +DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" +DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})" +DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinuz-||')" + +Silo_live_entry "live" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" +Silo_live_entry "live-failsafe" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" "${FAILSAFE}" + +if [ "$(echo ${LH_LINUX_FLAVOURS} | wc -w)" -gt "1" ] +then + for KERNEL in chroot/boot/vmlinuz-* + do + KERNEL_IMAGE="$(basename ${KERNEL})" + KERNEL_VERSION="$(echo ${KERNEL_IMAGE} | sed -e 's|vmlinuz-||')" + INITRD="initrd.img-${KERNEL_VERSION}" + + Silo_live_entry "live-${KERNEL_VERSION}" "${KERNEL_IMAGE}" "${INITRD}" + Silo_live_entry "live-${KERNEL_VERSION}-failsafe" "${KERNEL_IMAGE}" "${INITRD}" "${FAILSAFE}" + done +fi + +LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" + +# Assembling debian-installer configuration +if [ "${LH_DEBIAN_INSTALLER}" != "false" ] +then + VMLINUZ_DI="vmlinuz" + INITRD_DI="initrd.gz" + APPEND_DI="vga=normal" + + Silo_install_entry "linux" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" + Silo_install_entry "install" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" + Silo_install_entry "expert" "${VMLINUZ_DI}" "${INITRD_DI}" "priority=low ${APPEND_DI}" + Silo_install_entry "rescue" "${VMLINUZ_DI}" "${INITRD_DI}" "rescue/enable=true ${APPEND_DI}" + Silo_install_entry "auto" "${VMLINUZ_DI}" "${INITRD_DI}" "auto=true priority=critical ${APPEND_DI}" +fi + +LINUX_INSTALL="$(/bin/echo ${LINUX_INSTALL} | sed -e 's|binary||g' -e 's|//|/|g')" + +case "${LH_BINARY_IMAGES}" in + iso|usb-hdd) + # Copying silo + mkdir -p binary/boot + + case "${LH_CHROOT_BUILD}" in + true) + cp chroot/boot/second.b binary/boot + ;; + + false) + cp /boot/second.b binary/boot + ;; + esac + + cp -r "${TEMPLATES}"/* binary/boot + + if [ "${LH_DEBIAN_INSTALLER}" = "false" ] + then + rm -f binary/boot/debian.txt.install + else + mv binary/boot/debian.txt.install binary/boot/debian.txt + fi + + # Configure silo templates + sed -i -e "s|LINUX_LIVE|${LINUX_LIVE}|" \ + -e "s|LINUX_INSTALL|${LINUX_INSTALL}|" \ + binary/boot/silo.conf + sed -i -e "s|LH_BOOTAPPEND_INSTALL|${LH_BOOTAPPEND_INSTALL}|" \ + -e "s|LH_BOOTAPPEND_LIVE|${LH_BOOTAPPEND_LIVE}|" \ + binary/boot/silo.conf + sed -i -e "s|LH_DATE|$(date +%Y%m%d)|" \ + -e "s|LH_VERSION|${VERSION}|" \ + -e "s|LH_DISTRIBUTION|${LH_DISTRIBUTION}|" \ + binary/boot/debian.txt + ;; +esac + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/binary_silo diff --git a/helpers/binary_syslinux b/helpers/binary_syslinux new file mode 100755 index 000000000..ba7f9d530 --- /dev/null +++ b/helpers/binary_syslinux @@ -0,0 +1,659 @@ +#!/bin/sh + +# lh_binary_syslinux(1) - installs syslinux into binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'installs syslinux into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BOOTLOADER}" != "syslinux" ] +then + exit 0 +fi + +Echo_message "Begin installing syslinux..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_syslinux + +# Checking syslinux templates +Check_templates syslinux + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Check architecture +Check_architecture amd64 i386 +Check_crossarchitecture + +# Checking depends +Check_package chroot/usr/bin/syslinux syslinux + +# Restoring cache +Restore_cache cache/packages_binary + +# Installing depends +Install_package + +# Local functions +Utf8_to_latin1 () +{ + VALUE="${1}" + + echo "${VALUE}" | iconv -f utf-8 -t latin1 +} + +Syslinux_memtest_entry () +{ + LABEL="${1}" + MENULABEL="$(Utf8_to_latin1 "${2}")" + KERNEL="${3}" + + MEMTEST="${MEMTEST}\nlabel ${LABEL}\n" + + # Write the menu label if the syslinux menu is being use + MEMTEST="${MEMTEST}\tmenu label ${MENULABEL}\n" + MEMTEST="${MEMTEST}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n" + MEMTEST="$(/bin/echo ${MEMTEST} | sed -e 's|//|/|g')" +} + +Syslinux_live_entry () +{ + LABEL="${1}" + MENULABEL="$(Utf8_to_latin1 "${2}")" + MENULABEL="${2}" + KERNEL="${3}" + INITRD="${4}" + APPEND="${5}" + + case "${LH_BINARY_IMAGES}" in + iso|usb-hdd) + NUMBER="$(ls -1 ${KERNEL_PATH} | grep 'vmlinuz[0-9]\+$' | wc -l)" + NUMBER="$((${NUMBER} +1))" + + # Do not add numbering to filenames if first kernel/initrd + if [ "${NUMBER}" = "1" ] + then + NUMBER="" + fi + + # Note: ISOLINUX will not find the kernel if the name ends in ".img". + if [ -e ${KERNEL_PATH}/${KERNEL} ] + then + mv ${KERNEL_PATH}/${KERNEL} ${KERNEL_PATH}/vmlinuz${NUMBER} + fi + + if [ -e ${KERNEL_PATH}/${INITRD} ] + then + mv ${KERNEL_PATH}/${INITRD} ${KERNEL_PATH}/initrd${NUMBER}.img + fi + + KERNEL=vmlinuz${NUMBER} + INITRD=initrd${NUMBER}.img + ;; + esac + + # Regular kernel + LINUX_LIVE="${LINUX_LIVE}\nlabel ${LABEL}\n" + + # Write the menu label if the syslinux menu is being use + if [ -n "${MENULABEL}" ] + then + LINUX_LIVE="${LINUX_LIVE}\tmenu label ${MENULABEL}\n" + fi + + LINUX_LIVE="${LINUX_LIVE}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n" + LINUX_LIVE="${LINUX_LIVE}\tappend initrd=${LIVE_KERNEL_PATH}/${INITRD} boot=${INITFS} ${LH_BOOTAPPEND_LIVE} ${APPEND}\n" + + # Failsafe kernel + LINUX_LIVE="${LINUX_LIVE}\nlabel ${LABEL}failsafe\n" + + # Write the menu label if the syslinux menu is being use + if [ -n "${MENULABEL}" ] + then + LINUX_LIVE="${LINUX_LIVE}\tmenu label ${MENULABEL} (failsafe)\n" + fi + + LINUX_LIVE="${LINUX_LIVE}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n" + LINUX_LIVE="${LINUX_LIVE}\tappend initrd=${LIVE_KERNEL_PATH}/${INITRD} boot=${INITFS} ${LH_BOOTAPPEND_LIVE} ${APPEND} ${FAILSAFE}\n" +} + +Syslinux_install_entry () +{ + LABEL="${1}" + KERNEL="${2}" + INITRD="${3}" + APPEND="${4}" + + # Boot in quiet mode where appropriate + QAPPEND="quiet" + + for TYPE in Install Expert Rescue Auto + do + case "${TYPE}" in + Install) + TAPPEND="${APPEND} ${QAPPEND}" + ;; + + Expert) + TAPPEND="priority=low ${APPEND}" + ;; + + Rescue) + TAPPEND="rescue/enable=true ${APPEND} ${QAPPEND}" + ;; + + Auto) + TAPPEND="auto=true priority=critical ${APPEND} ${QAPPEND}" + ;; + esac + + case "${LABEL}" in + Text) + TYPE_SUFFIX="" + ;; + GUI) + TYPE_SUFFIX="gui" + ;; + esac + + LINUX_INSTALL="${LINUX_INSTALL}\nlabel $(echo "${TYPE}" | tr A-Z a-z)${TYPE_SUFFIX}\n" + LINUX_INSTALL="${LINUX_INSTALL}\tmenu label ${LABEL} ${TYPE}\n" + LINUX_INSTALL="${LINUX_INSTALL}\tkernel ${LIVE_INSTALL_KERNEL_PATH}/${KERNEL}\n" + LINUX_INSTALL="${LINUX_INSTALL}\tappend initrd=${LIVE_INSTALL_KERNEL_PATH}/${INITRD} ${TAPPEND} ${LH_BOOTAPPEND_INSTALL}\n" + done +} + +Copy_syslinux_templates () +{ + cp -r "${TEMPLATES}"/common/* ${SCREEN_PATH} + + if [ "${LH_SYSLINUX_MENU}" = "false" ] + then + cp "${TEMPLATES}"/normal/* ${SCREEN_PATH} + else + cp "${TEMPLATES}"/menu/* ${SCREEN_PATH} + + case "${LH_SYSLINUX_MENU}" in + gfxboot) + MENUMODULE="gfxboot.c32" + ;; + + menu) + MENUMODULE="menu.c32" + ;; + + vesamenu) + MENUMODULE="vesamenu.c32" + ;; + + *) + if [ -z "${LH_SYSLINUX_CFG}" ] + then + MENUMODULE=$(grep 'menu.c32' ${TEMPLATES}/menu/syslinux.cfg | sed 's|default\s*.*/\(.*menu.c32\)$|\1|g') + else + LH_SYSLINUX_CFG="${LH_SYSLINUX_CFG:-${TEMPLATES}/menu/syslinux.cfg}" + fi + ;; + esac + + case "${LH_CHROOT_BUILD}" in + true) + cp chroot/usr/lib/syslinux/"${MENUMODULE}" ${DATA_PATH} + ;; + false) + cp /usr/lib/syslinux/"${MENUMODULE}" ${DATA_PATH} + ;; + esac + fi + + if ls "${TEMPLATES}/${LH_LANGUAGE}"/* > /dev/null 2>&1 + then + cp -r "${TEMPLATES}"/"${LH_LANGUAGE}"/* ${SCREEN_PATH} + else + if ls "${TEMPLATES}"/en/* > /dev/null 2>&1 + then + cp -r "${TEMPLATES}"/en/* ${SCREEN_PATH} + fi + fi + + if ls ${SCREEN_PATH}/*.live > /dev/null 2>&1 + then + for FILE in ${SCREEN_PATH}/*.live + do + mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .live) + done + fi + + if [ "${LH_DEBIAN_INSTALLER}" != "false" ] + then + if ls ${SCREEN_PATH}/*.install > /dev/null 2>&1 + then + for FILE in ${SCREEN_PATH}/*.install + do + mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install) + done + fi + + case "${LH_ARCHITECTURE}" in + amd64|i386|powerpc) + if ls ${SCREEN_PATH}/*.install.g-i > /dev/null 2>&1 + then + for FILE in ${SCREEN_PATH}/*.install.g-i + do + mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install.g-i) + done + fi + ;; + + *) + rm -f ${SCREEN_PATH}/*.install.g-i + ;; + esac + else + rm -f ${SCREEN_PATH}/*.install* + fi + + if [ "${LH_SYSLINUX_MENU}" != "false" ] + then + rm -f ${DATA_PATH}/boot.txt + fi + + # Copying custom splash screen + if [ "${LH_SYSLINUX_SPLASH}" = "none" ] + then + # no splash screen + SPLASH="" + rm -f ${SCREEN_PATH}/splash.rle + rm -f ${DATA_PATH}/splash.png + else + if [ "${LH_SYSLINUX_MENU}" = "false" ] + then + SPLASH="${LIVE_DATA_PATH}/splash.rle" + else + SPLASH="${LIVE_DATA_PATH}/splash.png" + fi + + if [ -n "${LH_SYSLINUX_SPLASH}" ] + then + if [ ! -e "${LH_SYSLINUX_SPLASH}" ] + then + Echo_error "%s doen't exist" "${LH_SYSLINUX_SPLASH}" + exit 1 + else + rm -f ${SCREEN_PATH}/splash.rle + rm -f ${DATA_PATH}/splash.png + cp -f "${LH_SYSLINUX_SPLASH}" ${DATA_PATH}/$(basename ${SPLASH}) + fi + fi + fi +} + +Configure_syslinux_templates () +{ + templates="$(find ${SYSLINUX_PATH} -type f -name '*.cfg' -o -name '*.txt')" + + for template_file in ${templates} + do + sed -i -e "s|{\$LINUX_LIVE}|${LINUX_LIVE}|" \ + -e "s|{\$LINUX_INSTALL}|${LINUX_INSTALL}|" \ + -e "s|{\$MEMTEST}|${MEMTEST}|" \ + -e "s|{\$LIVE_SCREEN_PATH}|${LIVE_SCREEN_PATH}|" \ + -e "s|{\$LIVE_DATA_PATH}|${LIVE_DATA_PATH}|" \ + -e "s|{\$LIVE_KERNEL_PATH}|${LIVE_KERNEL_PATH}|" \ + -e "s|{\$SPLASH}|${SPLASH}|" \ + -e "s|{\$LH_DISTRIBUTION}|${LH_DISTRIBUTION}|" \ + -e "s|{\$LH_DATE}|$(date +%Y%m%d)|" \ + -e "s|{\$LH_MEDIA}|${MEDIA}|" \ + -e "s|{\$LH_VERSION}|${VERSION}|" \ + -e "s|{\$LH_SYSLINUX_TIMEOUT}|${LH_SYSLINUX_TIMEOUT}0|" \ + $template_file + done + + case "${LH_BINARY_IMAGES}" in + usb-hdd) + if [ -f "${SYSLINUX_PATH}/exithelp.cfg" ] + then + sed -i -e "s|config isolinux.cfg|config syslinux.cfg|" "${SYSLINUX_PATH}"/exithelp.cfg + fi + ;; + + net) + if [ -f "${SCREEN_PATH}/exithelp.cfg" ] + then + sed -i -e "s|config isolinux.cfg|config ${LIVE_KERNEL_PATH}/pxelinux.cfg/default|" "${SCREEN_PATH}"/exithelp.cfg + fi + ;; + esac +} + +# Setting up common variables +case "${LH_INITRAMFS}" in + casper) + INITFS="casper" + ;; + + live-initramfs) + INITFS="live" + ;; +esac + +# Setting boot method specific variables +case "${LH_BINARY_IMAGES}" in + iso) + SYSLINUX_PATH="binary/isolinux" + KERNEL_PATH="binary/${INITFS}" + SCREEN_PATH="${SYSLINUX_PATH}" + DATA_PATH="${SCREEN_PATH}" + LIVE_KERNEL_PATH="/${INITFS}" + LIVE_INSTALL_KERNEL_PATH="/install" + LIVE_SCREEN_PATH="/isolinux" + LIVE_DATA_PATH="${LIVE_SCREEN_PATH}" + MEDIA="CD-ROM" + ;; + + net) + SYSLINUX_PATH="tftpboot" + KERNEL_PATH="${SYSLINUX_PATH}/debian-live/${LH_ARCHITECTURE}" + SCREEN_PATH="${SYSLINUX_PATH}/debian-live/${LH_ARCHITECTURE}/boot-screens" + DATA_PATH="${SCREEN_PATH}" + LIVE_KERNEL_PATH="debian-live/${LH_ARCHITECTURE}" + LIVE_INSTALL_KERNEL_PATH="debian-install/${LH_ARCHITECTURE}" + LIVE_SCREEN_PATH="debian-live/${LH_ARCHITECTURE}/boot-screens" + LIVE_DATA_PATH="${LIVE_SCREEN_PATH}" + MEDIA="netboot" + ;; + + tar|usb-hdd) + SYSLINUX_PATH="binary/syslinux" + KERNEL_PATH="binary/${INITFS}" + SCREEN_PATH="${SYSLINUX_PATH}" + DATA_PATH="${SCREEN_PATH}" + LIVE_KERNEL_PATH="/${INITFS}" + LIVE_INSTALL_KERNEL_PATH="/install" + LIVE_SCREEN_PATH="/syslinux" + LIVE_DATA_PATH="${LIVE_SCREEN_PATH}" + MEDIA="hd-media" + ;; +esac + +Check_multiarchitecture + +# Creating directories +mkdir -p "${KERNEL_PATH}" +mkdir -p "${SCREEN_PATH}" +mkdir -p "${DATA_PATH}" + +# Setting boot parameters +case "${LH_ENCRYPTION}" in + ""|false) + ;; + *) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} encryption=${LH_ENCRYPTION}" + ;; +esac + +if [ -n "${LH_USERNAME}" ] +then + case "${LH_INITRAMFS}" in + casper) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" + ;; + + live-initramfs) + if [ "${LH_USERNAME}" != "user" ] + then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" + fi + ;; + esac +fi + +if [ -n "${LH_HOSTNAME}" ] +then + case "${LH_INITRAMFS}" in + casper) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" + ;; + + live-initramfs) + if [ "${LH_HOSTNAME}" != "debian" ] + then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" + fi + ;; + esac +fi + +if [ "${LH_UNION_FILESYSTEM}" != "unionfs" ] +then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}" +fi + +if [ "${LH_EXPOSED_ROOT}" != "false" ] +then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} exposedroot" +fi + +if [ "${LH_BINARY_IMAGES}" = "net" ] +then + case "${LH_NET_ROOT_FILESYSTEM}" in + nfs) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} netboot=nfs nfsroot=${LH_NET_ROOT_SERVER}:${LH_NET_ROOT_PATH}" + ;; + + cifs) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} netboot=cifs nfsroot=//${LH_NET_ROOT_SERVER}${LH_NET_ROOT_PATH}" + ;; + + *) + Echo_error "Unsupported net filesystem" + exit 1 + ;; + esac + + if [ -n "${LH_NET_ROOT_MOUNTOPTIONS}" ] + then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} nfsopts=${LH_NET_ROOT_MOUNTOPTIONS}" + fi +fi + +if [ -n "${LH_NET_COW_PATH}" ] +then + case "${LH_NET_COW_FILESYSTEM}" in + nfs) + if [ -n "${LH_NET_COW_MOUNTOPTIONS}" ] + then + LH_NET_COW_MOUNTOPTIONS=",${LH_NET_COW_MOUNTOPTIONS}" + fi + + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} nfscow=${LH_NET_COW_SERVER}:${LH_NET_COW_PATH}${LH_NET_COW_MOUNTOPTIONS}" + ;; + + *) + Echo_error "Unsupported net filesystem" + exit 1 + ;; + esac +fi + +LH_BOOTAPPEND_LIVE="$(echo ${LH_BOOTAPPEND_LIVE} | sed -e 's| ||')" + +# Parameters are listed at: linux/Documentation/kernel-parameters.txt +FAILSAFE="noapic noapm nodma nomce nolapic nosmp vga=normal" + +# Moving kernels into place +if [ "binary/${INITFS}" != "${KERNEL_PATH}" ] +then + mv binary/${INITFS}/vmlinuz* ${KERNEL_PATH} + mv binary/${INITFS}/initrd* ${KERNEL_PATH} + + if [ "${LH_MEMTEST}" != "false" ] && [ "${LH_MEMTEST}" != "none" ] + then + mv binary/${INITFS}/memtest ${KERNEL_PATH} + fi +fi + +# Default entries +DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" +DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})" +DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinuz-||')" + +Syslinux_live_entry "live" "${LH_SYSLINUX_MENU_LIVE_ENTRY}" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" + +if [ "$(echo ${LH_LINUX_FLAVOURS} | wc -w)" -gt "1" ] +then + for FLAVOUR in ${LH_LINUX_FLAVOURS} + do + if [ "${FLAVOUR}" != "${DEFAULT_FLAVOUR}" ] + then + FLAVOUR_KERNEL="$(basename chroot/boot/vmlinuz-*${FLAVOUR})" + FLAVOUR_INITRD="initrd.img-$(echo ${FLAVOUR_KERNEL} | sed -e 's|vmlinuz-||')" + Syslinux_live_entry "live-${FLAVOUR}" "${LH_SYSLINUX_MENU_LIVE_ENTRY} ${FLAVOUR}" "${FLAVOUR_KERNEL}" "${FLAVOUR_INITRD}" + fi + done +fi + +# Only needed for non-vesamenu, non-gfxboot syslinux +case "${LH_SYSLINUX_MENU}" in + false|menu) + # Adding syslinux hardcoded default label entry + Syslinux_live_entry "linux" "" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" + ;; +esac + +# Assembling debian-installer configuration +if [ "${LH_DEBIAN_INSTALLER}" != "false" ] +then + VMLINUZ_DI="vmlinuz" + INITRD_DI="initrd.gz" + APPEND_DI="vga=normal" + + VMLINUZ_GI="gtk/vmlinuz" + INITRD_GI="gtk/initrd.gz" + APPEND_GI="video=vesa:ywrap,mtrr vga=788" + + if [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${VMLINUZ_DI}" ] && [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${INITRD_DI}" ] + then + Syslinux_install_entry "Text" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" + fi + + if [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${VMLINUZ_GI}" ] && [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${INITRD_GI}" ] + then + Syslinux_install_entry "GUI" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}" + fi +fi + +# Assembling memtest configuration +if [ -f "${KERNEL_PATH}"/memtest ] +then + Syslinux_memtest_entry "memtest" "${LH_SYSLINUX_MENU_MEMTEST_ENTRY}" "memtest" +fi + +# Copy templates to base syslinux directory +Copy_syslinux_templates + +# Fill in templates with created values +Configure_syslinux_templates + +# Configure syslinux setup per boot method +case "${LH_BINARY_IMAGES}" in + iso) + case "${LH_CHROOT_BUILD}" in + true) + cp chroot/usr/lib/syslinux/isolinux.bin ${SCREEN_PATH} + ;; + false) + cp /usr/lib/syslinux/isolinux.bin ${SCREEN_PATH} + ;; + esac + + mv ${SCREEN_PATH}/syslinux.cfg ${SCREEN_PATH}/isolinux.cfg + + # Copying configuration file + if [ -n "${LH_SYSLINUX_CFG}" ] + then + cp "${LH_SYSLINUX_CFG}" ${SCREEN_PATH}/isolinux.cfg + fi + ;; + + net) + case "${LH_CHROOT_BUILD}" in + true) + cp chroot/usr/lib/syslinux/pxelinux.0 ${KERNEL_PATH} + ;; + false) + cp /usr/lib/syslinux/pxelinux.0 ${KERNEL_PATH} + ;; + esac + + mkdir -p ${KERNEL_PATH}/pxelinux.cfg + ln -s ${LIVE_KERNEL_PATH}/pxelinux.cfg ${SYSLINUX_PATH}/pxelinux.cfg + ln -s ${LIVE_KERNEL_PATH}/pxelinux.0 ${SYSLINUX_PATH}/pxelinux.0 + + # Adjusting include pathes + for FILE in ${SCREEN_PATH}/*.cfg + do + sed -i -e "s|^include |include ${LIVE_SCREEN_PATH}/|g" "${FILE}" + done + + sed -i -e "s| f| ${LIVE_SCREEN_PATH}/f|g" ${SCREEN_PATH}/prompt.cfg + + mv ${SCREEN_PATH}/syslinux.cfg ${KERNEL_PATH}/pxelinux.cfg/default + + # Copying configuration file + if [ -n "${LH_SYSLINUX_CFG}" ] + then + cp "${LH_SYSLINUX_CFG}" ${KERNEL_PATH}/pxelinux.cfg/default + fi + ;; + + tar|usb-hdd) + case "${LH_CHROOT_BUILD}" in + true) + cp chroot/usr/lib/syslinux/isolinux.bin ${SCREEN_PATH}/syslinux.bin + ;; + false) + cp /usr/lib/syslinux/isolinux.bin ${SCREEN_PATH}/syslinux.bin + ;; + esac + + # Copying configuration file + if [ -n "${LH_SYSLINUX_CFG}" ] + then + cp "${LH_SYSLINUX_CFG}" ${SCREEN_PATH}/syslinux.cfg + fi + ;; +esac + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/binary_syslinux diff --git a/helpers/binary_tar b/helpers/binary_tar new file mode 100755 index 000000000..019b42f44 --- /dev/null +++ b/helpers/binary_tar @@ -0,0 +1,52 @@ +#!/bin/sh + +# lh_binary_tar(1) - build harddisk binary image +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build harddisk binary image')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if ! In_list tar "${LH_BINARY_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building binary harddisk image..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_tar + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Remove old binary +rm -f binary.tar.gz + +tar cf binary-tar.tar binary +gzip ${GZIP_OPTIONS} binary-tar.tar + +# Creating stage file +Create_stagefile .stage/binary_tar diff --git a/helpers/binary_usb-hdd b/helpers/binary_usb-hdd new file mode 100755 index 000000000..53d9e37c0 --- /dev/null +++ b/helpers/binary_usb-hdd @@ -0,0 +1,280 @@ +#!/bin/sh + +# lh_binary_usb-hdd(1) - build binary usb-hdd image +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build binary image')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if ! In_list usb-hdd "${LH_BINARY_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building binary usb-hdd image..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap .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/share/doc/mtools mtools +Check_package chroot/sbin/parted parted + +if [ "${LH_ARCHITECTURE}" = "sparc" ] +then + case "${LH_BINARY_FILESYSTEM}" in + ext2|ext3) + Check_package chroot/sbin/mkfs.ext2 e2fsprogs + ;; + + *) + Echo_error "Sparc only supports booting from ext2, ext3 (or ufs)" + exit 1 + ;; + esac +fi + +case "${LH_BOOTLOADER}" in + grub) + Check_package chroot/usr/sbin/grub grub + ;; + + syslinux) + Check_package chroot/usr/bin/syslinux syslinux + ;; +esac + +# Restoring cache +Restore_cache cache/packages_binary + +# Installing depends +Install_package + +# Remove old binary +if [ -f binary.img ] +then + rm -f binary.img +fi + +# Enforce fat32 if we find individual files bigger than 2GB +if [ "${LH_BINARY_FILESYSTEM}" = "fat16" ] && [ -n "$(find binary -size +1999M)" ] +then + Echo_warning "FAT16 doesn't support files larger than 2GB, automatically enforcing FAT32." + + LH_BINARY_FILESYSTEM="fat32" + export LH_BINARY_FILESYSTEM +fi + +# Enforce fat32 if we have images in total bigger than 2GB +if [ "${LH_BINARY_FILESYSTEM}" = "fat16" ] && [ "$(du -s binary | awk '{ print $1 }')" -gt "1900000" ] +then + Echo_warning "FAT16 doesn't support partitions larger than 2GB, automatically enforcing FAT32" + + LH_BINARY_FILESYSTEM="fat32" + export LH_BINARY_FILESYSTEM +fi + +# Everything which comes here needs to be cleaned up, +DU_DIM="$(du -ms binary | cut -f1)" +REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LH_BINARY_FILESYSTEM})" +dd if=/dev/zero of=chroot/binary.img bs=1024k count=0 seek=${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 !!!" +Losetup $FREELO chroot/binary.img 0 + +case "${LH_ARCHITECTURE}" in + sparc) + PARTITION_TABLE_TYPE="sun" + ;; + *) + PARTITION_TABLE_TYPE="msdos" + ;; +esac + +case "${LH_BINARY_FILESYSTEM}" in + ext2|ext3) + PARTITION_TYPE="ext2" + ;; + + fat16|fat32) + PARTITION_TYPE="${LH_BINARY_FILESYSTEM}" + ;; + + *) + Echo_error "Unsupported binary filesystem %s" "${LH_BINARY_FILESYSTEM}" + exit 1 + ;; +esac + +case "${LH_CHROOT_BUILD}" in + true) + Chroot chroot "parted -s ${FREELO} mklabel ${PARTITION_TABLE_TYPE}" || true + Chroot chroot "parted -s ${FREELO} mkpart primary ${PARTITION_TYPE} 0.0 100%" || true + Chroot chroot "parted -s ${FREELO} set 1 boot on" || true + Chroot chroot "parted -s ${FREELO} set 1 lba off" || true + + if [ "${LH_BOOTLOADER}" = "syslinux" ] + then + dd if=chroot/usr/lib/syslinux/mbr.bin of=${FREELO} bs=440 count=1 + fi + ;; + + false) + parted -s ${FREELO} mklabel ${PARTITION_TABLE_TYPE} || true + parted -s ${FREELO} mkpart primary ${PARTITION_TYPE} 0.0 100% || true + parted -s ${FREELO} set 1 boot on || true + parted -s ${FREELO} set 1 lba off || true + + if [ "${LH_BOOTLOADER}" = "syslinux" ] + then + dd if=/usr/lib/syslinux/mbr.bin of=${FREELO} bs=440 count=1 + fi + ;; +esac + +sleep 1 +${LH_LOSETUP} -d ${FREELO} + +FREELO="$(${LH_LOSETUP} -f)" +Losetup $FREELO chroot/binary.img 1 + +case "${LH_BINARY_FILESYSTEM}" in + ext2|ext3) + MKFS="${LH_BINARY_FILESYSTEM}" + MKFS_OPTIONS="-L DEBIAN_LIVE -m 0" + ;; + + fat16) + MKFS="vfat" + MKFS_OPTIONS="-F 16 -n DEBIAN_LIVE" + ;; + + fat32) + MKFS="vfat" + MKFS_OPTIONS="-F 32 -n DEBIAN_LIVE" + ;; +esac + +case "${LH_CHROOT_BUILD}" in + true) + Chroot chroot "mkfs.${MKFS} ${MKFS_OPTIONS} ${FREELO}" + ;; + + false) + mkfs.${MKFS} ${MKFS_OPTIONS} ${FREELO} + ;; +esac + +case "${LH_BINARY_FILESYSTEM}" in + fat*) + CP_OPTIONS="-L" + ;; +esac + +mkdir -p chroot/binary.tmp +${LH_ROOT_COMMAND} mount ${FREELO} chroot/binary.tmp +cp -r -T ${CP_OPTIONS} binary/ chroot/binary.tmp + +FIXME() +{ +if [ "${LH_BOOTLOADER}" = "grub" ] +then + +cat > chroot/grub.sh << EOF +cd binary.tmp +grub --batch << EOM +find /live/vmlinuz +EOM +EOF + + rootpartition="$(Chroot chroot 'sh grub.sh' 2>/dev/null | grep -A 1 'find /live/vmlinuz' | grep -v 'find /live/vmlinuz')" + usbdev="$(echo $rootpartition | sed -e 's|,[[:digit:]]||')" + echo "Root partition is $rootpartition, device is: $usbdev" + + echo "WAITING..." && read WAIT + +#cat > chroot/grub.sh << EOF +#grub --batch << EOM +#root $rootpartition +#setup $usbdev +#EOM +#EOF + +#Chroot chroot "sh grub.sh" + + rm -f chroot/grub.sh +fi +} + +${LH_ROOT_COMMAND} umount chroot/binary.tmp +rmdir chroot/binary.tmp + +if [ "${LH_BOOTLOADER}" = "syslinux" ] +then + case "${LH_CHROOT_BUILD}" in + true) + Chroot chroot "syslinux ${FREELO}" + ;; + + false) + syslinux ${FREELO} + ;; + esac +fi + +sleep 1 +${LH_LOSETUP} -d ${FREELO} + +echo "!!! The above error/warning messages can be ignored !!!" + +if [ -n "${MAKEDEV}" ] +then + rm -rf chroot/dev + mv chroot/dev.tmp chroot/dev +fi + +mv chroot/binary.img ./ + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/binary_usb-hdd diff --git a/helpers/binary_virtual-hdd b/helpers/binary_virtual-hdd new file mode 100755 index 000000000..6a65d1922 --- /dev/null +++ b/helpers/binary_virtual-hdd @@ -0,0 +1,110 @@ +#!/bin/sh + +# lh_binary_virtual-hdd(1) - build binary virtual-hdd image +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build binary image')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if ! In_list virtual-hdd "${LH_BINARY_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building binary virtual-hdd image..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap .stage/chroot_proc + +# Checking stage file +Check_stagefile .stage/binary_virtual-hdd + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ "${LH_CHROOT_BUILD}" = "true" ] +then + case "${LH_BINARY_FILESYSTEM}" in + ext2|ext3) + Check_package chroot/sbin/mkfs.ext2 e2fsprogs + ;; + esac +fi + +# Restoring cache +Restore_cache cache/packages_binary + +# Installing depends +Install_package + +# Remove old binary +if [ -f binary-virtual.img ] +then + rm -f binary-virtual.img +fi + +Echo_message "Creating virtual disk image..." +dd if=/dev/zero of=binary-virtual.img bs=1024k count=0 seek=${LH_VIRTUAL_ROOT_SIZE} + +if [ "${LH_CHROOT_BUILD}" = "true" ] +then + mv binary-virtual.img chroot + + case "${LH_BINARY_FILESYSTEM}" in + ext2) + Chroot chroot "mkfs.ext2 -F binary-virtual.img" + ;; + + ext3) + Chroot chroot "mkfs.ext3 -F binary-virtual.img" + ;; + esac + + mv chroot/binary-virtual.img ./ +else + case "${LH_BINARY_FILESYSTEM}" in + ext2) + mkfs.ext2 -F binary-virtual.img + ;; + + ext3) + mkfs.ext3 -F binary-virtual.img + ;; + esac +fi + +mkdir -p binary.tmp +${LH_ROOT_COMMAND} mount -o loop binary-virtual.img binary.tmp +cp -a binary/ binary.tmp + +${LH_ROOT_COMMAND} umount binary.tmp +rmdir binary.tmp + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/binary_virtual-hdd diff --git a/helpers/binary_win32-loader b/helpers/binary_win32-loader new file mode 100755 index 000000000..685121828 --- /dev/null +++ b/helpers/binary_win32-loader @@ -0,0 +1,97 @@ +#!/bin/sh + +# lh_binary_win32-loader(1) - copy win32-loader into binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'copy win32-loader into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_WIN32_LOADER}" != "true" ] || [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + +Echo_message "Begin copying win32-loader..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_win32-loader + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +case "${LH_ARCHITECTURE}" in + amd64|i386) + if [ "${LH_CHROOT_BUILD}" = "true" ] + then + # Checking depends + Check_package chroot/usr/lib/win32-loader/win32-loader.exe win32-loader + + # Restoring cache + Restore_cache cache/packages_binary + + # Installing depends + Install_package + + # Copying win32-loader + cp chroot/usr/lib/win32-loader/* binary + else + cp /usr/lib/win32-loader/* binary + fi + + mv binary/win32-loader.exe binary/setup.exe + + if [ "${LH_DEBIAN_INSTALLER}" != "false" ] + then + +cat > binary/win32-loader.ini << EOF +[installer] +arch=${LH_ARCHITECTURE} +i386/linux=install/vmlinuz +i386/initrd=install/initrd.gz +i386/gtk/linux=install/vmlinuz +i386/gtk/initrd=install/gtk/initrd.gz + +[grub] +g2ldr=g2ldr +g2ldr.mbr=g2ldr.mbr +EOF + + fi + + # Saving cache + Save_cache cache/packages_binary + + # Removing depends + Remove_package + ;; + + *) + Echo_warning "win32-loader inclusion is set to true but not compatible with your architecture, ignoring." + ;; +esac + +# Creating stage file +Create_stagefile .stage/binary_win32-loader diff --git a/helpers/binary_yaboot b/helpers/binary_yaboot new file mode 100755 index 000000000..fdd857d99 --- /dev/null +++ b/helpers/binary_yaboot @@ -0,0 +1,313 @@ +#!/bin/sh + +# lh_binary_yaboot(1) - installs yaboot into binary +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'installs yaboot into binary')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BOOTLOADER}" != "yaboot" ] +then + exit 0 +fi + +Echo_message "Begin installing yaboot..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/binary_yaboot + +# Checking yaboot templates +Check_templates yaboot + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Check architecture +Check_architecture powerpc ppc64 +Check_crossarchitecture + +# Checking depends +Check_package chroot/usr/lib/yaboot/yaboot yaboot + +# Restoring cache +Restore_cache cache/packages_binary + +# Installing depends +Install_package + +# Local functions +Yaboot_live_entry () +{ + LABEL="${1}" + KERNEL="${2}" + INITRD="${3}" + APPEND="${4}" + + DIRECTORY="/$(basename ${DESTDIR_LIVE})" + + LINUX_LIVE="${LINUX_LIVE}\nimage=${DIRECTORY}/${KERNEL}\n" + LINUX_LIVE="${LINUX_LIVE}\tlabel=${LABEL}\n" + LINUX_LIVE="${LINUX_LIVE}\tinitrd=${DIRECTORY}/${INITRD}\n" + LINUX_LIVE="${LINUX_LIVE}\tappend=\"boot=${INITFS} LH_BOOTAPPEND_LIVE ${APPEND}\"\n" + LINUX_LIVE="${LINUX_LIVE}\tinitrd-size=10240\n" +} + +Yaboot_install_entry () +{ + LABEL="${1}" + KERNEL="${2}" + INITRD="${3}" + APPEND="${4}" + + DIRECTORY="/$(basename ${DESTDIR_INSTALL})" + + QAPPEND="quiet" + + for TYPE in Install Expert Rescue Auto + do + case "${TYPE}" in + Install) + TAPPEND="${APPEND} ${QAPPEND}" + ;; + + Expert) + TAPPEND="priority=low ${APPEND}" + ;; + + Rescue) + TAPPEND="rescue/enable=true ${APPEND} ${QAPPEND}" + ;; + + Auto) + TAPPEND="auto=true priority=critical ${APPEND} ${QAPPEND}" + ;; + esac + + case "${LABEL}" in + Text) + TYPE_SUFFIX="" + ;; + GUI) + TYPE_SUFFIX="gui" + ;; + esac + + LINUX_INSTALL="${LINUX_INSTALL}\nimage=${DIRECTORY}/${KERNEL}\n" + LINUX_INSTALL="${LINUX_INSTALL}\tlabel=${TYPE}${TYPE_SUFFIX}\n" + LINUX_INSTALL="${LINUX_INSTALL}\tinitrd=${DIRECTORY}/${INITRD}\n" + LINUX_INSTALL="${LINUX_INSTALL}\tappend=\"${TAPPEND} ${LH_BOOTAPPEND_INSTALL}\"\n" + LINUX_INSTALL="${LINUX_INSTALL}\tinitrd-size=10240\n" + done +} + +case "${LH_INITRAMFS}" in + casper) + INITFS="casper" + ;; + + live-initramfs) + INITFS="live" + ;; +esac + +# Setting destination directory +case "${LH_BINARY_IMAGES}" in + iso) + case "${LH_INITRAMFS}" in + casper) + DESTDIR_LIVE="binary/casper" + ;; + + live-initramfs) + DESTDIR_LIVE="binary/live" + ;; + esac + + DESTDIR_INSTALL="binary/install" + ;; + + net|tar|usb-hdd) + Echo_error "not yet supported, aborting (FIXME)." + exit 1 + ;; +esac + +Check_multiarchitecture + +# Creating directory +mkdir -p "${DESTDIR_LIVE}" + +# Setting boot parameters +case "${LH_ENCRYPTION}" in + ""|false) + ;; + *) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} encryption=${LH_ENCRYPTION}" + ;; +esac + +if [ -n "${LH_USERNAME}" ] +then + case "${LH_INITRAMFS}" in + casper) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" + ;; + + live-initramfs) + if [ "${LH_USERNAME}" != "user" ] + then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" + fi + ;; + esac +fi + +if [ -n "${LH_HOSTNAME}" ] +then + case "${LH_INITRAMFS}" in + casper) + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" + ;; + + live-initramfs) + if [ "${LH_HOSTNAME}" != "debian" ] + then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" + fi + ;; + esac +fi + +if [ "${LH_UNION_FILESYSTEM}" != "unionfs" ] +then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}" +fi + +if [ -n "${LH_NET_COW_PATH}" ] +then + Echo_error "Net cow not yet supported on yaboot" + exit 1 +fi + +if [ "${LH_EXPOSED_ROOT}" != "false" ] +then + LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} exposedroot" +fi + +LH_BOOTAPPEND_LIVE="$(echo ${LH_BOOTAPPEND_LIVE} | sed -e 's| ||')" + +# Parameters are listed at: linux/Documentation/kernel-parameters.txt +FAILSAFE="noapic noapm nodma nomce nolapic nosmp vga=ofonly" + +# Assembling kernel configuration + +# Default entries +DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" +DEFAULT_KERNEL="$(basename chroot/boot/vmlinux-*${DEFAULT_FLAVOUR})" +DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinux-||')" + +Yaboot_live_entry "live" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" +Yaboot_live_entry "live-failsafe" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" "${FAILSAFE}" + +if [ "$(echo ${LH_LINUX_FLAVOURS} | wc -w)" -gt "1" ] +then + for KERNEL in chroot/boot/vmlinux-* + do + KERNEL_IMAGE="$(basename ${KERNEL})" + KERNEL_VERSION="$(echo ${KERNEL_IMAGE} | sed -e 's|vmlinux-||')" + INITRD="initrd.img-${KERNEL_VERSION}" + + Yaboot_live_entry "live-${KERNEL_VERSION}" "${KERNEL_IMAGE}" "${INITRD}" + Yaboot_live_entry "live-${KERNEL_VERSION}-failsafe" "${KERNEL_IMAGE}" "${INITRD}" "${FAILSAFE}" + done +fi + +LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" + +# Assembling debian-installer configuration +if [ "${LH_DEBIAN_INSTALLER}" != "false" ] +then + VMLINUZ_DI="vmlinuz" + INITRD_DI="initrd.gz" + APPEND_DI="vga=normal" + + VMLINUZ_GI="gtk/vmlinuz" + INITRD_GI="gtk/initrd.gz" + APPEND_GI="video=vesa:ywrap,mtrr vga=788" + + if [ -f "binary/${DESTDIR_INSTALL}/${VMLINUZ_DI}" ] && [ -f "binary/${DESTDIR_INSTALL}/${INITRD_DI}" ] + then + Yaboot_install_entry "Text" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" + fi + + if [ -f "binary/${DESTDIR_INSTALL}/${VMLINUZ_GI}" ] && [ -f "binary/${DESTDIR_INSTALL}/${INITRD_GI}" ] + then + Yaboot_install_entry "GUI" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}" + fi +fi + +LINUX_INSTALL="$(/bin/echo ${LINUX_INSTALL} | sed -e 's|binary||g' -e 's|//|/|g')" + +case "${LH_BINARY_IMAGES}" in + iso|usb-hdd) + # Copying yaboot + mkdir -p binary/yaboot + + case "${LH_CHROOT_BUILD}" in + true) + cp chroot/usr/lib/yaboot/yaboot binary/yaboot + ;; + + false) + cp /usr/lib/yaboot/yaboot binary/yaboot + ;; + esac + + cp -r "${TEMPLATES}"/* binary/yaboot + + if [ "${LH_BINARY_IMAGES}" = "usb-hdd" ] + then + mv binary/yaboot/yaboot.conf binary/yaboot/yaboot.conf.tmp + echo "root=/dev/ram" > binary/yaboot/yaboot.conf + cat binary/yaboot/yaboot.conf.tmp >> binary/yaboot/yaboot.conf + rm -f binary/yaboot/yaboot.conf.tmp + fi + + # Configure yaboot templates + sed -i -e "s|LINUX_LIVE|${LINUX_LIVE}|" -e "s|LINUX_INSTALL|${LINUX_INSTALL}|" binary/yaboot/yaboot.conf + sed -i -e "s|LH_BOOTAPPEND_INSTALL|${LH_BOOTAPPEND_INSTALL}|" -e "s|LH_BOOTAPPEND_LIVE|${LH_BOOTAPPEND_LIVE}|" binary/yaboot/yaboot.conf + sed -i -e "s|LH_DATE|$(date +%Y%m%d)|" -e "s|LH_VERSION|${VERSION}|" binary/yaboot/boot.msg + ;; +esac + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/binary_yaboot diff --git a/helpers/bootstrap b/helpers/bootstrap new file mode 100755 index 000000000..823c4654a --- /dev/null +++ b/helpers/bootstrap @@ -0,0 +1,34 @@ +#!/bin/sh + +# lh_bootstrap(1) - bootstrap a Debian system +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'bootstrap a Debian system')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Setup cleanup function +Setup_cleanup + +# Bootstrapping system +lh bootstrap_cache restore ${*} +lh bootstrap_copy ${*} +lh bootstrap_cdebootstrap ${*} +lh bootstrap_debootstrap ${*} +lh bootstrap_cache save ${*} diff --git a/helpers/bootstrap_cache b/helpers/bootstrap_cache new file mode 100755 index 000000000..a0254283f --- /dev/null +++ b/helpers/bootstrap_cache @@ -0,0 +1,93 @@ +#!/bin/sh + +# lh_bootstrap_cache(1) - cach bootstrap stage +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'cache bootstrap stage')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Check architecture +Check_crossarchitecture + +Echo_message "Begin caching bootstrap stage..." + +for STAGE in ${LH_CACHE_STAGES} +do + if [ "${STAGE}" = "bootstrap" ] + then + case "${1}" in + restore) + # Checking stage file + Check_stagefile .stage/bootstrap_cache.restore + + if [ -d cache/stages_bootstrap ] + then + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Removing old chroot + rm -rf chroot + + # Restoring old cache + ${LH_ROOT_COMMAND} cp -a cache/stages_bootstrap chroot + + if [ -n "${LH_ROOT_COMMAND}" ] + then + ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot + fi + + # Creating stage file + Create_stagefile .stage/bootstrap_cache.restore + Create_stagefile .stage/bootstrap + + exit 0 + fi + ;; + + save) + # Checking stage file + Check_stagefile .stage/bootstrap_cache.save + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + rm -rf cache/stages_bootstrap + + mkdir -p cache + + ${LH_ROOT_COMMAND} cp -a chroot cache/stages_bootstrap + + if [ -n "${LH_ROOT_COMMAND}" ] + then + ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/stages_bootstrap + fi + + # Creating stage file + Create_stagefile .stage/bootstrap_cache.save + ;; + esac + fi +done diff --git a/helpers/bootstrap_cdebootstrap b/helpers/bootstrap_cdebootstrap new file mode 100755 index 000000000..1f9340b3a --- /dev/null +++ b/helpers/bootstrap_cdebootstrap @@ -0,0 +1,180 @@ +#!/bin/sh + +# lh_bootstrap_cdebootstrap(1) - bootstrap a Debian system with cdebootstrap(1) +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'bootstrap a Debian system with cdebootstrap(1)')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BOOTSTRAP}" != "cdebootstrap" ] && [ "${LH_BOOTSTRAP}" != "cdebootstrap-static" ] +then + exit 0 +fi + +# Check architecture +Check_crossarchitecture + +Echo_message "Begin bootstrapping system..." + +Check_package /usr/bin/${LH_BOOTSTRAP} cdebootstrap + +# Ensure that a system is built as root +lh testroot + +# Checking stage file +Check_stagefile .stage/bootstrap +Check_stagefile .stage/bootstrap_cache.restore + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Creating chroot directory +mkdir -p chroot + +# Setting cdebootstrap options +if [ -n "${LH_ARCHITECTURE}" ] +then + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --arch=${LH_ARCHITECTURE}" +fi + +if [ -n "${LH_BOOTSTRAP_CONFIG}" ] +then + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --suite-config=${LH_BOOTSTRAP_CONFIG}" +fi + +if [ -n "${LH_BOOTSTRAP_INCLUDE}" ] +then + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --include=$(echo ${LH_BOOTSTRAP_INCLUDE} | sed 's| *|,|g')" +fi + +if [ -n "${LH_BOOTSTRAP_EXCLUDE}" ] +then + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LH_BOOTSTRAP_EXCLUDE} | sed 's| *|,|g')" +fi + +if [ -n "${LH_BOOTSTRAP_KEYRING}" ] +then + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --keyring=${LH_BOOTSTRAP_KEYRING}" +fi + +if [ -z "${LH_BOOTSTRAP_FLAVOUR}" ] +then + case "${LH_PACKAGES_LISTS}" in + stripped|minimal) + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=minimal" + ;; + *) + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=standard" + ;; + esac +else + case "${LH_BOOTSTRAP_FLAVOUR}" in + stripped|minimal) + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=minimal" + ;; + + *) + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=${LH_BOOTSTRAP_FLAVOUR}" + ;; + esac +fi + +if [ "${_DEBUG}" = "true" ] +then + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --debug" +fi + +if [ "${_QUIET}" = "true" ] +then + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --quiet" +fi + +if [ "${_VERBOSE}" = "true" ] +then + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --verbose" +fi + +if [ "${LH_APT_SECURE}" = "false" ] +then + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --allow-unauthenticated" +fi + +if [ -x "/usr/bin/cdebootstrap" ] || [ -x "/usr/bin/cdebootstrap-static" ] +then + if [ "${LH_CACHE_PACKAGES}" = "true" ] + then + if [ -d cache/packages_bootstrap ] + then + mkdir -p chroot/var/cache/bootstrap + cp cache/packages_bootstrap/*.deb chroot/var/cache/bootstrap + fi + + Echo_breakage "Running ${LH_BOOTSTRAP} (download-only)... " + ${LH_ROOT_COMMAND} ${LH_BOOTSTRAP} ${CDEBOOTSTRAP_OPTIONS} --download-only "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" + + if [ -n "${LH_ROOT_COMMAND}" ] + then + ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot + fi + + # Removing old cache + if [ -d cache/packages_bootstrap ] + then + rm -f cache/packages_bootstrap/*.deb + fi + + # Saving new cache + mkdir -p cache/packages_bootstrap + + cp chroot/var/cache/bootstrap/*.deb cache/packages_bootstrap + fi + + Echo_breakage "Running ${LH_BOOTSTRAP}... " + ${LH_ROOT_COMMAND} ${LH_BOOTSTRAP} ${CDEBOOTSTRAP_OPTIONS} "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" + + if [ -n "${LH_ROOT_COMMAND}" ] + then + ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot + fi + + # Remove cdebootstrap-helper-diverts (needed at least for minimal flavours) + case "${LH_PACKAGES_LISTS}" in + stripped|minimal) + Chroot chroot "dpkg -P cdebootstrap-helper-diverts" + ;; + esac + + # Deconfiguring cdebootstrap configurations + rm -f chroot/etc/apt/sources.list + rm -f chroot/etc/hosts + rm -f chroot/etc/resolv.conf + + # Removing bootstrap cache + rm -rf chroot/var/cache/bootstrap + + # Creating stage file + Create_stagefile .stage/bootstrap +else + Echo_error "Can't process file /usr/bin/${LH_BOOTSTRAP} (FIXME)" + exit 1 +fi diff --git a/helpers/bootstrap_copy b/helpers/bootstrap_copy new file mode 100755 index 000000000..456c89dce --- /dev/null +++ b/helpers/bootstrap_copy @@ -0,0 +1,55 @@ +#!/bin/sh + +# lh_bootstrap_copy(1) - bootstrap by copying the host system +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'bootstrap by copying the host system')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BOOTSTRAP}" != "copy" ] +then + exit 0 +fi + +# Check architecture +Check_crossarchitecture + +Echo_message "Begin bootstrapping system..." + +# Ensure that a system is built as root +lh testroot + +# Checking stage file +Check_stagefile .stage/bootstrap + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Copying host system +mkdir chroot +cd chroot +tar c / --exclude /proc --exclude /sys --exclude "$(dirname ${PWD})" | tar xv +cd .. + +# Creating stage file +Create_stagefile .stage/bootstrap diff --git a/helpers/bootstrap_debootstrap b/helpers/bootstrap_debootstrap new file mode 100755 index 000000000..b1a53493e --- /dev/null +++ b/helpers/bootstrap_debootstrap @@ -0,0 +1,161 @@ +#!/bin/sh + +# lh_bootstrap_debootstrap(1) - bootstrap a Debian system with debootstrap(8) +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'bootstrap a Debian system with debootstrap(8)')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_BOOTSTRAP}" != "debootstrap" ] +then + exit 0 +fi + +# Check architecture +Check_crossarchitecture + +Echo_message "Begin bootstrapping system..." + +Check_package /usr/sbin/debootstrap debootstrap + +# Ensure that a system is built as root +lh testroot + +# Checking stage file +Check_stagefile .stage/bootstrap +Check_stagefile .stage/bootstrap_cache.restore + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Creating chroot directory +mkdir -p chroot + +# Setting debootstrap options +if [ -n "${LH_ARCHITECTURE}" ] +then + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --arch ${LH_ARCHITECTURE}" +fi + +if [ "${LH_ARCHIVE_AREAS}" != "main" ] +then + # Modify archive areas to remove leading/trailing whitespaces and replace other whitepspace with commas + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --components $(echo ${LH_ARCHIVE_AREAS} | sed -e 's| |,|g')" +fi + +if [ -n "${LH_BOOTSTRAP_CONFIG}" ] +then + if [ -d "/usr/share/debootstrap/scripts/" ] + then + LH_DEBOOTSTRAP_SCRIPT="/usr/share/debootstrap/scripts/${LH_BOOTSTRAP_CONFIG}" + else + LH_DEBOOTSTRAP_SCRIPT="/usr/lib/debootstrap/scripts/${LH_BOOTSTRAP_CONFIG}" + fi +fi + +if [ -n "${LH_BOOTSTRAP_INCLUDE}" ] +then + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --include=$(echo ${LH_BOOTSTRAP_INCLUDE} | sed 's| *|,|g')" +fi + +if [ -n "${LH_BOOTSTRAP_EXCLUDE}" ] +then + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LH_BOOTSTRAP_EXCLUDE} | sed 's| *|,|g')" +fi + +if [ "${LH_USE_FAKEROOT}" != "true" ] +then + if [ -z "${LH_BOOTSTRAP_FLAVOUR}" ] + then + if In_list "stripped minimal" "${LH_PACKAGES_LISTS}" + then + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=minbase" + fi + else + case "${LH_BOOTSTRAP_FLAVOUR}" in + stripped|minimal) + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=minbase" + ;; + standard) + ;; + + *) + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=${LH_BOOTSTRAP_FLAVOUR}" + esac + fi +else + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=fakechroot" +fi + +if [ "${_VERBOSE}" = "true" ] +then + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --verbose" +fi + +if [ -x "/usr/sbin/debootstrap" ] +then + if [ "${LH_CACHE_PACKAGES}" = "true" ] + then + if [ -d cache/packages_bootstrap ] + then + mkdir -p chroot/var/cache/apt/archives + cp cache/packages_bootstrap/*.deb chroot/var/cache/apt/archives + fi + + Echo_breakage "Running debootstrap (download-only)... " + ${LH_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" "${LH_DEBOOTSTRAP_SCRIPT}" + + if [ -n "${LH_ROOT_COMMAND}" ] + then + ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot + fi + + # Removing old cache + if [ -d cache/packages_bootstrap ] + then + rm -f cache/packages_bootstrap/*.deb + fi + + # Saving new cache + mkdir -p cache/packages_bootstrap + + cp chroot/var/cache/apt/archives/*.deb cache/packages_bootstrap + fi + + Echo_breakage "Running debootstrap... " + ${LH_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" "${LH_DEBOOTSTRAP_SCRIPT}" + + if [ -n "${LH_ROOT_COMMAND}" ] + then + ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot + fi + + # Removing bootstrap cache + rm -f chroot/var/cache/apt/archives/*.deb + + # Creating stage file + Create_stagefile .stage/bootstrap +else + Echo_error "Can't process file /usr/bin/debootstrap (FIXME)" + exit 1 +fi diff --git a/helpers/build b/helpers/build new file mode 100755 index 000000000..835ad8e2c --- /dev/null +++ b/helpers/build @@ -0,0 +1,67 @@ +#!/bin/sh + +# lh_build(1) - build a Debian Live system +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Read meta config +if [ "${1}" != "noautoconfig" ] && [ -x auto/build ] +then + ./auto/build ${@} +fi + +if [ "${1}" = "noautoconfig" ] +then + shift +fi + +# Setting static variables +DESCRIPTION="$(Echo 'build a Debian Live system')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +if [ ! -d config ] +then + Echo_warning "No config/ directory; using defaults for all options" +fi + +if [ "$(pwd)" = "/" ] +then + Echo_error "Cannot build live image from the root directory (/)" + exit 1 +fi + +if echo $(pwd) | grep -qs " " +then + Echo_error "Cannot build live image from a directory containing spaces" + exit 1 +fi + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Checking defaults +Check_defaults + +# Bootstrapping system +lh bootstrap ${*} + +# Customizing chroot +lh chroot ${*} + +# Building binary images +lh binary ${*} + +# Building source images +lh source ${*} diff --git a/helpers/chroot b/helpers/chroot new file mode 100755 index 000000000..65c5e659f --- /dev/null +++ b/helpers/chroot @@ -0,0 +1,78 @@ +#!/bin/sh + +# lh_chroot(1) - customize the Debian system +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'customize the Debian system')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Setup cleanup function +Setup_cleanup + +# Configuring chroot +lh chroot_cache restore ${*} +lh chroot_devpts install ${*} +lh chroot_proc install ${*} +lh chroot_selinuxfs install ${*} +lh chroot_sysfs install ${*} +lh chroot_debianchroot install ${*} +lh chroot_dpkg install ${*} +lh chroot_sysv-rc install ${*} +lh chroot_hosts install ${*} +lh chroot_resolv install ${*} +lh chroot_hostname install ${*} +lh chroot_apt install ${*} +lh chroot_sources install ${*} +lh chroot_linux-image install ${*} + +# Customizing chroot +lh chroot_preseed ${*} +lh chroot_local-preseed ${*} +lh chroot_tasks ${*} +lh chroot_packageslists ${*} +lh chroot_local-packageslists ${*} +lh chroot_packages ${*} +lh chroot_local-packages ${*} +lh chroot_install-packages ${*} +lh chroot_localization ${*} +lh chroot_local-includes ${*} +lh chroot_local-patches ${*} +lh chroot_sysvinit ${*} +lh chroot_local-hooks ${*} +lh chroot_hooks ${*} +lh chroot_symlinks ${*} +lh chroot_hacks ${*} +lh chroot_interactive ${*} + +# Deconfiguring chroot +lh chroot_linux-image remove ${*} +lh chroot_sources remove ${*} +lh chroot_apt remove ${*} +lh chroot_hostname remove ${*} +lh chroot_resolv remove ${*} +lh chroot_hosts remove ${*} +lh chroot_sysv-rc remove ${*} +lh chroot_dpkg remove ${*} +lh chroot_debianchroot remove ${*} +lh chroot_sysfs remove ${*} +lh chroot_selinuxfs remove ${*} +lh chroot_proc remove ${*} +lh chroot_devpts remove ${*} +lh chroot_cache save ${*} diff --git a/helpers/chroot_apt b/helpers/chroot_apt new file mode 100755 index 000000000..6836c2d75 --- /dev/null +++ b/helpers/chroot_apt @@ -0,0 +1,242 @@ +#!/bin/sh + +# lh_chroot_apt(1) - manage /etc/apt/apt.conf +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'manage /etc/apt/apt.conf')" +HELP="" +USAGE="${PROGRAM} {install|install-binary|remove} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +case "${1}" in + install|install-binary) + Echo_message "Configuring file /etc/apt/apt.conf" + + # Checking stage file + Check_stagefile .stage/chroot_apt + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + mkdir -p chroot/etc/apt/apt.conf.d + + # Configuring apt ftp proxy + if [ -n "${LH_APT_FTP_PROXY}" ] + then + echo "Acquire::ftp::Proxy \"${LH_APT_FTP_PROXY}\";" > chroot/etc/apt/apt.conf.d/00ftp-proxy + fi + + # Configuring apt http proxy + if [ -n "${LH_APT_HTTP_PROXY}" ] + then + echo "Acquire::http::Proxy \"${LH_APT_HTTP_PROXY}\";" > chroot/etc/apt/apt.conf.d/00http-proxy + fi + + # Configuring apt pdiffs + case "${LH_APT_PDIFFS}" in + true) + echo "Acquire::PDiffs \"true\";" > chroot/etc/apt/apt.conf.d/00pdiffs + ;; + + false) + echo "Acquire::PDiffs \"false\";" > chroot/etc/apt/apt.conf.d/00pdiffs + ;; + 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 + case "${LH_APT_RECOMMENDS}" in + true) + echo "APT::Install-Recommends \"true\";" > chroot/etc/apt/apt.conf.d/00recommends + echo "Aptitude::Recommends-Important \"true\";" >> chroot/etc/apt/apt.conf.d/00recommends + ;; + + false) + echo "APT::Install-Recommends \"false\";" > chroot/etc/apt/apt.conf.d/00recommends + echo "Aptitude::Recommends-Important \"false\";" >> chroot/etc/apt/apt.conf.d/00recommends + ;; + esac + + # Configuring apt secure + case "${LH_APT_SECURE}" in + true) + echo "APT::Get::AllowUnauthenticated \"false\";" > chroot/etc/apt/apt.conf.d/00secure + echo "Aptitude::CmdLine::Ignore-Trust-Violations \"false\";" >> chroot/etc/apt/apt.conf.d/00secure + ;; + + false) + echo "APT::Get::AllowUnauthenticated \"true\";" > chroot/etc/apt/apt.conf.d/00secure + echo "Aptitude::CmdLine::Ignore-Trust-Violations \"true\";" >> chroot/etc/apt/apt.conf.d/00secure + ;; + esac + + # Configuring apt config + if [ -f config/chroot_apt/apt.conf ] + then + if [ -f chroot/etc/apt/apt.conf ] + then + mv chroot/etc/apt/apt.conf chroot/etc/apt/apt.conf.orig + fi + + cp config/chroot_apt/apt.conf chroot/etc/apt/apt.conf + fi + + # Configuring apt preferences + if [ -f config/chroot_apt/preferences ] + then + if [ -f chroot/etc/apt/preferences ] + then + mv chroot/etc/apt/preferences chroot/etc/apt/preferences.orig + fi + + cp config/chroot_apt/preferences chroot/etc/apt/preferences + fi + + if Find_files config/chroot_local-packages/*.deb + then + echo >> chroot/etc/apt/preferences + echo "# Added by lh_chroot_apt ${@}" >> chroot/etc/apt/preferences + echo "Package: *" >> chroot/etc/apt/preferences + echo "Pin: release o=chroot_local-packages" >> chroot/etc/apt/preferences + + case "${1}" in + install) + # Ensure local packages have priority + echo "Pin-Priority: 1001" >> chroot/etc/apt/preferences + ;; + + install-binary) + # Ensure local packages are not re-installed during lh_binary + echo "Pin-Priority: 99" >> chroot/etc/apt/preferences + + echo >> chroot/etc/apt/preferences + echo "Package: *" >> chroot/etc/apt/preferences + echo "Pin: release o=debian" >> chroot/etc/apt/preferences + echo "Pin-Priority: 99" >> chroot/etc/apt/preferences + ;; + esac + fi + + # Creating stage file + Create_stagefile .stage/chroot_apt + ;; + + remove) + Echo_message "Deconfiguring file /etc/apt/apt.conf" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Deconfiguring aptitude ftp proxy + rm -f chroot/etc/apt/apt.conf.d/00ftp-proxy + + # Deconfiguring aptitude http proxy + rm -f chroot/etc/apt/apt.conf.d/00http-proxy + + # Deconfiguring aptitude pdiffs + if [ "${LH_APT_PDIFFS}" = "true" ] + then + rm -f chroot/etc/apt/apt.conf.d/00pdiffs + fi + + # Deconfiguring aptitude pipeline + rm -f chroot/etc/apt/apt.conf.d/00pipeline + + # Deconfiguring aptitude recommends + if [ "${LH_APT_RECOMMENDS}" = "true" ] + then + rm -f chroot/etc/apt/apt.conf.d/00recommends + fi + + # Deconfiguring aptitude secure + if [ "${LH_APT_SECURE}" = "true" ] + then + rm -f chroot/etc/apt/apt.conf.d/00secure + fi + + # Configuring apt config + if [ -f config/chroot_apt/apt.conf ] + then + if [ -f chroot/etc/apt/apt.conf ] + then + mv chroot/etc/apt/apt.conf chroot/etc/apt/apt.conf.orig + fi + + cp config/chroot_apt/apt.conf chroot/etc/apt/apt.conf + + if [ -f chroot/etc/apt/apt.conf.orig ] + then + mv chroot/etc/apt/apt.conf.orig chroot/etc/apt/apt.conf + fi + fi + + # Deconfiguring apt preferences + if [ -f config/chroot_apt/preferences ] + then + if [ -f chroot/etc/apt/preferences ] + then + mv chroot/etc/apt/preferences chroot/etc/apt/preferences.orig + fi + + cp config/chroot_apt/preferences chroot/etc/apt/preferences + + if [ -f chroot/etc/apt/preferences.orig ] + then + mv chroot/etc/apt/preferences.orig chroot/etc/apt/preferences + fi + fi + + if Find_files config/chroot_local-packages/*.deb + then + if [ -f chroot/etc/apt/preferences ] + then + # delete additions from lh_chroot_apt install|install-binary to preferences + sed -i '/# Added by lh_chroot_apt/,$d' chroot/etc/apt/preferences + # delete the last empty line + sed -i '${/^[[:blank:]]*$/d;}' chroot/etc/apt/preferences + # if the resulting preferences file is empty there was no user additions, remove it + if [ ! -s chroot/etc/apt/preferences ] + then + rm -rf chroot/etc/apt/preferences + fi + fi + + fi + + # Removing stage file + rm -f .stage/chroot_apt + ;; + + *) + Usage + ;; +esac diff --git a/helpers/chroot_cache b/helpers/chroot_cache new file mode 100755 index 000000000..dacf8c023 --- /dev/null +++ b/helpers/chroot_cache @@ -0,0 +1,89 @@ +#!/bin/sh + +# lh_chroot_cache(1) - cach chroot stage +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'cache chroot stage')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin caching chroot stage..." + +for STAGE in ${LH_CACHE_STAGES} +do + if [ "${STAGE}" = "chroot" ] + then + case "${1}" in + restore) + # Checking stage file + Check_stagefile .stage/chroot_cache.restore + + if [ -d cache/stages_chroot ] + then + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Removing old chroot + rm -rf chroot + + # Restoring old cache + ${LH_ROOT_COMMAND} cp -a cache/stages_chroot chroot + + if [ -n "${LH_ROOT_COMMAND}" ] + then + ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot + fi + + # Creating stage file + Create_stagefile .stage/chroot_cache.restore + + exit 0 + fi + ;; + + save) + # Checking stage file + Check_stagefile .stage/chroot_cache.save + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + rm -rf cache/stages_chroot + + mkdir -p cache + + ${LH_ROOT_COMMAND} cp -a chroot cache/stages_chroot + + if [ -n "${LH_ROOT_COMMAND}" ] + then + ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/stages_chroot + fi + + # Creating stage file + Create_stagefile .stage/chroot_cache.save + ;; + esac + fi +done diff --git a/helpers/chroot_debianchroot b/helpers/chroot_debianchroot new file mode 100755 index 000000000..6916d2dad --- /dev/null +++ b/helpers/chroot_debianchroot @@ -0,0 +1,80 @@ +#!/bin/sh + +# lh_chroot_debianchroot(1) - manage /etc/debian_chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'manage /etc/debian_chroot')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /etc/debian_chroot" + + # Checking stage file + Check_stagefile .stage/chroot_debianchroot + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ -f chroot/etc/debian_chroot ] + then + # Save chroot file + mv chroot/etc/debian_chroot chroot/etc/debian_chroot.orig + fi + + # Create chroot file + echo "live" > chroot/etc/debian_chroot + + # Creating stage file + Create_stagefile .stage/chroot_debianchroot + ;; + + remove) + Echo_message "Deconfiguring file /etc/debian_chroot" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ -f chroot/etc/debian_chroot.orig ] + then + # Restore chroot file + mv chroot/etc/debian_chroot.orig chroot/etc/debian_chroot + else + # Remove chroot file + rm -f chroot/etc/debian_chroot + fi + + # Removing stage file + rm -f .stage/chroot_debianchroot + ;; + + *) + Usage + ;; +esac diff --git a/helpers/chroot_devpts b/helpers/chroot_devpts new file mode 100755 index 000000000..9248595d1 --- /dev/null +++ b/helpers/chroot_devpts @@ -0,0 +1,85 @@ +#!/bin/sh + +# lh_chroot_devpts(1) - mount /dev/pts +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'mount /dev/pts')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Ensure that a system is built as root +lh testroot + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +case "${1}" in + install) + Echo_message "Begin mounting /dev/pts..." + + # Checking stage file + Check_stagefile .stage/chroot_devpts + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LH_USE_FAKEROOT}" != "true" ] + then + # Creating mountpoint + mkdir -p chroot/dev/pts + + # Mounting /dev/pts + ${LH_ROOT_COMMAND} mount devpts-live -t devpts chroot/dev/pts || true + fi + + # Creating stage file + Create_stagefile .stage/chroot_devpts + ;; + + remove) + Echo_message "Begin unmounting /dev/pts..." + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Unmounting /dev/pts + if [ "${LH_USE_FAKEROOT}" != "true" ] + then + if grep -qs "$(pwd)/chroot/dev/pts" /proc/mounts || Find_files chroot/dev/pts/* + then + ${LH_ROOT_COMMAND} umount chroot/dev/pts + else + ${LH_ROOT_COMMAND} umount -f chroot/dev/pts > /dev/null 2>&1 || true + fi + fi + + # Removing stage file + rm -f .stage/chroot_devpts + ;; + + *) + Usage + ;; +esac diff --git a/helpers/chroot_dpkg b/helpers/chroot_dpkg new file mode 100755 index 000000000..bf2950a77 --- /dev/null +++ b/helpers/chroot_dpkg @@ -0,0 +1,81 @@ +#!/bin/sh + +# lh_chroot_dpkg(1) - manage /sbin/dpkg +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'manage /sbin/dpkg')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /sbin/start-stop-daemon" + + # Checking stage file + Check_stagefile .stage/chroot_dpkg + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Save start-stop-daemon program + mv chroot/sbin/start-stop-daemon chroot/sbin/start-stop-daemon.orig + + # Create start-stop-daemon program + +cat > chroot/sbin/start-stop-daemon << EOF +#!/bin/sh + +exit 0 +EOF + + chmod 755 chroot/sbin/start-stop-daemon + + # Creating stage file + Create_stagefile .stage/chroot_dpkg + ;; + + remove) + Echo_message "Deconfiguring file /sbin/start-stop-daemon" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Restore start-stop-daemon program + if [ -e chroot/sbin/start-stop-daemon.orig ] + then + mv chroot/sbin/start-stop-daemon.orig chroot/sbin/start-stop-daemon + fi + + # Removing stage file + rm -f .stage/chroot_dpkg + ;; + + *) + Usage + ;; +esac diff --git a/helpers/chroot_hacks b/helpers/chroot_hacks new file mode 100755 index 000000000..66fb36506 --- /dev/null +++ b/helpers/chroot_hacks @@ -0,0 +1,188 @@ +#!/bin/sh + +# lh_chroot_hacks(1) - execute hacks in chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'execute hacks in chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin executing hacks..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_hacks + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Removing udev mac caching rule +rm -f chroot/etc/udev/rules.d/*persistent-net.rules + +case "${LH_BINARY_IMAGES}" in + net) + if [ ! -f chroot/usr/bin/smbmount ] + then + Apt install smbfs + fi + + if [ ! -d chroot/etc/initramfs-tools ] + then + mkdir chroot/etc/initramfs-tools + fi + if [ ! "$(grep 'MODULES=netboot' chroot/etc/initramfs-tools/initramfs.conf)" ] + then + # Configuring initramfs for NFS +cat >> chroot/etc/initramfs-tools/initramfs.conf << EOF +MODULES=netboot +BOOT=nfs +NFSROOT=auto +EOF + fi + ;; +esac + +# Update initramfs (always, because of udev rules in initrd) +Chroot chroot "update-initramfs -k all -t -u" + +# Ensure readable permissions on initramfs. loop-aes-utils sets umask to +# protect GPG keys, which live-helper does not support. +# Note: Use find rather than chmod on the wildcard, one never knows what +# people might do in local hooks, and there might be no initrds at all. +find chroot/boot -name 'initrd*' -print0 | xargs -r -0 chmod go+r + +# Remove build systems clock drift +echo "0.0 0 0.0" > chroot/etc/adjtime + +# Remove cruft +rm -f chroot/boot/initrd*bak* +rm -f chroot/etc/apt/trusted.gpg~ +rm -f chroot/etc/group- chroot/etc/passwd- +rm -f chroot/etc/gshadow- chroot/etc/shadow- +rm -f chroot/var/cache/debconf/*-old +rm -f chroot/var/lib/dpkg/*-old + +if [ -n "${LH_ROOT_COMMAND}" ] +then + ${LH_ROOT_COMMAND} chown -R --quiet $(whoami):$(whoami) chroot +fi + +case "${LH_INITRAMFS}" in + casper) + ID="999" + ;; + + *) + ID="1000" + ;; +esac + +if [ -d chroot/home/${LH_USERNAME} ] +then + chown -R --quiet ${ID}:${ID} chroot/home/${LH_USERNAME} +fi + +if [ "${LH_DEBIAN_INSTALLER}" = "live" ] +then + # This is a temporary hack to get rid of fstab; + # needs cleanup in live-initramfs first to proper fix. + rm -f chroot/etc/fstab + + # There is a timing issue somewhere when using live-installer + # and the apt-get update waypoint: At the time when we're installing + # bootloader, it tries to fetch them from the net but the e.g. + # 'chroot /target apt-get install grub' fails because of missing + # packages lists. As a very cheap workaround, we ensure that the + # bootloader is already installed in the image. Very ugly, but it's to + # late to fix it in d-i because lenny rc2 has been already released. + case "${LH_ARCHITECTURE}" in + amd64|i386) + case "${LH_BOOTLOADER}" in + grub) + Apt install grub + ;; + + grub2) + Apt install grub2 + ;; + esac + ;; + + powerpc) + Apt install yaboot + ;; + esac +fi + +if [ "${LH_EXPOSED_ROOT}" = "true" ] +then + # Make sure RW dirs exist so that the initramfs script has + # a directory in which to bind the tmpfs filesystems + COW_DIRECTORIES="/home /live /tmp /var/lib/live /var/lock /var/log /var/run /var/tmp /var/spool" + + for DIRECTORY in ${COW_DIRECTORIES} + do + mkdir -p chroot/"${DIRECTORY}" + done + + # Config files which need to be RW + COW_FILES="/etc/adjtime /etc/fstab /etc/hostname /etc/hosts /etc/live.conf /etc/network/interfaces /etc/resolv.conf /etc/udev/rules.d/*persistent-net.rules /etc/udev/rules.d/*persistent-cd.rules /etc/X11/xorg.conf" + + # Where we will store RW config files + RW_DIRECTORY="/var/lib/live" + + for FILE in ${COW_FILES} + do + DIRECTORY="$(dirname ${FILE})" + FILE="$(basename ${FILE})" + RELATIVE_PATH="$(echo ${DIRECTORY} | sed 's|[^/]\+|..|g; s|^/||g')" + + # Touch files in case they don't yet exist + mkdir -p chroot/${DIRECTORY} + touch chroot/${DIRECTORY}/${FILE} + + # Move files to the read-write directory + mkdir -p chroot/${RW_DIRECTORY}/${DIRECTORY} + mv chroot/${DIRECTORY}/${FILE} chroot/${RW_DIRECTORY}/${DIRECTORY} + + # Create a symbolic link to RW config file + ln -s ${RELATIVE_PATH}/${RW_DIRECTORY}/${DIRECTORY}/${FILE} chroot/${DIRECTORY}/${FILE} + done + + # Mount doesn't write to a symlink so use /proc/mounts instead, + # see debian bug #154438 for more info + rm -f chroot/etc/mtab + ln -s /proc/mounts chroot/etc/mtab +fi + +# Show popular warnings +if [ -e chroot/etc/init.d/resolvconf ] +then + Echo_warning "Your live system appears to include resolvconf which is by its nature incompatible in most ways with debian-live." + Echo_warning "Keeping resolvconf installed *can* lead to broken network support in the resulting live system." + Echo_warning "Unless you really know what you are doing, we recommend that you neither install resolvconf explicitly nor implicitly through another package's relation (e.g. by having automatic installation of recommended packages to true)." +fi + +# Creating stage file +Create_stagefile .stage/chroot_hacks diff --git a/helpers/chroot_hooks b/helpers/chroot_hooks new file mode 100755 index 000000000..986aab593 --- /dev/null +++ b/helpers/chroot_hooks @@ -0,0 +1,71 @@ +#!/bin/sh + +# lh_chroot_hooks(1) - execute hooks in chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'execute hooks in chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin executing hooks..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_hooks + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Processing hooks +HOOKS="$(echo ${LH_HOOKS} ${LH_PACKAGES_LISTS} ${LH_TASKS} | sed -e 's| |\n|g' | sort -u)" + +for HOOK in ${HOOKS} +do + # Special handling for kde + if [ "${HOOK}" = "kde-desktop" ] && [ -n "$(echo ${HOOKS} | grep gnome-desktop)" ] + then + continue + fi + + if [ -f ${LH_BASE:-/usr/share/live-helper}/hooks/"${HOOK}" ] + then + # Copying hook + cp ${LH_BASE:-/usr/share/live-helper}/hooks/"${HOOK}" chroot/root + + # Making hook executable + if [ ! -x chroot/root/"${HOOK}" ] + then + chmod +x chroot/root/"${HOOK}" + fi + + # Executing hook + Chroot chroot "./root/${HOOK}" || ( Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ) + + # Removing hook + rm -f chroot/root/"${HOOK}" + + # Creating stage file + Create_stagefile .stage/chroot_hooks + fi +done diff --git a/helpers/chroot_hostname b/helpers/chroot_hostname new file mode 100755 index 000000000..9cafcf635 --- /dev/null +++ b/helpers/chroot_hostname @@ -0,0 +1,94 @@ +#!/bin/sh + +# lh_chroot_hostname(1) - manage /bin/hostname +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'manage /bin/hostname')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /etc/hostname" + + # Checking stage file + Check_stagefile .stage/chroot_hostname + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Save hostname + mv chroot/bin/hostname chroot/bin/hostname.orig + + # Create hostname file + echo "localhost.localdomain" > chroot/etc/hostname + + Echo_message "Configuring file /bin/hostname" + + # Create hostname program + +cat > chroot/bin/hostname << EOF +#!/bin/sh + +echo "localhost.localdomain" +EOF + + chmod 755 chroot/bin/hostname + + # Creating stage file + Create_stagefile .stage/chroot_hostname + ;; + + remove) + Echo_message "Deconfiguring file /etc/hostname" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Copying hostname from local-includes, if existing + if [ -e config/chroot_local-includes/etc/hostname ] + then + cp -a config/chroot_local-includes/etc/hostname chroot/etc/hostname + fi + + Echo_message "Deconfiguring file /bin/hostname" + + # Restore hostname file + if [ -e chroot/bin/hostname.orig ] + then + mv chroot/bin/hostname.orig chroot/bin/hostname + fi + + # Removing stage file + rm -f .stage/chroot_hostname + ;; + + *) + Usage + ;; +esac diff --git a/helpers/chroot_hosts b/helpers/chroot_hosts new file mode 100755 index 000000000..2b7fc2555 --- /dev/null +++ b/helpers/chroot_hosts @@ -0,0 +1,97 @@ +#!/bin/sh + +# lh_chroot_hosts(1) - manage /etc/hosts +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'manage /etc/hosts')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /etc/hosts" + + # Checking stage file + Check_stagefile .stage/chroot_hosts + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ -f chroot/etc/hosts ] + then + # Save hosts file + mv chroot/etc/hosts chroot/etc/hosts.orig + fi + + # Creating hosts file + +cat > chroot/etc/hosts << EOF +127.0.0.1 localhost localhost.localdomain +127.0.1.1 debian +EOF + + if [ -f /etc/hosts ] + then + # Append hosts file + #grep -e "127.0.0.1" -e "127.0.1.1" /etc/hosts >> chroot/etc/hosts + cat /etc/hosts >> chroot/etc/hosts + fi + + # Creating stage file + Create_stagefile .stage/chroot_hosts + ;; + + remove) + Echo_message "Deconfiguring file /etc/hosts" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ -e config/chroot_local-includes/etc/hosts ] + then + # Copying local hosts + cp -a config/chroot_local-includes/etc/hosts chroot/etc/hosts + rm -f chroot/etc/hosts.orig + elif [ -f chroot/etc/hosts.orig ] + then + # Restore hosts file + mv chroot/etc/hosts.orig chroot/etc/hosts + else + # Blank out hosts file, don't remove in case + # its a symlink, as in the case of exposedroot mode + Truncate chroot/etc/hosts + fi + + # Removing stage file + rm -f .stage/chroot_hosts + ;; + + *) + Usage + ;; +esac diff --git a/helpers/chroot_install-packages b/helpers/chroot_install-packages new file mode 100755 index 000000000..b200e0a03 --- /dev/null +++ b/helpers/chroot_install-packages @@ -0,0 +1,65 @@ +#!/bin/sh + +# lh_chroot_install-packages(1) - install queued packages into chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'install queued packages into chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin installing packages..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_install-packages + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ -e chroot/root/chroot_packages ] && [ -s chroot/root/chroot_packages ] +then + # Restoring cache + Restore_cache cache/packages_chroot + + # Installing packages + case "${LH_APT}" in + apt|apt-get) + Chroot chroot "xargs --arg-file=/root/chroot_packages apt-get ${APT_OPTIONS} install" + ;; + + aptitude) + Chroot chroot "xargs --arg-file=/root/chroot_packages aptitude ${APTITUDE_OPTIONS} install" + ;; + esac + + # Tidying up + rm -f chroot/root/chroot_packages + + # Saving cache + Save_cache cache/packages_chroot + +fi + +# Creating stage file +Create_stagefile .stage/chroot_install-packages diff --git a/helpers/chroot_interactive b/helpers/chroot_interactive new file mode 100755 index 000000000..eb9c011c8 --- /dev/null +++ b/helpers/chroot_interactive @@ -0,0 +1,61 @@ +#!/bin/sh + +# lh_chroot_interactive(1) - make build interactive +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'make build interactive')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_INTERACTIVE}" = "false" ] +then + exit 0 +fi + +Echo_message "Begin interactive build..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_interactive + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +case "${LH_INTERACTIVE}" in + true|shell) + Echo_message "Pausing build: starting interactive shell..." + Chroot chroot "/bin/bash --login" + ;; + x11) + Echo_message "Pausing build: starting interactive X11..." + Chroot chroot "startx" + ;; + xnest) + Echo_message "Pausing build: starting interactive Xnest..." + #Chroot chroot "" # FIXME + ;; +esac + +# Creating stage file +Create_stagefile .stage/chroot_symlinks diff --git a/helpers/chroot_linux-image b/helpers/chroot_linux-image new file mode 100755 index 000000000..76515ef23 --- /dev/null +++ b/helpers/chroot_linux-image @@ -0,0 +1,107 @@ +#!/bin/sh + +# lh_chroot_linux-image(1) - manage /etc/kernel-img.conf +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'manage /etc/kernel-img.conf')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /etc/kernel-img.conf" + + # Checking stage file + Check_stagefile .stage/chroot_linux-image + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ -f chroot/etc/kernel-img.conf ] + then + # Saving kernel-img.conf + cp chroot/etc/kernel-img.conf chroot/etc/kernel-img.conf.old + fi + + # Configuring kernel-img.conf +cat >> chroot/etc/kernel-img.conf << EOF +do_bootloader = No +do_initrd = Yes +warn_initrd = No +EOF + + # Diverting update-initramfs + #if [ "${LH_INITRAMFS}" = "live-initramfs" ] + #then + # mv chroot/usr/sbin/update-initramfs chroot/usr/sbin/update-initramfs.live-helper + #fi + + if [ "${LH_LINUX_PACKAGES}" != "none" ] + then + for FLAVOUR in ${LH_LINUX_FLAVOURS} + do + for PACKAGE in ${LH_LINUX_PACKAGES} + do + echo ${PACKAGE}-${FLAVOUR} >> chroot/root/chroot_packages + done + done + fi + + # Queue installation of linux-image and ${LH_INITRAMFS} + if [ "${LH_INITRAMFS}" != "none" ] + then + echo ${LH_INITRAMFS} >> chroot/root/chroot_packages + fi + + # Creating stage file + Create_stagefile .stage/chroot_linux-image + ;; + + remove) + Echo_message "Deconfiguring file /etc/kernel-img.conf" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ -f chroot/etc/kernel-img.conf.old ] + then + # Restoring kernel-img.conf file + mv chroot/etc/kernel-img.conf.old chroot/etc/kernel-img.conf + else + # Removing kernel-img.conf file + Truncate chroot/etc/kernel-img.conf + fi + + # Removing stage file + rm -f .stage/chroot_linux-image + ;; + + *) + Usage + ;; +esac diff --git a/helpers/chroot_local-hooks b/helpers/chroot_local-hooks new file mode 100755 index 000000000..0155e791b --- /dev/null +++ b/helpers/chroot_local-hooks @@ -0,0 +1,69 @@ +#!/bin/sh + +# lh_chroot_local-hooks(1) - execute local hooks in chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'execute local hooks in chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin executing local hooks..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_local-hooks + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Processing local-hooks +if Find_files config/chroot_local-hooks/* +then + # Restoring cache + Restore_cache cache/packages_chroot + + for HOOK in config/chroot_local-hooks/* + do + # Copying hook + cp "${HOOK}" chroot/root + + # Making hook executable + if [ ! -x chroot/root/"$(basename ${HOOK})" ] + then + chmod +x chroot/root/"$(basename ${HOOK})" + fi + + # Executing hook + Chroot chroot "/root/$(basename ${HOOK})" || ( Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ) + + # Removing hook + rm -f chroot/root/"$(basename ${HOOK})" + done + + # Saving cache + Save_cache cache/packages_chroot + + # Creating stage file + Create_stagefile .stage/chroot_local-hooks +fi diff --git a/helpers/chroot_local-includes b/helpers/chroot_local-includes new file mode 100755 index 000000000..399175010 --- /dev/null +++ b/helpers/chroot_local-includes @@ -0,0 +1,49 @@ +#!/bin/sh + +# lh_chroot_local-includes(1) - copy local files into chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'copy local files into chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin copying chroot local includes..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_local-includes + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if Find_files config/chroot_local-includes/ +then + # Copying includes + cd config/chroot_local-includes + find . | cpio -dmpu --no-preserve-owner "${OLDPWD}"/chroot + cd "${OLDPWD}" + + # Creating stage file + Create_stagefile .stage/chroot_local-includes +fi diff --git a/helpers/chroot_local-packages b/helpers/chroot_local-packages new file mode 100755 index 000000000..f2cdfb07d --- /dev/null +++ b/helpers/chroot_local-packages @@ -0,0 +1,47 @@ +#!/bin/sh + +# lh_chroot_local-packages(1) - queue install of local packages into chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'queue install of local packages into chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin queueing installation of local packages..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_local-packages + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if Find_files chroot/root/local-packages/*.deb +then + gunzip < chroot/root/local-packages/Packages.gz | awk '/^Package: / { print $2 }' \ + >> chroot/root/chroot_packages + + # Creating stage file + Create_stagefile .stage/chroot_local-packages +fi diff --git a/helpers/chroot_local-packageslists b/helpers/chroot_local-packageslists new file mode 100755 index 000000000..5e51ed931 --- /dev/null +++ b/helpers/chroot_local-packageslists @@ -0,0 +1,51 @@ +#!/bin/sh + +# lh_chroot_local-packageslists(1) - queue install of local packages lists into chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'queue install of local packages lists into chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin queueing installation of local packages lists..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_local-packageslists + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if ls config/chroot_local-packageslists/*.list > /dev/null 2>&1 +then + for LIST in config/chroot_local-packageslists/*.list + do + # Generating local package list + Expand_packagelist "$(basename ${LIST})" "config/chroot_local-packageslists" \ + >> chroot/root/chroot_packages + done + + # Creating stage file + Create_stagefile .stage/chroot_local-packageslists +fi diff --git a/helpers/chroot_local-patches b/helpers/chroot_local-patches new file mode 100755 index 000000000..303ffd156 --- /dev/null +++ b/helpers/chroot_local-patches @@ -0,0 +1,65 @@ +#!/bin/sh + +# lh_chroot_local-patches(1) - apply local patches against chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'apply local patches against chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin applying chroot local patches..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_local-patches + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if Find_files config/chroot_local-patches/ +then + # Restoring cache + Restore_cache cache/packages_chroot + + # Checking depends + Check_package chroot/usr/bin/patch patch + + # Installing depends + Install_package + + for PATCH in config/chroot_local-patches/* + do + Echo_message "Applying patch %s..." "${PATCH}" + Chroot chroot "patch -p1" < ${PATCH} + done + + # Removing depends + Remove_package + + # Saving cache + Save_cache cache/packages_chroot + + # Creating stage file + Create_stagefile .stage/chroot_local-patches +fi diff --git a/helpers/chroot_local-preseed b/helpers/chroot_local-preseed new file mode 100755 index 000000000..2256babe5 --- /dev/null +++ b/helpers/chroot_local-preseed @@ -0,0 +1,64 @@ +#!/bin/sh + +# lh_chroot_local-preseed(1) - use debconf local preseeding file +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'execute local preseed in chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin executing local preseeds..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_local-preseed + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if Find_files config/chroot_local-preseed/* +then + # Check dependency + Check_package chroot/usr/bin/debconf-set-selections debconf + + # Install dependency + Install_package + + for PRESEED in config/chroot_local-preseed/* + do + # Copying local preseed + cp "${PRESEED}" chroot/root/preseed + + Chroot chroot "debconf-set-selections /root/preseed" + + # Removing local preseed file + rm -f chroot/root/preseed + done + + # Remove dependency + Remove_package + + # Creating stage file + Create_stagefile .stage/chroot_local-preseed +fi diff --git a/helpers/chroot_localization b/helpers/chroot_localization new file mode 100755 index 000000000..a277f1731 --- /dev/null +++ b/helpers/chroot_localization @@ -0,0 +1,655 @@ +#!/bin/sh + +# lh_chroot_localization(1) - install localization packages into chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'install localization packages into chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin installing localization packages..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_localization + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Setting localizations +if [ -n "${LH_LANGUAGE}" ] +then + case "${LH_LANGUAGE}" in + af) + # Afrikaans + LOCALIZATIONS="iceweasel kde openoffice" + ;; + + as-in) + # Assamese + LOCALIZATIONS="openoffice" + ;; + + ar) + # Arabic + LOCALIZATIONS="iceweasel kde openoffice" + ;; + + az) + # Azerbaijani + LOCALIZATIONS="kde" + ;; + + be) + # Belarusian + LOCALIZATIONS="iceape iceweasel openoffice" + + # Overrides + OPENOFFICE="be-by" + ;; + + bg) + # Bulgarian + LOCALIZATIONS="icedove iceweasel kde openoffice" + ;; + + bn) + # Bengali + LOCALIZATIONS="kde openoffice" + ;; + + br) + # Breton + LOCALIZATIONS="kde openoffice" + ;; + + bs) + # Bosnian + LOCALIZATION="kde openoffice" + ;; + + ca) + # Catalan + LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" + ;; + + cs) + # Czech + LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" + ;; + + cy-gb) + # Welsh + LOCALIZATIONS="iceweasel kde koffice openoffice" + + # Overrides + KDE="cy" + KOFFICE="cy" + OPENOFFICE="cy" + ;; + + da) + # Danish + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + ;; + + de) + # German + LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" + ;; + + dz-bt) + # Dzongkha + LOCALIZATIONS="iceweasel openoffice" + + # Overrides + OPENOFFICE="dz" + ;; + + el) + # Greek + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + ;; + + en-gb) + # English (Great Britain) + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + + # Overrides + KDE="engb" + KOFFICE="engb" + ;; + + en-za) + # English (South Africa) + LOCALIZATIONS="openoffice" + ;; + + eo) + # Esperanto + LOCALIZATIONS="kde openoffice" + ;; + + es-ar) + # Spanish (Argentina) + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + + # Overrides + KDE="es" + KOFFICE="es" + OPENOFFICE="es" + ;; + + es-es) + # Spanish (Spain) + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + + # Overrides + KDE="es" + KOFFICE="es" + OPENOFFICE="es" + ;; + + et-ee) + # Estonian + LOCALIZATIONS="iceweasel kde koffice openoffice" + + # Overrides + KDE="et" + KOFFICE="et" + OPENOFFICE="et" + ;; + + eu) + # Basque + LOCALIZATIONS="icedove iceweasel kde koffice" + ;; + + fa-ir) + # Persian + LOCALIZATIONS="iceweasel kde openoffice" + + # Overrides + KDE="fa" + OPENOFFICE="fa" + ;; + + fi) + # Finnish + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + ;; + + fr) + # French + LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" + ;; + + fur-it) + # Furlan + LOCALIZATIONS="iceweasel" + ;; + + fy-nl) + # Frisian + LOCALIZATIONS="iceweasel kde" + + # Overrides + KDE="fy" + ;; + + ga-ie) + # Irish (Ireland) + LOCALIZATIONS="icedove iceweasel kde openoffice" + + # Overrides + ICEDOVE="ga" + KDE="ga" + OPENOFFICE="ga" + ;; + + gl) + # Galician + LOCALIZATIONS="kde" + ;; + + gu-in) + # Gujarati (India) + LOCALIZATIONS="icedove iceweasel openoffice" + + # Overrides + ICEDOVE="gu" + ;; + + he) + # Hebrew + LOCALIZATIONS="iceape icedove iceweasel kde openoffice" + ;; + + hi) + # Hindi + LOCALIZATIONS="kde openoffice" + ;; + + hr) + # Croatian + LOCALIZATIONS="kde koffice openoffice" + ;; + + hu) + # Hungarian + LOCALIZATIONS="icedove iceweasel kde openoffice" + ;; + + in) + # Indic + LOCALIZATIONS="openoffice" + ;; + + is) + # Icelandic + LOCALIZATIONS="kde" + ;; + + it) + # Italian + LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" + ;; + + ja) + # Japanese + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + ;; + + ka) + # Georgian + LOCALIZATIONS="iceweasel openoffice" + ;; + + km) + # Khmer + LOCALIZATIONS="kde openoffice" + ;; + + ko) + # Korean + LOCALIZATIONS="icedove iceweasel kde openoffice" + ;; + + ku) + # Kurdish + LOCALIZATIONS="iceweasel openoffice" + ;; + + lo) + # Lao + LOCALIZATIONS="openoffice" + ;; + + lt) + # Lithuanian + LOCALIZATIONS="icedove iceweasel kde openoffice" + ;; + + lv) + # Latvian + LOCALIZATIONS="kde koffice openoffice" + ;; + + mk) + # Macedonian + LOCALIZATIONS="icedove iceweasel kde openoffice" + ;; + + ml-in) + # Malayalam + LOCALIZATIONS="openoffice" + ;; + + mn) + # Mongolian + LOCALIZATIONS="iceweasel kde" + ;; + + ms) + # Malay + LOCALIZATIONS="kde koffice" + ;; + + nb-no) + # Bokmaal (Norway) + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + + # Overrides + ICEDOVE="nb" + KDE="nb" + KOFFICE="nb" + OPENOFFICE="nb" + ;; + + nds) + # Low Saxon + LOCALIZATIONS="kde" + ;; + + ne) + # Nepalese + LOCALIZATIONS="openoffice" + ;; + + nl) + # Dutch + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + ;; + + nn-no) + # Nynorsk (Norway) + LOCALIZATIONS="iceweasel kde openoffice" + + # Overrides + KDE="nn" + OPENOFFICE="nn" + ;; + + nr) + # Ndebele + LOCALIZATIONS="openoffice" + ;; + + ns) + # Northernsotho + LOCALIZATIONS="openoffice" + ;; + + or-in) + # Oriya + LOCALIZATIONS="openoffice" + ;; + + pa-in) + # Punjabi (India) + LOCALIZATIONS="icedove iceweasel kde openoffice" + + # Overrides + ICEDOVE="pa" + KDE="pa" + ;; + + pl) + # Polish + LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" + ;; + + pt-br) + # Portugese (Brazil) + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + + # Overrides + KDE="ptbr" + KOFFICE="ptbr" + ;; + + pt-pt) + # Portugese (Portugal) + LOCALIZATIONS="iceweasel kde koffice openoffice" + + # Overrides + KDE="pt" + KOFFICE="pt" + OPENOFFICE="pt" + ;; + + ro) + # Romanian + LOCALIZATIONS="iceweasel kde" + ;; + + roa-es-val) + # Valencian (Spain) + LOCALIZATIONS="iceweasel" + ;; + + ru) + # Russian + LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" + ;; + + rw) + # Kinarwanda + LOCALIZATIONS="kde openoffice" + ;; + + se) + # Northern Sami + LOCALIZATIONS="kde" + ;; + + sk) + # Slovak + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + ;; + + sl) + # Slovenian + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + ;; + + sr-cs) + # Serbian + LOCALIZATIONS="kde koffice openoffice" + + # Overrides + KDE="sr" + KOFFICE="sr" + ;; + + sr-latin) + # Latin Serbian + LOCALIZATIONS="kde koffice" + + # Overrides + KDE="srlatin" + KOFFICE="srlatin" + ;; + + ss) + # Swazi + LOCALIZATIONS="kde openoffice" + ;; + + st) + # Southern_sotho + LOCALIZATIONS="openoffice" + ;; + + sv-se) + # Swedish + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + + # Overrides + ICEDOVE="sv" + KDE="sv" + KOFFICE="sv" + OPENOFFICE="sv" + ;; + + ta-in) + # Tamil + LOCALIZATIONS="kde openoffice" + + # Overrides + KDE="ta" + ;; + + te-in) + # Telugu + LOCALIZATIONS="openoffice" + ;; + + tg) + # Tajik + LOCALIZATIONS="kde openoffice" + ;; + + th) + # Thai + LOCALIZATIONS="openoffice" + ;; + + tn) + # Tswana + LOCALIZATIONS="openoffice" + ;; + + tr) + # Turkish + LOCALIZATIONS="icedove iceweasel kde kofffice openoffice" + ;; + + ts) + # Tsonga + LOCALIZATIONS="openoffice" + ;; + + uk-ua) + # Ukrainian + LOCALIZATIONS="icedove iceweasel kde kofffice openoffice" + + # Overrides + ICEDOVE="uk" + KDE="uk" + KDE="uk" + OPENOFFICE="uk" + ;; + + uz) + # Uzbek + LOCALIZATIONS="kde" + ;; + + ve) + # Venda + LOCALIZATIONS="openoffice" + ;; + + vi) + # Vietnamese + LOCALIZATIONS="openoffice" + ;; + + xh) + # Xhosa + LOCALIZATIONS="openoffice" + ;; + + za) + # South African + LOCALIZATIONS="openoffice" + ;; + + zh-cn) + # Chinese (China) + LOCALIZATIONS="icedove iceweasel kde koffice openoffice" + + # Overrides + KDE="zhcn" + KOFFICE="zhcn" + ;; + + zh-tw) + # Chinese (Taiwan) + LOCALIZATIONS="iceweasel kde koffice openoffice" + + # Overrides + KDE="zhtw" + KOFFICE="zhtw" + ;; + + zu) + # Zulu + LOCALIZATIONS="openoffice" + ;; + esac + + # Setting languages + ICEAPE="${ICEAPE:-$LH_LANGUAGE}" + ICEDOVE="${ICEDOVE:-$LH_LANGUAGE}" + ICEWEASEL="${ICEWEASEL:-$LH_LANGUAGE}" + KDE="${KDE:-$LH_LANGUAGE}" + KOFFICE="${KOFFICE:-$LH_LANGUAGE}" + OPENOFFICE="${OPENOFFICE:-$LH_LANGUAGE}" + + # Setting packages + for LOCALIZATION in ${LOCALIZATIONS} + do + case "${LOCALIZATION}" in + iceape) + Check_installed chroot/usr/bin/iceape iceape; [ $INSTALL_STATUS -eq 0 ] && Check_package "" iceweasel-l10n-"${ICEAPE}" + ;; + + icedove) + Check_installed chroot/usr/bin/icedove icedove + if [ $INSTALL_STATUS -eq 0 ] + then + if [ "${LH_DISTRIBUTION}" = lenny ] + then + Check_package "" icedove-locale-"${ICEDOVE}" + else + Check_package "" icedove-l10n-"${ICEDOVE}" + fi + fi + ;; + + iceweasel) + Check_installed chroot/usr/bin/iceweasel iceweasel; [ $INSTALL_STATUS -eq 0 ] && Check_package "" iceweasel-l10n-"${ICEWEASEL}" + ;; + + kde) + Check_installed chroot/usr/bin/kstart kdebase-bin; [ $INSTALL_STATUS -eq 0 ] && Check_package "" kde-i18n-"${KDE}" + ;; + + koffice) + Check_installed chroot/usr/bin/koconverter koffice; [ $INSTALL_STATUS -eq 0 ] && Check_package "" koffice-i18n-"${KOFFICE}" + ;; + + openoffice) + Check_installed chroot/usr/bin/ooffice openoffice.org-common; [ $INSTALL_STATUS -eq 0 ] && Check_package "" openoffice.org-l10n-"${OPENOFFICE}" + ;; + esac + done + + Check_installed chroot/usr/bin/gwenview gwenview; [ $INSTALL_STATUS -eq 0 ] && Check_package "" gwenview-i18n + Check_installed chroot/usr/bin/k3b k3b; [ $INSTALL_STATUS -eq 0 ] && Check_package "" k3b-i18n + + # Restoring cache + Restore_cache cache/packages_chroot + + # Installing packages + Install_package + + # Saving cache + Save_cache cache/packages_chroot + + # Creating stage file + Create_stagefile .stage/chroot_localization +fi diff --git a/helpers/chroot_packages b/helpers/chroot_packages new file mode 100755 index 000000000..61a2fa645 --- /dev/null +++ b/helpers/chroot_packages @@ -0,0 +1,46 @@ +#!/bin/sh + +# lh_chroot_packages(1) - queue install of packages into chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'queue install of packages into chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin queueing installation of packages..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_packages + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ -n "${LH_PACKAGES}" ] && [ "${LH_PACKAGES}" != "none" ] +then + echo ${LH_PACKAGES} >> chroot/root/chroot_packages + + # Creating stage file + Create_stagefile .stage/chroot_packages +fi diff --git a/helpers/chroot_packageslists b/helpers/chroot_packageslists new file mode 100755 index 000000000..3ec26fb6b --- /dev/null +++ b/helpers/chroot_packageslists @@ -0,0 +1,51 @@ +#!/bin/sh + +# lh_chroot_packageslists(1) - queue install of packages lists into chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'queue install of packages lists into chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin queueing installation of packages lists..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_packageslists + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ -n "${LH_PACKAGES_LISTS}" ] && [ "${LH_PACKAGES_LISTS}" != "none" ] +then + + for LIST in ${LH_PACKAGES_LISTS} + do + # Generating package list + Expand_packagelist "${LIST}" >> chroot/root/chroot_packages + done + + # Creating stage file + Create_stagefile .stage/chroot_packageslists +fi diff --git a/helpers/chroot_preseed b/helpers/chroot_preseed new file mode 100755 index 000000000..6058e733a --- /dev/null +++ b/helpers/chroot_preseed @@ -0,0 +1,65 @@ +#!/bin/sh + +# lh_chroot_preseed(1) - use debconf preseeding file +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'execute preseed in chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin executing preseed..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_preseed + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Processing preseeds +for PRESEED in ${LH_PACKAGES_LISTS} ${LH_TASKS} +do + if [ -f ${LH_BASE:-/usr/share/live-helper}/preseed/"${PRESEED}" ] + then + # Check dependency + Check_package chroot/usr/bin/debconf-set-selections debconf + + # Install dependency + Install_package + + # Copying preseed + cp "${PRESEED}" chroot/root/preseed + + Chroot 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 +done diff --git a/helpers/chroot_proc b/helpers/chroot_proc new file mode 100755 index 000000000..392fa5ee1 --- /dev/null +++ b/helpers/chroot_proc @@ -0,0 +1,96 @@ +#!/bin/sh + +# lh_chroot_proc(1) - mount /proc +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'mount /proc')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Ensure that a system is built as root +lh testroot + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +case "${1}" in + install) + Echo_message "Begin mounting /proc..." + + # Checking stage file + Check_stagefile .stage/chroot_proc + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LH_USE_FAKEROOT}" != "true" ] + then + # Creating mountpoint + mkdir -p chroot/proc + + # Mounting /proc + ${LH_ROOT_COMMAND} mount proc-live -t proc chroot/proc + else + rm -rf chroot/proc + ln -s /proc chroot/ + fi + + # Creating stage file + Create_stagefile .stage/chroot_proc + ;; + + remove) + Echo_message "Begin unmounting /proc..." + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LH_USE_FAKEROOT}" != "true" ] + then + # Workaround binfmt-support /proc locking + if [ -e chroot/proc/sys/fs/binfmt_misc/status ] + then + ${LH_ROOT_COMMAND} umount chroot/proc/sys/fs/binfmt_misc + fi + + # Unmounting /proc + #fuser -km chroot/proc + if [ -e chroot/proc/version ] + then + ${LH_ROOT_COMMAND} umount chroot/proc + fi + else + rm -rf chroot/proc + mkdir -p chroot/proc + fi + + # Removing stage file + rm -f .stage/chroot_proc + ;; + + *) + Usage + ;; +esac diff --git a/helpers/chroot_resolv b/helpers/chroot_resolv new file mode 100755 index 000000000..0b24a2398 --- /dev/null +++ b/helpers/chroot_resolv @@ -0,0 +1,95 @@ +#!/bin/sh + +# lh_chroot_resolv(1) - manage /etc/resolv.conf +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'manage /etc/resolv.conf')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /etc/resolv.conf" + + # Checking stage file + Check_stagefile .stage/chroot_resolv + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ -e chroot/etc/resolv.conf ] + then + # Save resolv file or symlink + mv chroot/etc/resolv.conf chroot/etc/resolv.conf.orig + + # Also truncate it, otherwise we'll end up with the one + # created by debootstrap in the final image. + # + # If you want to have a custom resolv.conf, please + # overwrite it with normal local_includes mechanism. + Truncate chroot/etc/resolv.conf.orig + fi + + if [ -f /etc/resolv.conf ] + then + # Copy resolv file + cp /etc/resolv.conf chroot/etc/resolv.conf + fi + + # Creating stage file + Create_stagefile .stage/chroot_resolv + ;; + + remove) + Echo_message "Deconfiguring file /etc/resolv.conf" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ -e config/chroot_local-includes/etc/resolv.conf ] + then + # Copying local resolv.conf + cp -a config/chroot_local-includes/etc/resolv.conf chroot/etc/resolv.conf + rm -f chroot/etc/resolv.conf.orig + elif [ -e chroot/etc/resolv.conf.orig ] + then + # Restoring resolv file or symlink + mv chroot/etc/resolv.conf.orig chroot/etc/resolv.conf + else + # Truncating resolv file + Truncate chroot/etc/resolv.conf + fi + + # Removing stage file + rm -f .stage/chroot_resolv + ;; + + *) + Usage + ;; +esac diff --git a/helpers/chroot_selinuxfs b/helpers/chroot_selinuxfs new file mode 100755 index 000000000..558d3d7d3 --- /dev/null +++ b/helpers/chroot_selinuxfs @@ -0,0 +1,96 @@ +#!/bin/sh + +# lh_chroot_sysfs(1) - mount /selinux +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'mount /selinux')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Ensure that a system is built as root +lh testroot + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +case "${1}" in + install) + if [ -e /selinux/enforce ] && [ "$(cat /selinux/enforce)" = "1" ] + then + Echo_message "Begin mounting /selinux..." + + # Checking stage file + Check_stagefile .stage/chroot_selinuxfs + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LH_USE_FAKEROOT}" != "true" ] + then + # Create mountpoint + mkdir -p chroot/selinux + + # Mounting /selinux + ${LH_ROOT_COMMAND} mount selinuxfs-live -t selinuxfs chroot/selinux + else + rm -rf chroot/selinux + ln -s /selinux chroot/ + fi + + # Creating stage file + Create_stagefile .stage/chroot_selinuxfs + fi + ;; + + remove) + Echo_message "Begin unmounting /selinux..." + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LH_USE_FAKEROOT}" != "true" ] + then + # Unmounting /selinux + #fuser -km chroot/selinux + if [ -e chroot/selinux/enforce ] + then + ${LH_ROOT_COMMAND} umount chroot/selinux + fi + else + if [ -e chroot/selinux ] + then + rm -rf chroot/selinux + mkdir -p chroot/selinux + fi + fi + + # Removing stage file + rm -f .stage/chroot_selinux + ;; + + *) + Usage + ;; +esac diff --git a/helpers/chroot_sources b/helpers/chroot_sources new file mode 100755 index 000000000..81c02681f --- /dev/null +++ b/helpers/chroot_sources @@ -0,0 +1,466 @@ +#!/bin/sh + +# lh_chroot_sources(1) - manage /etc/apt/sources.list +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'manage /etc/apt/sources.list')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +_LH_LOCAL_KEY_EMAIL="live-helper-local-key@invalid" + +case "${1}" in + install) + Echo_message "Configuring file /etc/apt/sources.list" + + # Checking stage file + Check_stagefile .stage/chroot_sources + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Configure custom sources.list + echo "deb ${LH_MIRROR_CHROOT} ${LH_DISTRIBUTION} ${LH_ARCHIVE_AREAS}" > chroot/etc/apt/sources.list + + if [ "${LH_SOURCE}" = "true" ] + then + echo "deb-src ${LH_MIRROR_CHROOT} ${LH_DISTRIBUTION} ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list + fi + + if [ "${LH_SECURITY}" = "true" ] + then + case "${LH_MODE}" in + ubuntu) + echo "deb ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}-security ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list + + if [ "${LH_SOURCE}" = "true" ] + then + echo "deb-src ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}-security ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list + fi + ;; + + *) + if [ "${LH_DISTRIBUTION}" != "sid" ] && [ "${LH_DISTRIBUTION}" != "unstable" ] + then + echo "deb ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list + + if [ "${LH_SOURCE}" = "true" ] + then + echo "deb-src ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list + fi + fi + ;; + esac + fi + + # Check local sources.list + if Find_files config/chroot_sources/*.chroot + then + # Deconfigure (possibly) old sources.list snipplets + if Find_files config/chroot_sources/*.binary + then + for FILE in config/chroot_sources/*.binary + do + rm -f "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary).list" + done + fi + + # Configure new sources.list snipplets + for FILE in config/chroot_sources/*.chroot + do + cp "${FILE}" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot).list" + done + fi + + # Configure local package repository + if Find_files config/chroot_local-packages/*.deb + then + rm -rf chroot/root/local-packages + mkdir -p chroot/root/local-packages + + if [ "$(stat --printf %d config/chroot_local-packages)" = "$(stat --printf %d chroot/root/local-packages)" ] + then + CP_OPTIONS="-l" + fi + + # Copy packages + if Find_files config/chroot_local-packages/*_"${LH_ARCHITECTURE}".deb + then + cp ${CP_OPTIONS} config/chroot_local-packages/*_"${LH_ARCHITECTURE}".deb chroot/root/local-packages + fi + + if Find_files config/chroot_local-packages/*_all.deb + then + cp ${CP_OPTIONS} config/chroot_local-packages/*_all.deb chroot/root/local-packages + fi + + if Find_files chroot/root/local-packages/*.deb + then + # If we bootstrapped a minimal chroot, we need + # to install apt-utils before we have have + # completed all the indices. + case "${LH_BOOTSTRAP_FLAVOUR}" in + stripped|minimal) + Chroot chroot "apt-get update" + ;; + esac + + # Restoring cache + Restore_cache cache/packages_chroot + + # Check depends + Check_package chroot/usr/bin/apt-ftparchive apt-utils + + # Installing depends + Install_package + + # Generate Packages and Packages.gz + echo "cd /root/local-packages && apt-ftparchive packages . > Packages" | Chroot chroot sh + gzip -9 -c chroot/root/local-packages/Packages > chroot/root/local-packages/Packages.gz + + # Generate Release + echo "cd /root/local-packages && apt-ftparchive \ + -o APT::FTPArchive::Release::Origin=chroot_local-packages \ + release . > Release" | Chroot chroot sh + + if [ "${LH_APT_SECURE}" = "true" ] + then + _LH_DOTGNUPG_EXISTED=0 + if [ -d chroot/root/.gnupg ] + then + _LH_DOTGNUPG_EXISTED=1 + fi + + # Ensure ~/.gnupg exists (required for gnupg >= ~1.4.9) + mkdir -p chroot/root/.gnupg + + # Temporarily replace /dev/random with /dev/urandom so as not + # to block automated image builds; we don't care about the + # security of this key anyway. + mv chroot/dev/random chroot/dev/random.orig + cp -a chroot/dev/urandom chroot/dev/random + + if Find_files cache/local-package-keyring.* + then + cp cache/local-package-keyring.* chroot/root + else + # Generate temporary key + echo "Key-Type: RSA + Key-Length: 1024 + Subkey-Type: ELG-E + Subkey-Length: 1024 + Name-Real: live-helper local packages key + Name-Email: ${_LH_LOCAL_KEY_EMAIL} + Expire-Date: 0 + %secring /root/local-package-keyring.sec + %pubring /root/local-package-keyring.pub + %commit" | Chroot chroot "gpg --batch --gen-key" || _LH_RET=${?} + + case "${_LH_RET}" in + ""|2) + # Gnupg sometimes seems to return with a status of 2 when there was not + # enough entropy (and key creation blocks temporarily) even if the + # operation was ultimately successful. + ;; + *) + Echo_error "GPG exited with error status %s" "${_LH_RET}" + exit ${_LH_RET} + ;; + esac + + # Save keyrings to avoid regeneration + cp chroot/root/local-package-keyring.* cache/ + fi + + # Sign release + Chroot chroot "gpg --no-default-keyring --secret-keyring /root/local-package-keyring.sec \ + --keyring /root/local-package-keyring.pub -abs -o \ + /root/local-packages/Release.gpg /root/local-packages/Release" + + # Import key + Chroot chroot "gpg --no-default-keyring --secret-keyring /root/local-package-keyring.sec \ + --keyring /root/local-package-keyring.pub --armor \ + --export ${_LH_LOCAL_KEY_EMAIL}" | Chroot chroot "apt-key add -" + + # Remove temporary keyrings + rm chroot/root/local-package-keyring.pub + rm chroot/root/local-package-keyring.sec + + # Revert /dev/random + mv chroot/dev/random.orig chroot/dev/random + + # Remove /root/.gnupg if we created it during the signing process + if [ "${_LH_DOTGNUPG_EXISTED}" -eq 0 ] + then + rm -rf chroot/root/.gnupg + fi + fi + + # Add to sources.list + echo "" >> chroot/etc/apt/sources.list + echo "# Local packages" >> chroot/etc/apt/sources.list + echo "deb file:/root/local-packages ./" >> chroot/etc/apt/sources.list + + # Removing depends + Remove_package + + # Saving cache + Save_cache cache/packages_chroot + else + Echo_warning "Local packages must be named with suffix '_all.deb' or '_\$architecture.deb'." + fi + fi + + # Update indices from cache + if [ "${LH_CACHE_INDICES}" = "true" ] && [ -d cache/indices_bootstrap ] + then + if Find_files cache/indices_bootstrap/secring.gpg* + then + cp -f cache/indices_bootstrap/secring.gpg* chroot/etc/apt + fi + + if Find_files cache/indices_bootstrap/trusted.gpg* + then + cp -f cache/indices_bootstrap/trusted.gpg* chroot/etc/apt + fi + + if [ -f cache/indices_bootstrap/pkgcache.bin ] + then + cp -f cache/indices_bootstrap/pkgcache.bin chroot/var/cache/apt + fi + + if [ -f cache/indices_bootstrap/srcpkgcache.bin ] + then + cp -f cache/indices_bootstrap/srcpkgcache.bin chroot/var/cache/apt + fi + + if Find_files cache/indices_bootstrap/*_Packages + then + cp -f cache/indices_bootstrap/*_Packages chroot/var/lib/apt/lists + fi + + if Find_files cache/indices_bootstrap/*_Sources + then + cp -f cache/indices_bootstrap/*_Sources chroot/var/lib/apt/lists + fi + + if Find_files cache/indices_bootstrap/*_Release* + then + cp -f cache/indices_bootstrap/*_Release* chroot/var/lib/apt/lists + fi + + if [ "${LH_APT}" = "aptitude" ] && [ ! -x /usr/bin/aptitude ] + then + Chroot chroot "apt-get ${APT_OPTIONS} install aptitude" + fi + else # Get fresh indices + # Check local gpg keys + if Find_files config/chroot_sources/*.chroot.gpg + then + for FILE in config/chroot_sources/*.chroot.gpg + do + cp ${FILE} chroot/root + Chroot chroot "apt-key add /root/$(basename ${FILE})" + rm -f chroot/root/$(basename ${FILE}) + done + fi + + # Check local keyring packages + if Find_files config/chroot_sources/*.deb + then + for PACKAGE in config/chroot_sources/*.deb + do + cp ${PACKAGE} chroot/root + Chroot chroot "dpkg -i /root/$(basename ${PACKAGE})" + rm -f chroot/root/$(basename ${PACKAGE}) + done + fi + + # Installing aptitude + if [ "${LH_APT}" = "aptitude" ] && [ ! -x /usr/bin/aptitude ] + then + Chroot chroot "apt-get ${APT_OPTIONS} update" + Chroot chroot "apt-get ${APT_OPTIONS} install aptitude" + fi + + Apt update + Apt upgrade + Apt dist-upgrade + + # Installing keyring packages + if [ -n "${LH_KEYRING_PACKAGES}" ] + then + Chroot chroot "apt-get --yes --force-yes install ${LH_KEYRING_PACKAGES}" + Apt update + fi + + if [ "${LH_CACHE_INDICES}" = "true" ] + then + 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 + + cp -f chroot/var/cache/apt/pkgcache.bin cache/indices_bootstrap + + if Find_files chroot/var/cache/apt/srcpkgcache.bin + then + cp -f chroot/var/cache/apt/srcpkgcache.bin cache/indices_bootstrap + fi + + cp -f chroot/var/lib/apt/lists/*_Packages cache/indices_bootstrap + + if Find_files chroot/var/lib/apt/lists/*_Sources + then + cp -f chroot/var/lib/apt/lists/*_Sources cache/indices_bootstrap + fi + + cp -f chroot/var/lib/apt/lists/*_Release* cache/indices_bootstrap + fi + fi + + # Creating stage file + Create_stagefile .stage/chroot_sources + ;; + + remove) + Echo_message "Deconfiguring file /etc/apt/sources.list" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Configure generic indices + # Don't do anything if it's not required + if [ "${LH_MIRROR_CHROOT}" = "${LH_MIRROR_BINARY}" ] && \ + [ "${LH_MIRROR_CHROOT_SECURITY}" = "${LH_MIRROR_BINARY_SECURITY}" ] && \ + [ ! -d chroot/root/local-packages ] + then + # Removing stage file + rm -f .stage/chroot_sources + + exit 0 + fi + + # Cleaning apt list cache + rm -rf chroot/var/lib/apt/lists + mkdir -p chroot/var/lib/apt/lists/partial + + echo "deb ${LH_MIRROR_BINARY} ${LH_DISTRIBUTION} ${LH_ARCHIVE_AREAS}" > chroot/etc/apt/sources.list + + if [ "${LH_SOURCE}" = "true" ] + then + echo "deb-src ${LH_MIRROR_BINARY} ${LH_DISTRIBUTION} ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list + fi + + if [ "${LH_SECURITY}" = "true" ] + then + case "${LH_MODE}" in + ubuntu) + echo "deb ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}-security ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list + + if [ "${LH_SOURCE}" = "true" ] + then + echo "deb-src ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}-security ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list + fi + ;; + + *) + if [ "${LH_DISTRIBUTION}" != "sid" ] && [ "${LH_DISTRIBUTION}" != "unstable" ] + then + echo "deb ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list + + if [ "${LH_SOURCE}" = "true" ] + then + echo "deb-src ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list + fi + fi + ;; + esac + fi + + # Check local sources.list + if Find_files config/chroot_sources/*.binary + then + # Deconfigure (possibly) old sources.list snipplets + if Find_files config/chroot_sources/*.chroot + then + for FILE in config/chroot_sources/*.chroot + do + rm -f "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot).list" + done + fi + + # Configure new sources.list snipplets + for FILE in config/chroot_sources/*.binary + do + cp "${FILE}" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary).list" + done + fi + + # Check local gpg keys + if Find_files config/chroot_sources/*.binary.gpg + then + for FILE in config/chroot_sources/*.binary.gpg + do + cp ${FILE} chroot/root + Chroot chroot "apt-key add /root/$(basename ${FILE})" + rm -f chroot/root/$(basename ${FILE}) + done + fi + + # Updating indices + Apt update + + # Cleaning apt package cache + rm -rf chroot/var/cache/apt + mkdir -p chroot/var/cache/apt/archives/partial + + # Cleaning apt package lists + if [ "${LH_BINARY_INDICES}" = "false" ] + then + rm -rf chroot/var/lib/apt/lists + mkdir -p chroot/var/lib/apt/lists/partial + fi + + # Remove local package repository + rm -rf chroot/root/local-packages + + # Remove local packages key if it exists + if apt-key list | grep -q ${_LH_LOCAL_KEY_EMAIL} + then + apt-key del ${_LH_LOCAL_KEY_EMAIL} + fi + + # Removing stage file + rm -f .stage/chroot_sources + ;; + + *) + Usage + ;; +esac diff --git a/helpers/chroot_symlinks b/helpers/chroot_symlinks new file mode 100755 index 000000000..576f06e2e --- /dev/null +++ b/helpers/chroot_symlinks @@ -0,0 +1,58 @@ +#!/bin/sh + +# lh_chroot_symlinks(1) - convert symlinks +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'convert symlinks')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_SYMLINKS}" != "true" ] +then + exit 0 +fi + +Echo_message "Begin converting symlinks..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_symlinks + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Checking depends +Check_package chroot/usr/bin/symlinks symlinks + +# Installing depends +Install_package + +# Converting symlinks +Chroot chroot "symlinks -c -r -s /" + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/chroot_symlinks diff --git a/helpers/chroot_sysfs b/helpers/chroot_sysfs new file mode 100755 index 000000000..f6acb6478 --- /dev/null +++ b/helpers/chroot_sysfs @@ -0,0 +1,90 @@ +#!/bin/sh + +# lh_chroot_sysfs(1) - mount /sys +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'mount /sys')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Ensure that a system is built as root +lh testroot + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +case "${1}" in + install) + Echo_message "Begin mounting /sys..." + + # Checking stage file + Check_stagefile .stage/chroot_sysfs + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LH_USE_FAKEROOT}" != "true" ] + then + # Create mountpoint + mkdir -p chroot/sys + + # Mounting /sys + ${LH_ROOT_COMMAND} mount sysfs-live -t sysfs chroot/sys + else + rm -rf chroot/sys + ln -s /sys chroot/ + fi + + # Creating stage file + Create_stagefile .stage/chroot_sysfs + ;; + + remove) + Echo_message "Begin unmounting /sys..." + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LH_USE_FAKEROOT}" != "true" ] + then + # Unmounting /sys + #fuser -km chroot/sys + if [ -e chroot/sys/class ] + then + ${LH_ROOT_COMMAND} umount chroot/sys + fi + else + rm -rf chroot/sys + mkdir -p chroot/sys + fi + + # Removing stage file + rm -f .stage/chroot_sysfs + ;; + + *) + Usage + ;; +esac diff --git a/helpers/chroot_sysv-rc b/helpers/chroot_sysv-rc new file mode 100755 index 000000000..74a9702f7 --- /dev/null +++ b/helpers/chroot_sysv-rc @@ -0,0 +1,86 @@ +#!/bin/sh + +# lh_chroot_sysv-rc(1) - manage /usr/sbin/policy-rc.d +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'manage /usr/sbin/policy-rc.d')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /usr/sbin/policy-rc.d" + + # Checking stage file + Check_stagefile .stage/chroot_sysv-rc + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ -f chroot/usr/sbin/policy-rc.d ] + then + # Save policy-rc.d file + mv chroot/usr/sbin/policy-rc.d chroot/usr/sbin/policy-rc.d.orig + fi + + # Create policy-rc.d file +cat > chroot/usr/sbin/policy-rc.d << EOF +#!/bin/sh +echo "All runlevel operations denied by policy" >&2 +exit 101 +EOF + + chmod 0755 chroot/usr/sbin/policy-rc.d + + # Creating stage file + Create_stagefile .stage/chroot_sysv-rc + ;; + + remove) + Echo_message "Deconfiguring file /usr/sbin/policy-rc.d" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ -f chroot/usr/sbin/policy-rc.d.orig ] + then + # Restore policy-rc.d file + mv chroot/usr/sbin/policy-rc.d.orig chroot/usr/sbin/policy-rc.d + else + # Remove policy-rc.d file + rm -f chroot/usr/sbin/policy-rc.d + fi + + # Removing stage file + rm -f .stage/chroot_sysv-rc + ;; + + *) + Usage + ;; +esac diff --git a/helpers/chroot_sysvinit b/helpers/chroot_sysvinit new file mode 100755 index 000000000..7c8c98312 --- /dev/null +++ b/helpers/chroot_sysvinit @@ -0,0 +1,60 @@ +#!/bin/sh + +# lh_chroot_sysvinit(1) - configure sysvinit +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'configure sysvinit')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Configuring package sysvinit" + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_sysvinit + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ "${LH_SYSVINIT}" = "true" ] +then + # Disable all + for FILE in chroot/etc/init.d/* + do + Chroot chroot "update-rc.d -f $(basename ${FILE}) remove" + done + + # Re-enable all required (taken from -f standard chroot) + for PACKAGE in ${LH_INITRAMFS} console-common cron dpkg ifupdown initscripts kbd klogd libc6 libdevmapper1.02 libselinux1 libsepol1 login makedev module-init-tools netbase openbsd-inetd procps sudo sysklogd udev util-linux + do + if [ -f chroot/var/lib/dpkg/info/${PACKAGE}.postinst ] + then + # Re-configure if existing + Chroot chroot "/var/lib/dpkg/info/${PACKAGE}.postinst configure" + fi + done + + # Creating stage file + Create_stagefile .stage/chroot_sysvinit +fi diff --git a/helpers/chroot_tasks b/helpers/chroot_tasks new file mode 100755 index 000000000..ff8e60ae1 --- /dev/null +++ b/helpers/chroot_tasks @@ -0,0 +1,81 @@ +#!/bin/sh + +# lh_chroot_tasks(1) - install tasks into chroot +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'install tasks into chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Echo_message "Begin installing tasks..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/chroot_tasks + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ -n "${LH_TASKS}" ] && [ "${LH_TASKS}" != "none" ] +then + # Restoring cache + Restore_cache cache/packages_chroot + + # Checking depends + case "${LH_TASKSEL}" in + aptitude) + Check_package chroot/usr/bin/aptitude aptitude + ;; + + tasksel) + Check_package chroot/usr/bin/tasksel tasksel + ;; + esac + + # Installing depends + Install_package + + # Installing tasks + case "${LH_TASKSEL}" in + aptitude) + Chroot chroot "aptitude ${APTITUDE_OPTIONS} install ${LH_TASKS}" + ;; + + tasksel) + for TASK in ${LH_TASKS} + do + Chroot chroot "tasksel --debconf-apt-progress --logstderr install ${TASK}" + done + ;; + esac + + # Removing depends + Remove_package + + # Saving cache + Save_cache cache/packages_chroot + + # Creating stage file + Create_stagefile .stage/chroot_tasks +fi diff --git a/helpers/clean b/helpers/clean new file mode 100755 index 000000000..8f7420930 --- /dev/null +++ b/helpers/clean @@ -0,0 +1,154 @@ +#!/bin/sh + +# lh_clean(1) - clean up system build directories +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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 + +# Read meta config +if [ "${1}" != "noautoconfig" ] && [ -x auto/clean ] +then + ./auto/clean ${@} +fi + +if [ "${1}" = "noautoconfig" ] +then + shift +fi + +# Including common functions +. "${LH_BASE:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'clean up system build directories')" +HELP="" +USAGE="${PROGRAM} [--all] [--cache] [--chroot] [--binary] [--purge] [--remove] [--stage] [--source]" + +#Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Avoid cases were users accidentally nuke their config/binary +if [ ! -d config ] && [ "$(basename ${PWD})" = "config" ] +then + Echo_error "%s is not a good Debian Live working directory to clean." "${PWD}" + exit 1 +fi + +rm -f .lock + +if [ -z "${*}" ] +then + ARGUMENTS="--all" +else + ARGUMENTS="${@}" +fi + +for ARGUMENT in ${ARGUMENTS} +do + case "${ARGUMENT}" in + --all) + LH=1 "${0}" noautoconfig --chroot + LH=1 "${0}" noautoconfig --binary + LH=1 "${0}" noautoconfig --stage + LH=1 "${0}" noautoconfig --source + + if [ -d auto ] + then + rmdir --ignore-fail-on-non-empty auto + fi + ;; + + --cache) + ${LH_ROOT_COMMAND} rm -rf cache + ;; + + --chroot) + Echo_message "Cleaning chroot" + ${LH_ROOT_COMMAND} umount -f chroot/sys > /dev/null 2>&1 || true + ${LH_ROOT_COMMAND} umount -f chroot/proc/sys/fs/binfmt_misc > /dev/null 2>&1 || true + ${LH_ROOT_COMMAND} umount -f chroot/proc > /dev/null 2>&1 || true + ${LH_ROOT_COMMAND} umount -f chroot/lib/init/rw > /dev/null 2>&1 || true + ${LH_ROOT_COMMAND} umount -f chroot/dev/shm > /dev/null 2>&1 || true + ${LH_ROOT_COMMAND} umount -f chroot/dev/pts > /dev/null 2>&1 || true + ${LH_ROOT_COMMAND} umount -f chroot/dev > /dev/null 2>&1 || true + + ${LH_ROOT_COMMAND} umount -f chroot/binary.tmp > /dev/null 2>&1 || true + ${LH_ROOT_COMMAND} umount -f chroot/dev.tmp/pts > /dev/null 2>&1 || true + + ${LH_ROOT_COMMAND} rm -rf chroot chroot.tmp + + rm -f .stage/chroot* + ;; + + --binary) + ${LH_ROOT_COMMAND} umount -f binary.tmp > /dev/null 2>&1 || true + rm -rf binary.tmp binary.deb binary.udeb + rm -f binary.iso + rm -f binary*.img + rm -f binary*.tar.gz + rm -f binary.sh + rm -f binary.list binary.packages md5sum.txt + + rm -rf binary + rm -rf tftpboot + + rm -f .stage/binary* + ;; + + --remove) + LH=1 "${0}" --all + rm -rf cache/packages_* + ;; + + --purge) + LH=1 "${0}" --all + LH=1 "${0}" --cache + + if [ -e auto/config ] + then + rm -f .stage/config + fi + ;; + + --stage) + rm -rf .stage + ;; + + --source) + rm -f source.iso + rm -f source*.img + rm -f source*.tar + rm -f source*.tar.gz + rm -f source.list + rm -f source-selection.txt + + rm -rf source + + rm -f .stage/source* + ;; + + -h|--help) + Help + ;; + + -u|--usage) + Usage + ;; + + -v|--version) + Version + ;; + + *) + Usage + exit 1 + ;; + esac +done diff --git a/helpers/config b/helpers/config new file mode 100755 index 000000000..83a824263 --- /dev/null +++ b/helpers/config @@ -0,0 +1,1304 @@ +#!/bin/sh + +# lh_config(1) - create configuration for live-helper(7) +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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 + +# Read meta config +if [ "${1}" != "noautoconfig" ] && [ -x auto/config ] +then + ./auto/config ${@} +fi + +if [ "${1}" = "noautoconfig" ] +then + shift +fi + +# Including common functions +. "${LH_BASE:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +SYSTEM_LH_CONFFILE="/etc/default/live-helper" +DESCRIPTION="$(Echo 'create configuration for live-helper(7)')" +USAGE="${PROGRAM} [--apt apt|aptitude]\n\ +\t [--apt-ftp-proxy URL]\n\ +\t [--apt-http-proxy URL]\n\ +\t [--apt-pdiffs true|false]\n\ +\t [--apt-options OPTION|\"OPTIONS\"]\n\ +\t [--aptitude-options OPTION|\"OPTIONS\"]\n\ +\t [--apt-pipeline FIXME]\n\ +\t [--apt-recommends true|false]\n\ +\t [--apt-secure true|false]\n\ +\t [-a|--architecture ARCHITECTURE]\n\ +\t [-b|--binary-images iso|net|tar|usb-hdd]\n\ +\t [--binary-filesystem fat16|fat32]\n\ +\t [--binary-indices true|false|none]\n\ +\t [--bootappend-install PARAMETER|\"PARAMETERS\"]\n\ +\t [--bootappend-live PARAMETER|\"PARAMETERS\"]\n\ +\t [--bootloader grub|syslinux|yaboot]\n\ +\t [--bootstrap cdebootstrap|cdebootstrap-static|debootstrap|copy]\n\ +\t [--bootstrap-config FILE]\n\ +\t [-f|--bootstrap-flavour minimal|standard]\n\ +\t [--bootstrap-keyring PACKAGE]\n\ +\t [--breakpoints]\n\ +\t [--cache true|false]\n\ +\t [--cache-indices true|false]\n\ +\t [--cache-packages true|false]\n\ +\t [--cache-stages STAGE|\"STAGES\"]\n\ +\t [--checksums true|false]\n\ +\t [--chroot-build true|false]\n\ +\t [--chroot-filesystem ext2|ext3|squashfs|plain|jffs2]\n\ +\t [-c|--conffile FILE]\n\ +\t [--clean\n\ +\t [--debconf-frontend dialog|editor|noninteractive|readline]\n\ +\t [--debconf-nowarnings true|false]\n\ +\t [--debconf-priority low|medium|high|critical]\n\ +\t [--debian-installer true|cdrom|netinst|netboot|businesscard|live|false]\n\ +\t [--debian-installer-distribution CODENAME|daily]\n\ +\t [--debian-installer-preseedfile FILE|URL]\n\ +\t [--debian-installer-gui true|false]\n\ +\t [--debug]\n\ +\t [-d|--distribution CODENAME]\n\ +\t [--dump]\n\ +\t [-e|--encryption false|aes128|aes192|aes256]\n\ +\t [--fdisk fdisk|fdisk.dist]\n\ +\t [--force]\n\ +\t [--genisoimage genisomage|mkisofs]\n\ +\t [--grub-splash FILE]\n\ +\t [--gzip-options OPTION|\"OPTIONS\"]\n\ +\t [--hooks FILE]\n\ +\t [--hostname NAME]\n\ +\t [--ignore-system-defaults]\n\ +\t [--includes PATH]\n\ +\t [--initramfs auto|live-initramfs|casper]\n\ +\t [--interactive shell]\n\ +\t [--iso-application NAME]\n\ +\t [--iso-preparer NAME]\n\ +\t [--iso-publisher NAME]\n\ +\t [--iso-volume NAME]\n\ +\t [--jffs2-eraseblock SIZE]\n\ +\t [--keyring-packages PACKAGE|\"PACKAGES\"]\n\ +\t [-l|--language LANGUAGE]\n\ +\t [-k|--linux-flavours FLAVOUR|\"FLAVOURS\"]\n\ +\t [--linux-packages \"PACKAGES\"]\n\ +\t [--losetup losetup|losetup.orig]\n\ +\t [--memtest memtest86+|memtest86]\n\ +\t [-m|--mirror-bootstrap URL]\n\ +\t [--mirror-chroot URL]\n\ +\t [--mirror-chroot-security URL]\n\ +\t [--mirror-binary URL]\n\ +\t [--mirror-binary-security URL]\n\ +\t [--mode debian|emdebian]\n\ +\t [--net-root-filesystem nfs|cfs]\n\ +\t [--net-root-mountoptions OPTIONS]\n\ +\t [--net-root-path PATH]\n\ +\t [--net-root-server IP|HOSTNAME]\n\ +\t [--net-cow-filesystem nfs|cfs]\n\ +\t [--net-cow-mountoptions OPTIONS]\n\ +\t [--net-cow-path PATH]\n\ +\t [--net-cow-server IP|HOSTNAME]\n\ +\t [--net-tarball bzip2|gzip|tar|none]\n\ +\t [-p|--packages-lists FILE]\n\ +\t [--packages PACKAGE|\"PACKAGES\"]\n\ +\t [--quiet]\n\ +\t [--root-command sudo]\n\ +\t [--use-fakeroot true|false]\n\ +\t [--archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\ +\t [--security true|false]\n\ +\t [--source true|false]\n\ +\t [-s|--source-images iso|net|tar|usb-hdd]\n\ +\t [--symlinks true|false]\n\ +\t [--syslinux-splash FILE]\n\ +\t [--syslinux-timeout SECONDS]\n\ +\t [--syslinux-menu true|false]\n\ +\t [--sysvinit true|false]\n\ +\t [--tasksel aptitude|tasksel]\n\ +\t [--tasks TASK]\n\ +\t [--templates PATH]\n\ +\t [--union-filesystem aufs|unionfs]\n\ +\t [--virtual-root-size MB]\n\ +\t [--exposed-root true|false]\n\ +\t [--username NAME]\n\ +\t [--verbose]\n\ +\t [--win32-loader true|false]" + +Local_arguments () +{ + LONG_OPTIONS="apt:,apt-ftp-proxy:,apt-http-proxy:,apt-pdiffs:,apt-options:,aptitute-options:, + apt-pipeline:,apt-recommends:,apt-secure:,bootstrap:,cache:,cache-indices:,cache-packages:, + cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,dump,genisoimage:, + initramfs:,fdisk:,losetup:,mode:,root-command:,use-fakeroot:,tasksel:,includes:, + templates:,architecture:,bootstrap-config:,bootstrap-flavour:,bootstrap-keyring:,clean, + distribution:,mirror-bootstrap:,mirror-chroot:,mirror-chroot-security:,mirror-binary:, + mirror-binary-security:,archive-areas:,chroot-filesystem:,union-filesystem:,exposed-root:,virtual-root-size:, + gzip-options:,hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:, + packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,binary-filesystem:,binary-images:, + binary-indices:,bootappend-install:,bootappend-live:,bootloader:,checksums:,chroot-build:, + debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:, + encryption:,grub-splash:,hostname:,iso-application:,iso-preparer:,iso-publisher:, + iso-volume:,jffs2-eraseblock:,memtest:,net-root-filesystem:,net-root-mountoptions:, + net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:, + net-cow-server:,net-tarball:,syslinux-splash:,syslinux-timeout:,syslinux-menu:, + username:,win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force, + help,ignore-system-defaults,quiet,usage,verbose,version" + # Remove spaces added by indentation + LONG_OPTIONS="$(echo ${LONG_OPTIONS} | tr -d ' ')" + ARGUMENTS="$(getopt --longoptions ${LONG_OPTIONS} --name=${PROGRAM} --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")" + + if [ "${?}" != "0" ] + then + Echo_error "terminating" >&2 + exit 1 + fi + + eval set -- "${ARGUMENTS}" + + while true + do + case "${1}" in + --dump) + # Dump version + if [ -x "$(which dpkg-query 2>/dev/null)" ] + then + VERSION_DPKG="$(dpkg-query -f='${Version}' --show live-helper)" + fi + + Echo "%s: This is live-helper version %s" "${0}" "${VERSION_DPKG:-${VERSION}}" + + # Dump conffile contents + Print_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source + + # Dump contents of directories that contain text files + for DIRECTORY in config/binary_local-packageslists config/chroot_local-packageslists config/chroot_apt config/chroot_local-patches config/chroot_local-preseed config/binary_rootfs + do + if Find_files "${DIRECTORY}" + then + Echo_file "${DIRECTORY}"/* + fi + done + + # Dump directory listings of all directories under config/ + for DIRECTORY in $(find config/ -mindepth 1 -maxdepth 1 -type d) + do + if Find_files "${DIRECTORY}" + then + ls -lR "${DIRECTORY}" | while read LINE + do + echo "${DIRECTORY}: ${LINE}" + done + fi + done + + exit 0 + ;; + + --clean) + # Remove empty directories in config tree + if ls config/*/ > /dev/null 2>&1 + then + rmdir --ignore-fail-on-non-empty config/*/ + fi + + if [ -d config ] + then + rmdir --ignore-fail-on-non-empty config + fi + + if [ -d auto/functions ] + then + rmdir --ignore-fail-on-non-empty auto/functions + fi + + if [ -d auto ] + then + rmdir --ignore-fail-on-non-empty auto + fi + + exit 0 + ;; + + # config/common + --apt) + LH_APT="${2}" + shift 2 + ;; + + --apt-ftp-proxy) + LH_APT_FTP_PROXY="${2}" + shift 2 + ;; + + --apt-http-proxy) + LH_APT_HTTP_PROXY="${2}" + shift 2 + ;; + + --apt-pdiffs) + LH_APT_PDIFFS="${2}" + shift 2 + ;; + --apt-options) + APT_OPTIONS="${2}" + shift 2 + ;; + + --aptitude-options) + LH_APTITUDE_OPTIONS="${2}" + shift 2 + ;; + + --apt-pipeline) + LH_APT_PIPELINE="${2}" + shift 2 + ;; + + --apt-recommends) + LH_APT_RECOMMENDS="${2}" + shift 2 + ;; + + --apt-secure) + LH_APT_SECURE="${2}" + shift 2 + ;; + + --bootstrap) + LH_BOOTSTRAP="${2}" + shift 2 + ;; + + --cache) + LH_CACHE="${2}" + shift 2 + ;; + + --cache-indices) + LH_CACHE_INDICES="${2}" + shift 2 + ;; + + --cache-packages) + LH_CACHE_PACKAGES="${2}" + shift 2 + ;; + + --cache-stages) + LH_CACHE_STAGES="${2}" + shift 2 + ;; + + --debconf-frontend) + LH_DEBCONF_FRONTEND="${2}" + shift 2 + ;; + + --debconf-nowarnings) + LH_DEBCONF_NOWARNINGS="${2}" + shift 2 + ;; + + --debconf-priority) + LH_DEBCONF_PRIORITY="${2}" + shift 2 + ;; + + --initramfs) + LH_INITRAMFS="${2}" + shift 2 + ;; + + --fdisk) + LH_FDISK="${2}" + shift 2 + ;; + + --losetup) + LH_LOSETUP="${2}" + shift 2 + ;; + + --mode) + LH_MODE="${2}" + shift 2 + ;; + + --root-command) + LH_ROOT_COMMAND="${2}" + shift 2 + ;; + + --use-fakeroot) + LH_USE_FAKEROOT="${2}" + shift 2 + ;; + + --tasksel) + LH_TASKSEL="${2}" + shift 2 + ;; + + --includes) + LH_INCLUDES="${2}" + shift 2 + ;; + + --templates) + LH_TEMPLATES="${2}" + shift 2 + ;; + + -v|--version) + Version + shift + ;; + + # config/bootstrap + -a|--architecture) + LH_ARCHITECTURE="${2}" + shift 2 + ;; + + --bootstrap-config) + LH_BOOTSTRAP_CONFIG="${2}" + shift 2 + ;; + + -f|--bootstrap-flavour) + LH_BOOTSTRAP_FLAVOUR="${2}" + shift 2 + ;; + + --bootstrap-keyring) + LH_BOOTSTRAP_KEYRING="${2}" + shift 2 + ;; + + -d|--distribution) + LH_DISTRIBUTION="${2}" + BACKPORTS="false" + shift 2 + + case "${LH_DISTRIBUTION}" in + lenny-backports) + LH_DISTRIBUTION="lenny" + BACKPORTS="true" + ;; + esac + ;; + + -m|--mirror-bootstrap) + LH_MIRROR_BOOTSTRAP="${2}" + shift 2 + ;; + + --mirror-chroot) + LH_MIRROR_CHROOT="${2}" + shift 2 + ;; + + --mirror-chroot-security) + LH_MIRROR_CHROOT_SECURITY="${2}" + shift 2 + ;; + + --mirror-binary) + LH_MIRROR_BINARY="${2}" + shift 2 + ;; + + --mirror-binary-security) + LH_MIRROR_BINARY_SECURITY="${2}" + shift 2 + ;; + + --archive-areas) + LH_ARCHIVE_AREAS="${2}" + shift 2 + ;; + + # config/chroot + --chroot-filesystem) + LH_CHROOT_FILESYSTEM="${2}" + shift 2 + ;; + + --union-filesystem) + LH_UNION_FILESYSTEM="${2}" + shift 2 + ;; + + --virtual-root-size) + LH_VIRTUAL_ROOT_SIZE="${2}" + shift 2 + ;; + + --exposed-root) + LH_EXPOSED_ROOT="${2}" + shift 2 + ;; + + --gzip-options) + GZIP_OPTIONS="${2}" + shift 2 + ;; + + --hooks) + LH_HOOKS="${2}" + shift 2 + ;; + + --interactive) + LH_INTERACTIVE="${2}" + shift 2 + ;; + + --keyring-packages) + LH_KEYRING_PACKAGES="${2}" + shift 2 + ;; + + -l|--language) + LH_LANGUAGE="${2}" + shift 2 + ;; + + -k|--linux-flavours) + LH_LINUX_FLAVOURS="${2}" + shift 2 + ;; + + --linux-packages) + LH_LINUX_PACKAGES="${2}" + shift 2 + ;; + + --packages) + LH_PACKAGES="${2}" + shift 2 + ;; + + -p|--packages-lists) + LH_PACKAGES_LISTS="${2}" + shift 2 + ;; + + --tasks) + LH_TASKS="${2}" + shift 2 + ;; + + --security) + LH_SECURITY="${2}" + shift 2 + ;; + + --symlinks) + LH_SYMLINKS="${2}" + shift 2 + ;; + + --sysvinit) + LH_SYSVINIT="${2}" + shift 2 + ;; + + # config/binary + --binary-filesystem) + LH_BINARY_FILESYSTEM="${2}" + shift 2 + ;; + + -b|--binary-images) + LH_BINARY_IMAGES="${2}" + shift 2 + ;; + + --binary-indices) + LH_BINARY_INDICES="${2}" + shift 2 + ;; + + --bootappend-live) + LH_BOOTAPPEND_LIVE="${2}" + shift 2 + ;; + + --bootappend-install) + LH_BOOTAPPEND_INSTALL="${2}" + shift 2 + ;; + + --bootloader) + LH_BOOTLOADER="${2}" + shift 2 + ;; + + --checksums) + LH_CHECKSUMS="${2}" + shift 2 + ;; + + --chroot-build) + LH_CHROOT_BUILD="${2}" + shift 2 + ;; + + --debian-installer) + LH_DEBIAN_INSTALLER="${2}" + shift 2 + ;; + + --debian-installer-distribution) + LH_DEBIAN_INSTALLER_DISTRIBUTION="${2}" + shift 2 + ;; + + --debian-installer-preseedfile) + LH_DEBIAN_INSTALLER_PRESEEDFILE="${2}" + shift 2 + ;; + + --debian-installer-gui) + LH_DEBIAN_INSTALLER_GUI="${2}" + shift 2 + ;; + + -e|--encryption) + LH_ENCRYPTION="${2}" + shift 2 + ;; + + --grub-splash) + LH_GRUB_SPLASH="${2}" + shift 2 + ;; + + --hostname) + LH_HOSTNAME="${2}" + shift 2 + ;; + + --iso-application) + LH_ISO_APPLICATION="${2}" + shift 2 + ;; + + --iso-preparer) + LH_ISO_PREPARER="${2}" + shift 2 + ;; + + --iso-publisher) + LH_ISO_PUBLISHER="${2}" + shift 2 + ;; + + --iso-volume) + LH_ISO_VOLUME="${2}" + shift 2 + ;; + + --jffs2-eraseblock) + LH_JFFS2_ERASEBLOCK="${2}" + shift 2 + ;; + + --memtest) + LH_MEMTEST="${2}" + shift 2 + ;; + + --net-root-filesystem) + LH_NET_ROOT_FILESYSTEM="${2}" + shift 2 + ;; + + --net-root-mountoptions) + LH_NET_ROOT_MOUNTOPTIONS="${2}" + shift 2 + ;; + + --net-root-path) + LH_NET_ROOT_PATH="${2}" + shift 2 + ;; + + --net-root-server) + LH_NET_ROOT_SERVER="${2}" + shift 2 + ;; + + --net-cow-filesystem) + LH_NET_COW_FILESYSTEM="${2}" + shift 2 + ;; + + --net-cow-mountoptions) + LH_NET_COW_MOUNTOPTIONS="${2}" + shift 2 + ;; + + --net-cow-path) + LH_NET_COW_PATH="${2}" + shift 2 + ;; + + --net-cow-server) + LH_NET_COW_SERVER="${2}" + shift 2 + ;; + + --net-tarball) + LH_NET_TARBALL="${2}" + shift 2 + ;; + + --syslinux-splash) + LH_SYSLINUX_SPLASH="${2}" + shift 2 + ;; + + --syslinux-timeout) + LH_SYSLINUX_TIMEOUT="${2}" + shift 2 + ;; + + --syslinux-menu) + LH_SYSLINUX_MENU="${2}" + shift 2 + ;; + + --username) + LH_USERNAME="${2}" + shift 2 + ;; + + --win32-loader) + LH_WIN32_LOADER="${2}" + shift 2 + ;; + + # config/source + --source) + LH_SOURCE="${2}" + shift 2 + ;; + + -s|--source-images) + LH_SOURCE_IMAGES="${2}" + shift 2 + ;; + + # other + --breakpoints) + _BREAKPOINTS="true" + shift + ;; + + -c|--conffile) + _CONFFILE="${2}" + shift 2 + ;; + + --color) + _COLOR="true" + shift + ;; + + --debug) + _DEBUG="true" + shift + ;; + + --force) + _FORCE="true" + shift + ;; + + -h|--help) + Help + shift + ;; + + --ignore-system-defaults) + shift + ;; + + --quiet) + _QUIET="true" + shift + ;; + + -u|--usage) + Usage + shift + ;; + + --verbose) + _VERBOSE="true" + shift + ;; + + -v|--version) + Version + shift + ;; + + --) + shift + break + ;; + + *) + Echo_error "internal error %s" "${0}" + exit 1 + ;; + esac + done +} + +# Reading system configuration +if [ -f "${SYSTEM_LH_CONFFILE}" ] && ! In_list "--ignore-system-defaults" "${@}" +then + Echo_message "Considering defaults defined in %s" "${SYSTEM_LH_CONFFILE}" + Read_conffiles "${SYSTEM_LH_CONFFILE}" +fi + +# Reading existing configuration +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source + +Local_arguments "${@}" + +if [ -n "${_CONFFILE}" ] +then + Read_conffiles "${_CONFFILE}" +fi + +# Setting defaults +Set_defaults + +# Checking defaults +Check_defaults + +if [ ! -e config ] +then + Echo_message "Creating config tree" +else + Echo_message "Updating config tree" +fi + +# Creating bootstrap configuration +mkdir -p config +mkdir -p config/includes +mkdir -p config/templates + +# Creating live-helper configuration +cat > config/common << EOF +# config/common - common options for live-helper(7) + +# LH_CONFIG_VERSION: internal version of the configuration file format +LH_CONFIG_VERSION="${CONFIG_VERSION}" + +# \$LH_APT: set package manager +# (Default: ${LH_APT}) +LH_APT="${LH_APT}" + +# \$LH_APT_FTP_PROXY: set apt/aptitude ftp proxy +# (Default: autodetected or empty) +LH_APT_FTP_PROXY="${LH_APT_FTP_PROXY}" + +# \$LH_APT_HTTP_PROXY: set apt/aptitude http proxy +# (Default: autodetected or empty) +LH_APT_HTTP_PROXY="${LH_APT_HTTP_PROXY}" + +# \$LH_APT_PDIFFS: set apt/aptitude pdiff indices +# (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}" + +# \$LH_APT_SECURE: set apt/aptitude security +# (Default: ${LH_APT_SECURE}) +LH_APT_SECURE="${LH_APT_SECURE}" + +# \$LH_BOOTSTRAP: set bootstrap program +# (Default: ${LH_BOOTSTRAP}) +LH_BOOTSTRAP="${LH_BOOTSTRAP}" + +# \$LH_CACHE: control cache +# (Default: ${LH_CACHE}) +LH_CACHE="${LH_CACHE}" + +# \$LH_CACHE_INDICES: control if downloaded package indices should be cached +# (Default: ${LH_CACHE_INDICES}) +LH_CACHE_INDICES="${LH_CACHE_INDICES}" + +# \$LH_CACHE_PACKAGES: control if downloaded packages files should be cached +# (Default: ${LH_CACHE_PACKAGES}) +LH_CACHE_PACKAGES="${LH_CACHE_PACKAGES}" + +# \$LH_CACHE_STAGES: control if completed stages should be cached +# (Default: ${LH_CACHE_STAGES}) +LH_CACHE_STAGES="${LH_CACHE_STAGES}" + +# \$LH_DEBCONF_FRONTEND: set debconf(1) frontend to use +# (Default: ${LH_DEBCONF_FRONTEND}) +LH_DEBCONF_FRONTEND="${LH_DEBCONF_FRONTEND}" + +# \$LH_DEBCONF_NOWARNINGS: set debconf(1) warnings +# (Default: ${LH_DEBCONF_NOWARNINGS}) +LH_DEBCONF_NOWARNINGS="${LH_DEBCONF_NOWARNINGS}" + +# \$LH_DEBCONF_PRIORITY: set debconf(1) priority to use +# (Default: ${LH_DEBCONF_PRIORITY}) +LH_DEBCONF_PRIORITY="${LH_DEBCONF_PRIORITY}" + +# \$LH_INITRAMFS: set initramfs hook +# (Default: ${LH_INITRAMFS}) +LH_INITRAMFS="${LH_INITRAMFS}" + +# \$LH_FDISK: set fdisk program +# (Default: autodetected) +LH_FDISK="${LH_FDISK}" + +# \$LH_LOSETUP: set losetup program +# (Default: autodetected) +LH_LOSETUP="${LH_LOSETUP}" + +# \$LH_MODE: set distribution mode +# (Default: ${LH_MODE}) +LH_MODE="${LH_MODE}" + +# \$LH_ROOT_COMMAND: use sudo or equivalent +# (Default: empty) +#LH_ROOT_COMMAND="sudo" + +# \$LH_USE_FAKEROOT: use fakeroot/fakechroot +# (Default: ${LH_USE_FAKEROOT}) +LH_USE_FAKEROOT="${LH_USE_FAKEROOT}" + +# \$LH_TASKSEL: set tasksel program +# (Default: ${LH_TASKSEL}) +LH_TASKSEL="${LH_TASKSEL}" + +# \$LH_INCLUDES: set includes +# (Default: ${LH_INCLUDES}) +LH_INCLUDES="${LH_INCLUDES}" + +# \$LH_TEMPLATES: set templates +# (Default: ${LH_TEMPLATES}) +LH_TEMPLATES="${LH_TEMPLATES}" + +# Live-helper options + +# \$_BREAKPOINTS: enable breakpoints +# (Default: ${_BREAKPOINTS}) +#_BREAKPOINTS="${_BREAKPOINTS}" + +# \$_DEBUG: enable debug +# (Default: ${_DEBUG}) +#_DEBUG="${_DEBUG}" + +# \$_COLOR: enable color +# (Default: ${_COLOR}) +#_COLOR="${_COLOR}" + +# \$_FORCE: enable force +# (Default: ${_FORCE}) +#_FORCE="${_FORCE}" + +# \$_QUIET: enable quiet +# (Default: ${_QUIET}) +_QUIET="${_QUIET}" + +# \$_VERBOSE: enable verbose +# (Default: ${_VERBOSE}) +#_VERBOSE="${_VERBOSE}" + +# Internal stuff (FIXME) +APT_OPTIONS="${APT_OPTIONS}" +APTITUDE_OPTIONS="${APTITUDE_OPTIONS}" +GZIP_OPTIONS="${GZIP_OPTIONS}" +EOF + +# Creating lh_bootstrap_* configuration +cat > config/bootstrap << EOF +# config/bootstrap - options for live-helper(7), bootstrap stage + +# \$LH_ARCHITECTURE: select chroot architecture +# (Default: autodetected) +LH_ARCHITECTURE="${LH_ARCHITECTURE}" + +# \$LH_BOOTSTRAP_CONFIG: set distribution config directory +# (Default: empty) +LH_BOOTSTRAP_CONFIG="${LH_BOOTSTRAP_CONFIG}" + +# \$LH_BOOTSTRAP_INCLUDE: include packages on base +# (Default: empty) +LH_BOOTSTRAP_INCLUDE="${LH_BOOTSTRAP_INCLUDE}" + +# \$LH_BOOTSTRAP_EXCLUDE: exclude packages on base +# (Default: empty) +LH_BOOTSTRAP_EXCLUDE="${LH_BOOTSTRAP_EXCLUDE}" + +# \$LH_BOOTSTRAP_FLAVOUR: select flavour to use +# (Default: empty) +LH_BOOTSTRAP_FLAVOUR="${LH_BOOTSTRAP_FLAVOUR}" + +# \$LH_BOOTSTRAP_KEYRING: set distribution keyring +# (Default: empty) +LH_BOOTSTRAP_KEYRING="${LH_BOOTSTRAP_KEYRING}" + +# \$LH_DISTRIBUTION: select distribution to use +# (Default: ${LH_DISTRIBUTION}) +LH_DISTRIBUTION="${LH_DISTRIBUTION}" + +# \$LH_MIRROR_BOOTSTRAP: set mirror to bootstrap from +# (Default: ${LH_MIRROR_BOOTSTRAP}) +LH_MIRROR_BOOTSTRAP="${LH_MIRROR_BOOTSTRAP}" + +# \$LH_MIRROR_CHROOT: set mirror to fetch packages from +# (Default: ${LH_MIRROR_CHROOT}) +LH_MIRROR_CHROOT="${LH_MIRROR_CHROOT}" + +# \$LH_MIRROR_CHROOT_SECURITY: set security mirror to fetch packages from +# (Default: ${LH_MIRROR_CHROOT_SECURITY}) +LH_MIRROR_CHROOT_SECURITY="${LH_MIRROR_CHROOT_SECURITY}" + +# \$LH_MIRROR_BINARY: set mirror which ends up in the image +# (Default: ${LH_MIRROR_BINARY}) +LH_MIRROR_BINARY="${LH_MIRROR_BINARY}" + +# \$LH_MIRROR_BINARY_SECURITY: set security mirror which ends up in the image +# (Default: ${LH_MIRROR_BINARY_SECURITY}) +LH_MIRROR_BINARY_SECURITY="${LH_MIRROR_BINARY_SECURITY}" + +# \$LH_ARCHIVE_AREAS: select archive areas to use +# (Default: ${LH_ARCHIVE_AREAS}) +LH_ARCHIVE_AREAS="${LH_ARCHIVE_AREAS}" +EOF + +# Creating lh_chroot_* configuration +mkdir -p config/chroot_apt +mkdir -p config/chroot_local-hooks +mkdir -p config/chroot_local-includes +mkdir -p config/chroot_local-patches +mkdir -p config/chroot_local-packages +mkdir -p config/chroot_local-packageslists +mkdir -p config/chroot_local-preseed +mkdir -p config/chroot_sources + +cat > config/chroot << EOF +# config/chroot - options for live-helper(7), chroot stage + +# \$LH_CHROOT_FILESYSTEM: set chroot filesystem +# (Default: ${LH_CHROOT_FILESYSTEM}) +LH_CHROOT_FILESYSTEM="${LH_CHROOT_FILESYSTEM}" + +# \$LH_UNION_FILESYSTEM: set union filesystem +# (Default: ${LH_UNION_FILESYSTEM}) +LH_UNION_FILESYSTEM="${LH_UNION_FILESYSTEM}" + +# \$LH_VIRTUAL_ROOT_SIZE: set virtual-hdd filesystem size +# (Default: ${LH_VIRTUAL_ROOT_SIZE}) +LH_VIRTUAL_ROOT_SIZE="${LH_VIRTUAL_ROOT_SIZE}" + +# \$LH_EXPOSED_ROOT: expose root as read only +# (Default: ${LH_EXPOSED_ROOT}) +LH_EXPOSED_ROOT="${LH_EXPOSED_ROOT}" + +# \$LH_HOOKS: set hook commands +# (Default: empty) +LH_HOOKS="${LH_HOOKS}" + +# \$LH_INTERACTIVE: set interactive build +# (Default: ${LH_INTERACTIVE}) +LH_INTERACTIVE="${LH_INTERACTIVE}" + +# \$LH_KEYRING_PACKAGES: set keyring packages +# (Default: empty) +LH_KEYRING_PACKAGES="${LH_KEYRING_PACKAGES}" + +# \$LH_LANGUAGE: set language to use +# (Default: empty) +LH_LANGUAGE="${LH_LANGUAGE}" + +# \$LH_LINUX_FLAVOURS: set kernel flavour to use +# (Default: autodetected) +LH_LINUX_FLAVOURS="${LH_LINUX_FLAVOURS}" + +# \$LH_LINUX_PACKAGES: set kernel packages to use +# (Default: autodetected) +LH_LINUX_PACKAGES="${LH_LINUX_PACKAGES}" + +# \$LH_PACKAGES: set packages to install +# (Default: empty) +LH_PACKAGES="${LH_PACKAGES}" + +# \$LH_PACKAGES_LISTS: set package list to install +# (Default: ${LH_PACKAGES_LISTS}) +LH_PACKAGES_LISTS="${LH_PACKAGES_LISTS}" + +# \$LH_TASKS: set tasks to install +# (Default: empty) +LH_TASKS="${LH_TASKS}" + +# \$LH_SECURITY: enable security updates +# (Default: ${LH_SECURITY}) +LH_SECURITY="${LH_SECURITY}" + +# \$LH_SYMLINKS: enable symlink convertion +# (Default: ${LH_SYMLINKS}) +LH_SYMLINKS="${LH_SYMLINKS}" + +# \$LH_SYSVINIT: enable sysvinit +# (Default: ${LH_SYSVINIT}) +LH_SYSVINIT="${LH_SYSVINIT}" +EOF + +# Creating lh_binary_* configuration +mkdir -p config/binary_debian-installer +mkdir -p config/binary_debian-installer-includes +mkdir -p config/binary_grub +mkdir -p config/binary_local-debs +mkdir -p config/binary_local-hooks +mkdir -p config/binary_local-includes +mkdir -p config/binary_local-packageslists +mkdir -p config/binary_local-udebs +mkdir -p config/binary_rootfs +mkdir -p config/binary_syslinux + +cat > config/binary << EOF +# config/binary - options for live-helper(7), binary stage + +# \$LH_BINARY_FILESYSTEM: set image filesystem +# (Default: ${LH_BINARY_FILESYSTEM}) +LH_BINARY_FILESYSTEM="${LH_BINARY_FILESYSTEM}" + +# \$LH_BINARY_IMAGES: set image type +# (Default: ${LH_BINARY_IMAGES}) +LH_BINARY_IMAGES="${LH_BINARY_IMAGES}" + +# \$LH_BINARY_INDICES: set apt/aptitude generic indices +# (Default: ${LH_BINARY_INDICES}) +LH_BINARY_INDICES="${LH_BINARY_INDICES}" + +# \$LH_BOOTAPPEND_LIVE: set boot parameters +# (Default: empty) +LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE}" + +# \$LH_BOOTAPPEND_INSTALL: set boot parameters +# (Default: empty) +LH_BOOTAPPEND_INSTALL="${LH_BOOTAPPEND_INSTALL}" + +# \$LH_BOOTLOADER: set bootloader +# (Default: ${LH_BOOTLOADER}) +LH_BOOTLOADER="${LH_BOOTLOADER}" + +# \$LH_CHECKSUMS: set checksums +# (Default: ${LH_CHECKSUMS}) +LH_CHECKSUMS="${LH_CHECKSUMS}" + +# \${LH_CHROOT_BUILD: control if we build binary images chrooted +# (Default: ${LH_CHROOT_BUILD}) +# DO NEVER, *NEVER*, *N*E*V*E*R* SET THIS OPTION to false. +LH_CHROOT_BUILD="${LH_CHROOT_BUILD}" + +# \$LH_DEBIAN_INSTALLER: set debian-installer +# (Default: ${LH_DEBIAN_INSTALLER}) +LH_DEBIAN_INSTALLER="${LH_DEBIAN_INSTALLER}" + +# \$LH_DEBIAN_INSTALLER_DISTRIBUTION: set debian-installer suite +# (Default: empty) +LH_DEBIAN_INSTALLER_DISTRIBUTION="${LH_DEBIAN_INSTALLER_DISTRIBUTION}" + +# \$LH_DEBIAN_INSTALLER_PRESEEDFILE: set debian-installer preseed filename/url +# (Default: ${LH_DEBIAN_INSTALLER_PRESEEDFILE}) +LH_DEBIAN_INSTALLER_PRESEEDFILE="${LH_DEBIAN_INSTALLER_PRESEEDFILE}" + +# \$LH_DEBIAN_INSTALLER_GUI: toggle use of GUI debian-installer +# (Default: ${LH_DEBIAN_INSTALLER_GUI}) +LH_DEBIAN_INSTALLER_GUI="${LH_DEBIAN_INSTALLER_GUI}" + +# \$LH_ENCRYPTION: set encryption +# (Default: ${LH_ENCRYPTION}) +LH_ENCRYPTION="${LH_ENCRYPTION}" + +# \$LH_GRUB_SPLASH: set custom grub splash +# (Default: empty) +LH_GRUB_SPLASH="${LH_GRUB_SPLASH}" + +# \$LH_HOSTNAME: set hostname +# (Default: ${LH_HOSTNAME}) +LH_HOSTNAME="${LH_HOSTNAME}" + +# \$LH_ISO_APPLICATION: set iso author +# (Default: ${LH_ISO_APPLICATION}) +LH_ISO_APPLICATION="${LH_ISO_APPLICATION}" + +# \$LH_ISO_PREPARER: set iso preparer +# (Default: ${LH_ISO_PREPARER}) +LH_ISO_PREPARER="${LH_ISO_PREPARER}" + +# \$LH_ISO_PUBLISHER: set iso publisher +# (Default: ${LH_ISO_PUBLISHER}) +LH_ISO_PUBLISHER="${LH_ISO_PUBLISHER}" + +# \$LH_ISO_VOLUME: set iso volume (max 32 chars) +# (Default: ${LH_ISO_VOLUME}) +LH_ISO_VOLUME="${LH_ISO_VOLUME}" + +# \$LH_JFFS2_ERASEBLOCK: set jffs2 eraseblock size +# (Default: unset) +LH_JFFS2_ERASEBLOCK="" + +# \$LH_MEMTEST: set memtest +# (Default: ${LH_MEMTEST}) +LH_MEMTEST="${LH_MEMTEST}" + +# \$LH_WIN32_LOADER: set win32-loader +# (Default: ${LH_WIN32_LOADER}) +LH_WIN32_LOADER="${LH_WIN32_LOADER}" + +# \$LH_NET_ROOT_FILESYSTEM: set netboot filesystem +# (Default: ${LH_NET_ROOT_FILESYSTEM}) +LH_NET_ROOT_FILESYSTEM="${LH_NET_ROOT_FILESYSTEM}" + +# \$LH_NET_ROOT_MOUNTOPTIONS: set nfsopts +# (Default: empty) +LH_NET_ROOT_MOUNTOPTIONS="${LH_NET_ROOT_MOUNTOPTIONS}" + +# \$LH_NET_ROOT_PATH: set netboot server directory +# (Default: ${LH_NET_ROOT_PATH}) +LH_NET_ROOT_PATH="${LH_NET_ROOT_PATH}" + +# \$LH_NET_ROOT_SERVER: set netboot server address +# (Default: ${LH_NET_ROOT_SERVER}) +LH_NET_ROOT_SERVER="${LH_NET_ROOT_SERVER}" + +# \$LH_NET_COW_FILESYSTEM: set net client cow filesystem +# (Default: ${LH_NET_COW_FILESYSTEM}) +LH_NET_COW_FILESYSTEM="${LH_NET_COW_FILESYSTEM}" + +# \$LH_NET_COW_MOUNTOPTIONS: set cow mount options +# (Default: empty) +LH_NET_COW_MOUNTOPTIONS="${LH_NET_COW_MOUNTOPTIONS}" + +# \$LH_NET_COW_PATH: set cow directory +# (Default: ${LH_NET_COW_PATH}) +LH_NET_COW_PATH="${LH_NET_COW_PATH}" + +# \$LH_NET_COW_SERVER: set cow server +# (Default: ${LH_NET_COW_SERVER}) +LH_NET_COW_SERVER="${LH_NET_COW_SERVER}" + +# \$LH_NET_TARBALL: set net tarball +# (Default: ${LH_NET_TARBALL}) +LH_NET_TARBALL="${LH_NET_TARBALL}" + +# \$LH_SYSLINUX_SPLASH: set custom syslinux splash +# (Default: empty) +LH_SYSLINUX_SPLASH="${LH_SYSLINUX_SPLASH}" + +# \$LH_SYSLINUX_TIMEOUT: set custom syslinux timeout in seconds +# (Default: 0) +LH_SYSLINUX_TIMEOUT="${LH_SYSLINUX_TIMEOUT}" + +# \$LH_SYSLINUX_CFG: set custom syslinux configuration file +# (Default: empty) +LH_SYSLINUX_CFG="${LH_SYSLINUX_CFG}" + +# \$LH_SYSLINUX_MENU: set syslinux menu +# (Default: ${LH_SYSLINUX_MENU}) +LH_SYSLINUX_MENU="${LH_SYSLINUX_MENU}" + +# \$LH_SYSLINUX_MENU_LIVE_ENTRY: set text to be used on the menu for live entries +# (Default: ${LH_SYSLINUX_MENU_LIVE_ENTRY}) +LH_SYSLINUX_MENU_LIVE_ENTRY="${LH_SYSLINUX_MENU_LIVE_ENTRY}" + +# \$LH_SYSLINUX_MENU_LIVE_FAILSAFE_ENTRY: set text to be used on the menu for live entries (failsafe ones) +# (Default: ${LH_SYSLINUX_MENU_LIVE_FAILSAFE_ENTRY}) +LH_SYSLINUX_MENU_LIVE_FAILSAFE_ENTRY="${LH_SYSLINUX_MENU_LIVE_FAILSAFE_ENTRY}" + +# \$LH_SYSLINUX_MENU_MEMTEST_ENTRY: set text to be used on the menu for memtest entry +# (Default: ${LH_SYSLINUX_MENU_MEMTEST_ENTRY}) +LH_SYSLINUX_MENU_MEMTEST_ENTRY="${LH_SYSLINUX_MENU_MEMTEST_ENTRY}" + +# \$LH_USERNAME: set username +# (Default: ${LH_USERNAME}) +LH_USERNAME="${LH_USERNAME}" +EOF + +# Creating lh_source_* configuration +cat > config/source << EOF +# config/source - options for live-helper(7), source stage + +# \$LH_SOURCE: set source option +# (Default: ${LH_SOURCE}) +LH_SOURCE="${LH_SOURCE}" + +# \$LH_SOURCE_IMAGES: set image type +# (Default: ${LH_SOURCE_IMAGES}) +LH_SOURCE_IMAGES="${LH_SOURCE_IMAGES}" +EOF + +mkdir -p auto/functions + +if [ "${CONFIG}" = "clone" ] # FIXME +then + # Read package selection + echo $(dpkg --get-selections | awk '{ print $1 }') > config/chroot_local-packageslists/local-system + LH_PACKAGES_LISTS="${LH_PACKAGES_LISTS} local-system" + + # Read debconf questions + if [ ! -f /usr/bin/debconf-get-selections ] + then + Echo_warning "Please install 'debconf-utils' in order to use this feature." + else + debconf-get-selections | grep -v deinstall | cut -f1 > config/chroot_local-preseed/local-system + fi +fi + +if [ "${BACKPORTS}" = "true" ] +then + # Adding sources.list entry + +cat > config/chroot_sources/${LH_DISTRIBUTION}-backports.chroot << EOF +# Backports Maintainers +deb http://backports.debian-maintainers.org/ ${LH_DISTRIBUTION}/backports main contrib non-free +deb-src http://backports.debian-maintainers.org/ ${LH_DISTRIBUTION}/backports main contrib non-free +EOF + + cp config/chroot_sources/${LH_DISTRIBUTION}-backports.chroot config/chroot_sources/${LH_DISTRIBUTION}-backports.binary + + # Adding apt preferences + if ! grep -qs "^Pin: release o=backports.debian-maintainerns.org" config/chroot_apt/preferences + then + +cat >> config/chroot_apt/preferences << EOF +Package: * +Pin: release o=backports.debian-maintainerns.org +Pin-Priority: 999 +EOF + + fi + + # Addding archive signing key + wget -q http://backports.debian-maintainers.org/project/openpgp/archive-key.asc -O config/chroot_sources/${LH_DISTRIBUTION}-backports.chroot.gpg + cp config/chroot_sources/${LH_DISTRIBUTION}-backports.chroot.gpg config/chroot_sources/${LH_DISTRIBUTION}-backports.binary.gpg +fi + +# Creating stage file +Create_stagefile .stage/config diff --git a/helpers/lh b/helpers/lh index c22f554d6..8ab9de2df 100755 --- a/helpers/lh +++ b/helpers/lh @@ -34,15 +34,15 @@ case "${1}" in COMMAND="${1}" shift - if [ -x "${LH_BASE}/helpers/lh_${COMMAND}" ] + if [ -x "${LH_BASE}/helpers/${COMMAND}" ] then - LH=1 exec "${LH_BASE}/helpers/lh_${COMMAND}" "${@}" - elif [ -x /usr/share/live-helper/helpers/lh_${COMMAND} ] + LH=1 exec "${LH_BASE}/helpers/${COMMAND}" "${@}" + elif [ -x /usr/share/live-helper/helpers/${COMMAND} ] then - LH=1 exec /usr/share/live-helper/helpers/lh_"${COMMAND}" "${@}" - elif [ -x "$(which lh_${COMMAND} 2>/dev/null)" ] + LH=1 exec /usr/share/live-helper/helpers/"${COMMAND}" "${@}" + elif [ -x "$(which ${COMMAND} 2>/dev/null)" ] then - LH=1 exec lh_"${COMMAND}" "${@}" + LH=1 exec "${COMMAND}" "${@}" else Echo_error "no such helper" exit 1 diff --git a/helpers/lh_binary b/helpers/lh_binary deleted file mode 100755 index 33ee5d6ee..000000000 --- a/helpers/lh_binary +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh - -# lh_binary(1) - build binary images -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build binary images')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Setup cleanup function -Setup_cleanup - -# Preparing root filesystem -lh binary_chroot ${*} - -if [ "${LH_CHROOT_BUILD}" = "true" ] -then - # Configuring chroot - lh chroot_devpts install ${*} - lh chroot_proc install ${*} - lh chroot_selinuxfs install ${*} - lh chroot_sysfs install ${*} - lh chroot_hosts install ${*} - lh chroot_resolv install ${*} - lh chroot_hostname install ${*} - lh chroot_apt install-binary ${*} - lh chroot_sources install ${*} -fi - -# Building root filesystem -lh binary_rootfs ${*} -lh binary_manifest ${*} -lh binary_encryption ${*} - -# Prepare images -lh binary_local-packageslists ${*} -lh binary_linux-image ${*} -lh binary_debian-installer ${*} -lh binary_memtest ${*} -lh binary_grub ${*} -lh binary_grub2 ${*} -lh binary_syslinux ${*} -lh binary_yaboot ${*} -lh binary_silo ${*} -lh binary_disk ${*} -lh binary_win32-loader ${*} -lh binary_includes ${*} -lh binary_local-includes ${*} -lh binary_local-hooks ${*} -lh binary_md5sum ${*} - -if [ "${LH_CHROOT_BUILD}" != "true" ] -then - lh chroot_devpts install ${*} - lh chroot_proc install ${*} - lh chroot_selinuxfs install ${*} - lh chroot_sysfs install ${*} -fi - -# Building images -lh binary_iso ${*} -lh binary_net ${*} -lh binary_tar ${*} -lh binary_usb-hdd ${*} -lh binary_virtual-hdd ${*} - -if [ "${LH_CHROOT_BUILD}" = "true" ] -then - # Deconfiguring chroot - rm -f .stage/chroot_sources - lh chroot_hostname remove ${*} - lh chroot_resolv remove ${*} - lh chroot_hosts remove ${*} -fi - -lh chroot_apt remove ${*} -lh chroot_sysfs remove ${*} -lh chroot_selinuxfs remove ${*} -lh chroot_proc remove ${*} -lh chroot_devpts remove ${*} diff --git a/helpers/lh_binary_chroot b/helpers/lh_binary_chroot deleted file mode 100755 index c65b7b56e..000000000 --- a/helpers/lh_binary_chroot +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/sh - -# lh_binary_chroot(1) - copy chroot into chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'copy chroot into chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin copying chroot..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_chroot - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Normally, virtual filesystems are not mounted here, but people tend to be lazy -if [ -f chroot/proc/version ] -then - if [ "${LH_USE_FAKEROOT}" != "true" ] -then - ${LH_ROOT_COMMAND} umount chroot/proc - else - rm -rf chroot/proc - mkdir -p chroot/proc - fi -fi - -if [ -d chroot/sys/kernel ] -then - if [ "${LH_USE_FAKEROOT}" != "true" ] - then - ${LH_ROOT_COMMAND} umount chroot/sys - else - rm -rf chroot/sys - mkdir -p chroot/sys - fi -fi - -# Copying /dev if using fakeroot -if [ "${LH_USE_FAKEROOT}" = "true" ] -then - rm -rf chroot/dev - find /dev | cpio -dmpu chroot -fi - -if [ "${LH_CHROOT_BUILD}" = "false" ] -then - exit 0 -fi - -if [ "${LH_CACHE}" = "true" ] && Find_files cache/stages_rootfs/filesystem* -then - exit 0 -fi - -Echo_message "This may take a while." - -# Removing old chroot -${LH_ROOT_COMMAND} rm -rf chroot/chroot -${LH_ROOT_COMMAND} rm -rf chroot.tmp - -# Copying new chroot -if [ -d cache/stages_bootstrap ] && [ "${LH_CHROOT_FILESYSTEM}" != "plain" ] -then - ${LH_ROOT_COMMAND} mv chroot chroot.tmp - ${LH_ROOT_COMMAND} cp -a cache/stages_bootstrap chroot - ${LH_ROOT_COMMAND} touch chroot/chroot.cache -else - ${LH_ROOT_COMMAND} cp -a chroot chroot.tmp -fi - -${LH_ROOT_COMMAND} mv chroot.tmp chroot/chroot - -if [ -f config/binary_rootfs/exclude ] -then - # Read exclude file and expand wildcards. - for EXCLUDE in $(cat config/binary_rootfs/exclude) - do - if [ -e chroot/chroot/"${EXCLUDE}" ] - then - # Run "rm" inside the chroot so it cannot possibly remove host files. - Chroot chroot "rm -r chroot/${EXCLUDE}" - else - Echo_warning "Excluded path does not exist: %s" "${EXCLUDE}" - fi - done -fi - -if [ -n "${LH_ROOT_COMMAND}" ] -then - ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot -fi - -# Creating stage file -Create_stagefile .stage/binary_chroot diff --git a/helpers/lh_binary_debian-installer b/helpers/lh_binary_debian-installer deleted file mode 100755 index cb1af389c..000000000 --- a/helpers/lh_binary_debian-installer +++ /dev/null @@ -1,680 +0,0 @@ -#!/bin/sh - -# lh_binary_debian-installer(1) - install debian-installer into binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'install debian-installer into binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] -then - exit 0 -fi - -if [ "${_DEBUG}" = "true" ] -then - WGET_OPTIONS="${WGET_OPTIONS} --verbose" -elif [ "${_QUIET}" = "true" ] -then - WGET_OPTIONS="${WGET_OPTIONS} --quiet" -else - WGET_OPTIONS="${WGET_OPTIONS} --no-verbose" -fi - -# Check d-i configuration -case "${LH_DEBIAN_INSTALLER}" in - true|cdrom|netinst|netboot|businesscard|live) - ;; - - false) - exit 0 - ;; - - *) - Echo_error "debian-installer flavour %s not supported." "${LH_DEBIAN_INSTALLER}" - exit 1 - ;; -esac - -Echo_message "Begin installing debian-installer..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_debian-installer - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Checking depends -Check_package chroot/usr/bin/wget wget -Check_package chroot/usr/bin/apt-ftparchive apt-utils - -# Restoring cache -Restore_cache cache/packages_binary - -# Installing depends -Install_package - -# Setting destination directory -case "${LH_BINARY_IMAGES}" in - net) - DESTDIR="tftpboot/debian-install/${LH_ARCHITECTURE}" - ;; - - tar|usb-hdd) - DESTDIR="binary/install" - ;; - - *) - DESTDIR="binary/install" - ;; -esac - -# Set d-i image type -case "${LH_DEBIAN_INSTALLER}" in - businesscard|netboot|netinst) - DI_IMAGE_TYPE="netboot" - ;; - *) - case "${LH_BINARY_IMAGES}" in - net) - DI_IMAGE_TYPE="netboot" - ;; - - *) - DI_IMAGE_TYPE="cdrom" - ;; - esac - ;; -esac - -# Set architecture-specific variables -case "${LH_ARCHITECTURE}" in - powerpc) - case "${DI_IMAGE_TYPE}" in - cdrom) - DI_REMOTE_BASE="${LH_ARCHITECTURE}/cdrom" - ;; - - netboot) - DI_REMOTE_BASE="${LH_ARCHITECTURE}/netboot" - ;; - esac - - DI_REMOTE_KERNEL="vmlinux" - DI_REMOTE_BASE_GTK="${DI_REMOTE_BASE}/gtk" - ;; - - sparc) - DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" - DI_REMOTE_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})" - DI_REMOTE_BASE_GTK="none" - - DI_REMOTE_BASE="cdrom" - ;; - *) - case "${DI_IMAGE_TYPE}" in - netboot) - DI_REMOTE_BASE="netboot/debian-installer/${LH_ARCHITECTURE}" - DI_REMOTE_BASE_GTK="netboot/gtk/debian-installer/${LH_ARCHITECTURE}" - DI_REMOTE_KERNEL="linux" - ;; - - cdrom) - DI_REMOTE_BASE="cdrom" - DI_REMOTE_BASE_GTK="cdrom/gtk" - DI_REMOTE_KERNEL="vmlinuz" - ;; - esac - ;; -esac - -Check_multiarchitecture - -Install_file() { - local FILE - FILE="${1}" - - local TARGET - TARGET="${2}" - - SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')" - - if [ -z "${SOURCE}" ] - then - SOURCE="$(basename ${FILE} | awk -F_ '{ print $1 }')" - fi - - case "${SOURCE}" in - lib?*) - LETTER="$(echo ${SOURCE} | sed 's|\(....\).*|\1|')" - ;; - - *) - LETTER="$(echo ${SOURCE} | sed 's|\(.\).*|\1|')" - ;; - esac - - # Install directory - mkdir -p "${TARGET}"/"${LETTER}"/"${SOURCE}" - - # Move files - cp "${FILE}" "${TARGET}"/"${LETTER}"/"${SOURCE}" -} - -# Set absolute directory for caching; we require it when we call Download_file -# from a non-standard cwd. -_LH_CACHE_DIR="$(pwd)/cache/binary_debian-installer" - -Download_file () { - local _LH_TARGET - _LH_TARGET="${1}" - - local _LH_URL - _LH_URL="${2}" - - _LH_CACHE_FILE="${_LH_CACHE_DIR}/$(echo "${_LH_URL}" | sed 's|/|_|g')" - - if [ ! -f "${_LH_CACHE_FILE}" ] - then - mkdir -p ${_LH_CACHE_DIR} - if ! wget ${WGET_OPTIONS} -O "${_LH_CACHE_FILE}" "${_LH_URL}" - then - rm -f "${_LH_CACHE_FILE}" - - Echo_error "Could not download file: %s" "${_LH_URL}" - exit 1 - fi - fi - - if [ "$(stat --printf %d "${_LH_CACHE_DIR}")" = "$(stat --printf %d ./)" ] - then - CP_OPTIONS="-l" - fi - - cp -f ${CP_OPTIONS} -- "${_LH_CACHE_FILE}" "${_LH_TARGET}" -} - -VMLINUZ_DI="vmlinuz" -INITRD_DI="initrd.gz" -DESTDIR_DI="${DESTDIR}" - -VMLINUZ_GI="gtk/vmlinuz" -INITRD_GI="gtk/initrd.gz" -DESTDIR_GI="${DESTDIR}/gtk" - -if [ "${LH_DEBIAN_INSTALLER_DISTRIBUTION}" = "daily" ] -then - LH_DEBIAN_INSTALLER_DISTRIBUTION="sid" - - # Debian Installer daily builds - case "${LH_ARCHITECTURE}" in - alpha|amd64|hppa|ia64|mips|mipsel|powerpc) - URL="http://d-i.debian.org/daily-images/${LH_ARCHITECTURE}/daily/" - ;; - - arm|armel) - URL="http://people.debian.org/~kmuto/d-i/images/daily/" - ;; - - i386) - URL="http://people.debian.org/~joeyh/d-i/images/daily/" - ;; - - m68k) - URL="http://people.debian.org/~smarenka/d-i/images-m68k/daily/" - ;; - - s390) - URL="http://lophos.multibuild.org/d-i/images/daily/" - ;; - - sparc) - URL="http://people.debian.org/~stappers/d-i/images/daily/" - ;; - - *) - Echo_error "No daily-builds found for your architecture." - exit 1 - ;; - esac -else - URL="${LH_MIRROR_CHROOT}/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/installer-${LH_ARCHITECTURE}/current/images/" -fi - -mkdir -p "${DESTDIR_DI}" - -if [ "${LH_ARCHITECTURE}" = "sparc" ] && [ "${DI_IMAGE_TYPE}" = "netboot" ] -then - # There are no prepared kernel/initrd pairs for sparc netboot so we - # must unpack them from a mini.iso - Download_file mini.iso ${URL}/mini.iso - - mkdir mini.tmp - ${LH_ROOT_COMMAND} mount -o loop -t iso9660 mini.iso mini.tmp - - cp mini.tmp/boot/vmlinuz-${DEFAULT_FLAVOUR} "${DESTDIR}"/"${VMLINUZ_DI}" - cp mini.tmp/boot/initrd.gz "${DESTDIR}"/"${INITRD_DI}" - - ${LH_ROOT_COMMAND} umount mini.tmp - rm -rf mini.tmp mini.iso -else - # Downloading debian-installer - Download_file "${DESTDIR}"/"${VMLINUZ_DI}" ${URL}/${DI_REMOTE_BASE}/${DI_REMOTE_KERNEL} - Download_file "${DESTDIR}"/"${INITRD_DI}" ${URL}/${DI_REMOTE_BASE}/initrd.gz - - # Downloading graphical-installer - DOWNLOAD_GTK_INSTALLER=0 - if [ "${LH_DEBIAN_INSTALLER_GUI}" = "true" ] - then - case "${LH_ARCHITECTURE}" in - amd64|i386) - DOWNLOAD_GTK_INSTALLER=1 - ;; - - powerpc) - if [ "${LH_DEBIAN_INSTALLER}" = "netboot" ] - then - DOWNLOAD_GTK_INSTALLER=1 - fi - ;; - esac - fi - - if [ ${DOWNLOAD_GTK_INSTALLER} -eq 1 ] - then - mkdir -p "${DESTDIR_GI}" - Download_file "${DESTDIR}"/"${VMLINUZ_GI}" ${URL}/${DI_REMOTE_BASE_GTK}/${DI_REMOTE_KERNEL} - Download_file "${DESTDIR}"/"${INITRD_GI}" ${URL}/${DI_REMOTE_BASE_GTK}/initrd.gz - fi -fi - -# Only download additional packages if appropriate -if [ "${DI_IMAGE_TYPE}" != "netboot" ] -then - # Downloading additional packages - mkdir -p chroot/binary.deb/archives/partial - mkdir -p binary/pool/main - mv chroot/var/lib/dpkg/status chroot/var/lib/dpkg/status.tmp - touch chroot/var/lib/dpkg/status - - case "${LH_ARCHITECTURE}" in - amd64) - DI_REQ_PACKAGES="lilo grub" - - case "${LH_MODE}" in - ubuntu) - DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-generic" - ;; - - *) - DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-amd64" - ;; - esac - ;; - - i386) - DI_REQ_PACKAGES="elilo lilo grub" - - case "${LH_MODE}" in - ubuntu) - DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-generic" - ;; - - *) - DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-486 linux-image-2.6-686" - ;; - esac - ;; - - sparc) - DI_REQ_PACKAGES="silo" - DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-sparc64 linux-image-2.6-sparc64-smp" - ;; - - powerpc) - DI_REQ_PACKAGES="yaboot" - DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-powerpc linux-image-2.6-powerpc64 linux-image-2.6-powerpc-smp" - ;; - esac - - DI_PACKAGES="${DI_PACKAGES} busybox cryptsetup lvm2" - - # Set apt command prefix - _LH_APT_COMMAND="apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb -o APT::Install-Recommends=false --download-only" - - if [ "${LH_DEBIAN_INSTALLER}" = "live" ] - then - # We don't want to duplicate .debs of packages in binary/pool that are already - # installed to target/ via live-installer. - # - # However, we need to force various packages' inclusion in binary/pool/main as - # d-i does not support (for example) re-installing grub from target/ - the grub - # .debs must actually exist. - - # Modify dpkg status to show the required packages are not installed. - cp chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status - for PACKAGE in ${DI_REQ_PACKAGES} - do - awk -v f=0 ' - f == 1 { print "Status: purge ok not-installed"; f=0; next } - /Package: '"${PACKAGE}"'/ { f=1; } - { print } - ' chroot/var/lib/dpkg/status > chroot/var/lib/dpkg/status.awk - mv chroot/var/lib/dpkg/status.awk chroot/var/lib/dpkg/status - done - - # Download .deb's that we just marked as "purged" which caused broken dependencies - Chroot chroot ${_LH_APT_COMMAND} -f dist-upgrade - - # Revert dpkg status file - mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status - - # Download .debs of the required packages - Chroot chroot ${_LH_APT_COMMAND} install ${DI_REQ_PACKAGES} - else - # Download .debs of the required packages - Chroot chroot ${_LH_APT_COMMAND} install ${DI_PACKAGES} - - # Revert dpkg status file - mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status - fi - - mv chroot/binary.deb ./ - - if Find_files binary.deb/archives/*.deb - then - for FILE in binary.deb/archives/*.deb - do - Install_file "${FILE}" "binary/pool/main" - done - fi - - if [ "${LH_DEBIAN_INSTALLER}" != "live" ] - then - # Including base debian packages - if [ -d cache/packages_bootstrap ] - then - for FILE in cache/packages_bootstrap/*.deb - do - Install_file "${FILE}" "binary/pool/main" - done - else - Echo_error "Could not find cache/packages_bootstrap." - Echo_error "You selected values of LH_CACHE, LH_CACHE_PACKAGES, LH_CACHE_STAGES and LH_DEBIAN_INSTALLER which will result in 'bootstrap' packages not being cached - these are required when integrating the Debian Installer." - exit 1 - fi - fi - - # Including local debs - if Find_files config/binary_local-debs/*_"${LH_ARCHITECTURE}".deb - then - for FILE in config/binary_local-debs/*_"${LH_ARCHITECTURE}".deb - do - Install_file "${FILE}" "binary/pool/main" - done - fi - - if Find_files config/binary_local-debs/*_all.deb - then - for FILE in config/binary_local-debs/*_all.deb - do - Install_file "${FILE}" "binary/pool/main" - done - fi - - # Generating deb indices - mkdir -p binary/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE} - - mv binary chroot/root - echo "cd /root/binary && apt-ftparchive packages pool/main > dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages" > chroot/binary.sh - Chroot chroot "sh binary.sh" - rm -f chroot/binary.sh - mv chroot/root/binary ./ - - gzip -9 -c binary/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages > binary/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages.gz - - # Fetching release - Download_file binary/dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Release "${LH_MIRROR_CHROOT}"/dists/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/main/binary-"${LH_ARCHITECTURE}"/Release - - mkdir binary.udeb - cd binary.udeb - - # Downloading udeb indices - Download_file Packages.gz "${LH_MIRROR_CHROOT}"/dists/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LH_ARCHITECTURE}"/Packages.gz - gunzip -c Packages.gz > Packages - - # Sorting udebs - UDEBS="$(awk '/Filename: / { print $2 }' Packages)" - - # Downloading udebs - for UDEB in ${UDEBS} - do - if [ -f ../cache/packages_debian-installer.udeb/"$(basename ${UDEB})" ] - then - # Copying cached udebs - cp ../cache/packages_debian-installer.udeb/"$(basename ${UDEB})" ./ - else - # Downloading udebs - wget ${WGET_OPTIONS} "${LH_MIRROR_CHROOT}"/${UDEB} - fi - done - - # Caching udebs - rm -rf ../cache/packages_debian-installer.udeb - mkdir -p ../cache/packages_debian-installer.udeb - cp *.udeb ../cache/packages_debian-installer.udeb - - # Including local udebs - if Find_files ../config/binary_local-udebs/*_"${LH_ARCHITECTURE}".udeb - then - for FILE in ../config/binary_local-udebs/*_"${LH_ARCHITECTURE}".udeb - do - Install_file "${FILE}" "pool/main" - - # Prefer local udebs over downloaded udebs - rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb - done - fi - - if Find_files ../config/binary_local-udebs/*_all.udeb - then - for FILE in ../config/binary_local-udebs/*_all.udeb - do - Install_file "${FILE}" "pool/main" - - # Prefer local udebs over downloaded udebs - rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb - done - fi - - # Excluding udebs - grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/udeb_exclude > exclude || true - grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/exclude-udebs >> exclude || true - grep -v "^#" "${LH_BASE}"/data/debian-cd/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/exclude-udebs-${LH_ARCHITECTURE} >> exclude || true - - # Local exclude file - if [ -e ../config/binary_debian-installer/udeb_exclude ] - then - cat ../config/binary_debian-installer/udeb_exclude >> exclude - fi - - # Excluding udebs from excludes because we want them to be in the image on purpose - sed -i -e 's|di-utils-exit-installer||' exclude # used for live-installer-launcher - - while read EXCLUDE - do - if [ "${LH_DEBIAN_INSTALLER}" = "live" ] && [ "${EXCLUDE}" = "live-installer" ] - then - continue - fi - - rm -f ${EXCLUDE}_*.udeb - done < exclude - - # Enable live-installer - if [ "${LH_DEBIAN_INSTALLER}" = "live" ] - then - # Remove local udebs - rm -f pool/main/b/base-installer/bootstrap-base_*.udeb - - # Remove d-i udebs - rm -f bootstrap-base_*.udeb - fi - - # Moving udebs - for UDEB in ${UDEBS} - do - if [ -f "$(basename ${UDEB})" ] - then - mkdir -p $(dirname ${UDEB}) - mv "$(basename ${UDEB})" "$(dirname ${UDEB})" - fi - done - - # Creating udeb indices - mkdir -p dists/"${LH_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LH_ARCHITECTURE}" - cd "${OLDPWD}" - - mv binary.udeb chroot/root - echo "cd /root/binary.udeb && apt-ftparchive packages pool/main > dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LH_ARCHITECTURE}/Packages" > chroot/binary.sh - Chroot chroot "sh binary.sh" - rm -f chroot/binary.sh - mv chroot/root/binary.udeb ./ - - cd binary.udeb - gzip -9 -c dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LH_ARCHITECTURE}/Packages > dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LH_ARCHITECTURE}/Packages.gz - - rm -f Packages* exclude - find . | cpio -dmpu "${OLDPWD}"/binary - cd "${OLDPWD}" - - rm -rf binary.udeb - rm -rf binary.deb - - # Generating release file - mv binary chroot/root - -cat > chroot/binary.sh << EOF -cd /root/binary && apt-ftparchive \ - -o APT::FTPArchive::Release::Origin="Debian" \ - -o APT::FTPArchive::Release::Label="Debian" \ - -o APT::FTPArchive::Release::Suite="${LH_DEBIAN_INSTALLER_DISTRIBUTION}" \ - -o APT::FTPArchive::Release::Version="4.0" \ - -o APT::FTPArchive::Release::Codename="${LH_DEBIAN_INSTALLER_DISTRIBUTION}" \ - -o APT::FTPArchive::Release::Date="$(date -R)" \ - -o APT::FTPArchive::Release::Architectures="${LH_ARCHITECTURE}" \ - -o APT::FTPArchive::Release::Components="main" \ - -o APT::FTPArchive::Release::Description="Last updated: $(date -R)" \ - release dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION} > dists/${LH_DEBIAN_INSTALLER_DISTRIBUTION}/Release -EOF - - Chroot chroot "sh binary.sh" - rm -f chroot/binary.sh - mv chroot/root/binary ./ - - # Creating dist symlinks - for DISTRIBUTION in frozen stable testing unstable - do - ln -s ${LH_DEBIAN_INSTALLER_DISTRIBUTION} binary/dists/${DISTRIBUTION} - done - - if [ "${LH_BINARY_IMAGES}" != "usb-hdd" ] - then - ln -s . binary/debian - fi - - # Including preseeding files - if Find_files config/binary_debian-installer/*.cfg - then - cp config/binary_debian-installer/*.cfg binary/install - fi -fi - -Repack_initrd() -{ - local TARGET_INITRD - local INCLUDE_PATH - TARGET_INITRD="${1}" - INCLUDE_PATH="${2}" - REPACK_TMPDIR="unpacked-initrd" - - if [ -d "${INCLUDE_PATH}" ] - then - INCLUDE_PATH=$(readlink -f ${INCLUDE_PATH}) - fi - - # cpio does not have a "extract to directory", so we must change directory - mkdir -p ${REPACK_TMPDIR} - cd ${REPACK_TMPDIR} - - gzip -d < ../${TARGET_INITRD} | cpio -i --make-directories --no-absolute-filenames - if [ ! -d "${INCLUDE_PATH}" ] - then - # Invoked the old way, just copy the preseeds - cp ../config/binary_debian-installer/*.cfg . - else - # New way, include target directory content in the initrd - REPACK_TMPDIR_ABS="${PWD}" - cd "${INCLUDE_PATH}" - find -print0 | cpio -pumd0 --no-preserve-owner "${REPACK_TMPDIR_ABS}/" - cd "${OLDPWD}" - fi - find -print0 | cpio -H newc -o0 | gzip -9 > ../${TARGET_INITRD} - - cd .. - rm -rf ${REPACK_TMPDIR} -} - -# Preseed d-i by repacking the initrd in certain situations -if [ "${DI_IMAGE_TYPE}" = "netboot" ] && [ -e config/binary_debian-installer/preseed.cfg ] -then - Repack_initrd "${DESTDIR}"/"${INITRD_DI}" - - if [ -e "${DESTDIR}"/"${INITRD_GI}" ] - then - Repack_initrd "${DESTDIR}"/"${INITRD_GI}" - fi -fi - -# Include content of config/binary_debian-installer-includes if exists and not empty -if [ -d config/binary_debian-installer-includes ] && [ -n "$(ls -A config/binary_debian-installer-includes)" ] -then - Repack_initrd "${DESTDIR}"/"${INITRD_DI}" config/binary_debian-installer-includes - - if [ -e "${DESTDIR}"/"${INITRD_GI}" ] - then - Repack_initrd "${DESTDIR}"/"${INITRD_GI}" config/binary_debian-installer-includes - fi -fi - -# Saving cache -Save_cache cache/packages_binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .stage/binary_debian-installer diff --git a/helpers/lh_binary_disk b/helpers/lh_binary_disk deleted file mode 100755 index 2bbd73d98..000000000 --- a/helpers/lh_binary_disk +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/sh - -# lh_binary_disk (1) - install disk information into binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'install disk information into binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -case "${LH_BINARY_IMAGES}" in - iso|usb-hdd) - ;; - *) - exit 0 - ;; -esac - -Echo_message "Begin installing disk information..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_disk - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -mkdir -p binary/.disk - -ARCHITECTURE="$(echo ${LH_ARCHITECTURE} | sed -e 's| |/|g')" -DISTRIBUTION="$(echo ${LH_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')" -DISTRIBUTION="${DISTRIBUTION}$(echo ${LH_DISTRIBUTION} | cut -b 2-)" -eval VERSION="$`echo RELEASE_${LH_DISTRIBUTION}`" - -TITLE="Debian GNU/Linux" -case "${LH_MODE}" in - debian) - STRING="Official Snapshot ${ARCHITECTURE}" - TRACE="project/trace/ftp-master.debian.org" - ;; - - debian-release) - STRING="Official ${ARCHITECTURE}" - TRACE="project/trace/ftp-master.debian.org" - ;; - - ubuntu) - TITLE="Ubuntu GNU/Linux" - STRING="Build ${ARCHITECTURE}" - TRACE="" - ;; - - *) - STRING="Snapshot ${ARCHITECTURE}" - TRACE="" - ;; -esac - -if [ -n "${TRACE}" ] -then - echo "$(wget -q ${LH_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \ - > binary/.disk/archive_trace -fi - -case "${LH_DEBIAN_INSTALLER}" in - cdrom) - echo "main" > binary/.disk/base_components - - touch binary/.disk/base_installable - - echo "full_cd" > binary/.disk/cd_type - - echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/CD Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info - - cp "${LH_BASE}"/data/debian-cd/${LH_DISTRIBUTION}/${LH_ARCHITECTURE}_udeb_include binary/.disk/udeb_include - ;; - - true|netinst|live) - echo "main" > binary/.disk/base_components - - touch binary/.disk/base_installable - - echo "not_complete" > binary/.disk/cd_type - - if [ "${LH_DEBIAN_INSTALLER}" = "live" ] - then - echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/INSTALL Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info - else - echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/NETINST Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info - - fi - - cp "${LH_BASE}"/data/debian-cd/${LH_DISTRIBUTION}/${LH_ARCHITECTURE}_netinst_udeb_include binary/.disk/udeb_include - - if [ "${LH_DEBIAN_INSTALLER}" = "live" ] - then - echo "live-installer" >> binary/.disk/udeb_include - fi - ;; - - businesscard) - echo "main" > binary/.disk/base_components - - echo "not_complete" > binary/.disk/cd_type - - echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/BC Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info - - cp "${LH_BASE}"/data/debian-cd/${LH_DISTRIBUTION}/${LH_ARCHITECTURE}_businesscard_udeb_include binary/.disk/udeb_include - ;; - - false) - echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info - ;; -esac - -# Creating stage file -Create_stagefile .stage/binary_disk diff --git a/helpers/lh_binary_encryption b/helpers/lh_binary_encryption deleted file mode 100755 index 2990afa79..000000000 --- a/helpers/lh_binary_encryption +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/sh - -# lh_binary_encryption(1) - encrypts rootfs -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'encrypts rootfs')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] -then - exit 0 -fi - -case "${LH_ENCRYPTION}" in - aes128|aes192|aes256) - ;; - ""|false) - exit 0 - ;; - *) - Echo_error "Encryption type %s not supported." "${LH_ENCRYPTION}" - exit 1 - ;; -esac - -case "${LH_CHROOT_FILESYSTEM}" in - ext2|squashfs) - ;; - - *) - Echo_error "Encryption not yet supported on %s filesystems." "${LH_CHROOT_FILESYSTEM}" - exit 1 - ;; -esac - -Echo_message "Begin encrypting root filesystem image..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap .stage/binary_rootfs - -# Checking stage file -Check_stagefile .stage/binary_encryption - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -case "${LH_INITRAMFS}" in - casper) - INITFS="casper" - ;; - - live-initramfs) - INITFS="live" - ;; -esac - -# Checking depends -Check_package chroot/usr/bin/aespipe aespipe - -# Restoring cache -Restore_cache cache/packages_binary - -# Installing depends -Install_package - -Echo_message "Encrypting binary/%s/filesystem.%s with %s..." "${INITFS}" "${LH_CHROOT_FILESYSTEM}" "${LH_ENCRYPTION}" - -if [ "${LH_CHROOT_BUILD}" = "true" ] -then - # Moving image - mv binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} chroot -fi - -while true -do - echo - echo " **************************************" - Echo " ** Configuring encrypted filesystem **" - echo " **************************************" - Echo " (Passwords must be at least 20 characters long)" - echo - - case "${LH_CHROOT_BUILD}" in - true) - if Chroot chroot aespipe -e ${LH_ENCRYPTION} -T \ - < chroot/filesystem.${LH_CHROOT_FILESYSTEM} \ - > chroot/filesystem.${LH_CHROOT_FILESYSTEM}.tmp - then - mv chroot/filesystem.${LH_CHROOT_FILESYSTEM}.tmp binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} - break - fi - ;; - false) - if aespipe -e ${LH_ENCRYPTION} -T \ - < binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} \ - > binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM}.tmp - then - mv binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM}.tmp binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} - break - fi - ;; - esac - - printf "\nThere was an error configuring encryption ... Retry? [Y/n] " - read ANSWER - - if [ "$(echo "${ANSWER}" | cut -b1 | tr A-Z a-z)" = "n" ] - then - unset ANSWER - break - fi -done - -# Cleanup temporary filesystems -rm -f chroot/filesystem.${LH_CHROOT_FILESYSTEM} -rm -f chroot/filesystem.${LH_CHROOT_FILESYSTEM}.tmp -rm -f binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM}.tmp - -# Saving cache -Save_cache cache/packages_binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .stage/binary_encryption diff --git a/helpers/lh_binary_grub b/helpers/lh_binary_grub deleted file mode 100755 index 35fa43d43..000000000 --- a/helpers/lh_binary_grub +++ /dev/null @@ -1,339 +0,0 @@ -#!/bin/sh - -# lh_binary_grub(1) - installs grub into binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'installs grub into binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_BOOTLOADER}" != "grub" ] -then - exit 0 -fi - -Echo_message "Begin installing grub..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_grub - -# Checking grub templates -Check_templates grub - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Check architecture -Check_architecture amd64 i386 -Check_crossarchitecture - -# Checking depends -Check_package chroot/usr/sbin/grub grub - -# Restoring cache -Restore_cache cache/packages_binary - -# Installing depends -Install_package - -# Local functions -Grub_live_entry () -{ - LABEL="${1}" - KERNEL="${2}" - INITRD="${3}" - APPEND="${4}" - - LINUX_LIVE="${LINUX_LIVE}\ntitle\t\tDebian GNU/Linux - ${LABEL}" - LINUX_LIVE="${LINUX_LIVE}\nkernel\t\t/${KERNEL} boot=${INITFS} LH_BOOTAPPEND_LIVE ${APPEND}" - LINUX_LIVE="${LINUX_LIVE}\ninitrd\t\t/${INITRD}" -} - -Grub_install_entry () -{ - LABEL="${1}" - KERNEL="${2}" - INITRD="${3}" - APPEND="${4}" - - QAPPEND="quiet" - - for TYPE in Install Expert Rescue Auto - do - case "${TYPE}" in - Install) - TAPPEND="${APPEND} ${QAPPEND}" - ;; - - Expert) - TAPPEND="priority=low ${APPEND}" - ;; - - Rescue) - TAPPEND="rescue/enable=true ${APPEND} ${QAPPEND}" - ;; - - Auto) - TAPPEND="auto=true priority=critical ${APPEND} ${QAPPEND}" - ;; - esac - - case "${LABEL}" in - Text) - TYPE_SUFFIX="" - ;; - GUI) - TYPE_SUFFIX="gui" - ;; - esac - - - LINUX_INSTALL="${LINUX_INSTALL}\ntitle\t\t${LABEL} ${TYPE}" - LINUX_INSTALL="${LINUX_INSTALL}\nkernel\t\t/${KERNEL} ${TAPPEND} ${LH_BOOTAPPEND_INSTALL}" - LINUX_INSTALL="${LINUX_INSTALL}\ninitrd\t\t/${INITRD}" - done -} - -case "${LH_INITRAMFS}" in - casper) - INITFS="casper" - ;; - - live-initramfs) - INITFS="live" - ;; -esac - -# Setting destination directory -case "${LH_BINARY_IMAGES}" in - iso|tar) - case "${LH_INITRAMFS}" in - casper) - DESTDIR_LIVE="binary/casper" - ;; - - live-initramfs) - DESTDIR_LIVE="binary/live" - ;; - esac - - DESTDIR_INSTALL="binary/install" - ;; - - usb-hdd|net) - Echo_warning "Bootloader in this image type not yet supported by live-helper." - Echo_warning "This would produce a not bootable image, aborting (FIXME)." - exit 1 - ;; -esac - -Check_multiarchitecture - -# Creating directory -mkdir -p "${DESTDIR_LIVE}" - -# Setting boot parameters - -case "${LH_ENCRYPTION}" in - ""|false) - ;; - *) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} encryption=${LH_ENCRYPTION}" -esac - -if [ -n "${LH_USERNAME}" ] -then - case "${LH_INITRAMFS}" in - casper) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" - ;; - - live-initramfs) - if [ "${LH_USERNAME}" != "user" ] - then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" - fi - ;; - esac -fi - -if [ -n "${LH_HOSTNAME}" ] -then - case "${LH_INITRAMFS}" in - casper) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" - ;; - - live-initramfs) - if [ "${LH_HOSTNAME}" != "debian" ] - then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" - fi - ;; - esac -fi - -if [ "${LH_UNION_FILESYSTEM}" != "unionfs" ] -then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}" -fi - -if [ -n "${LH_NET_COW_PATH}" ] -then - Echo_error "Net cow not yet supported on grub" - exit 1 -fi - -if [ "${LH_EXPOSED_ROOT}" != "false" ] -then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} exposedroot" -fi - -LH_BOOTAPPEND_LIVE="$(echo ${LH_BOOTAPPEND_LIVE} | sed -e 's| ||')" - -# Parameters are listed at: linux/Documentation/kernel-parameters.txt -FAILSAFE="noapic noapm nodma nomce nolapic nosmp vga=normal" - -# Assembling kernel configuration - -# Default entries -DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" -DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})" -DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinuz-||')" - -Grub_live_entry "live" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" -Grub_live_entry "live (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" "${FAILSAFE}" - -for KERNEL in chroot/boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - Grub_live_entry "live, kernel ${VERSION}" "$(basename ${DESTDIR_LIVE})/$(basename ${KERNEL})" "$(basename ${DESTDIR_LIVE})/initrd.img-${VERSION}" - Grub_live_entry "live, kernel ${VERSION} (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/$(basename ${KERNEL})" "$(basename ${DESTDIR_LIVE})/initrd.img-${VERSION}" "${FAILSAFE}" -done - -LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" - -# Assembling debian-installer configuration -if [ "${LH_DEBIAN_INSTALLER}" != "false" ] -then - LINUX_LIVE="title\t\tLive:\nroot\n\n${LINUX_LIVE}" - LINUX_INSTALL="title\t\tInstaller:\nroot" - - VMLINUZ_DI="install/vmlinuz" - INITRD_DI="install/initrd.gz" - APPEND_DI="vga=normal" - - VMLINUZ_GI="install/gtk/vmlinuz" - INITRD_GI="install/gtk/initrd.gz" - APPEND_GI="video=vesa:ywrap,mtrr vga=788" - - if [ -f "binary/boot/${VMLINUZ_DI}" ] && [ -f "binary/boot/${INITRD_DI}" ] - then - Grub_install_entry "Text" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" - fi - - if [ -f "binary/boot/${VMLINUZ_GI}" ] && [ -f "binary/boot/${INITRD_GI}" ] - then - Grub_install_entry "GUI" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}" - fi -fi - -LINUX_INSTALL="$(/bin/echo ${LINUX_INSTALL} | sed -e 's|binary||g' -e 's|//|/|g')" - -# Assembling memtest configuration -if [ -f "${DESTDIR_LIVE}"/memtest ] -then - MEMTEST="title\t\tOther:\nroot" - MEMTEST="${MEMTEST}\n\ntitle\t\t${LH_MEMTEST}\nkernel\t\t/$(basename ${DESTDIR_LIVE})/memtest" - MEMTEST="$(/bin/echo ${MEMTEST} | sed -e 's|//|/|g')" -fi - -# Copying templates -mkdir -p binary/boot/grub -cp -r "${TEMPLATES}"/* binary/boot/grub - -case ${LH_BINARY_IMAGES} in - iso) - FILES="chroot/usr/lib/grub/*/stage2_eltorito" - ;; - - tar|usb-hdd) - FILES="chroot/usr/lib/grub/*/stage1 chroot/usr/lib/grub/*/e2fs_stage1_5 chroot/usr/lib/grub/*/stage2" - ;; -esac - -if [ "${LH_CHROOT_BUILD}" = "false" ] -then - FILES="$(echo ${FILES} | sed -e 's|chroot||g')" -fi - -# Copying grub -cp ${FILES} binary/boot/grub - -# Copying local configuration file -if [ -f config/binary_grub/menu.lst ] -then - cp config/binary_grub/menu.lst binary/boot/grub/menu.lst -fi - -# Copying splash screen -if [ -f config/binary_grub/splash.xpm.gz ] -then - LH_GRUB_SPLASH="config/binary_grub/splash.xpm.gz" -elif [ -f config/binary_grub/splash.xpm ] -then - LH_GRUB_SPLASH="config/binary_grub/splash.xpm" -fi - -if [ -n "${LH_GRUB_SPLASH}" ] -then - if [ "${LH_GRUB_SPLASH}" = "none" ] - then - # Removing splash file - rm -f binary/boot/grub/splash.xpm.gz - - # Removing splash entry - sed -i -e "s|splashimage.*||" binary/boot/grub/menu.lst - else - # Overwriting splash file - cp -f "${LH_GRUB_SPLASH}" binary/boot/grub - sed -i -e "s|splashimage.*|splashimage /boot/grub/$(basename ${LH_GRUB_SPLASH})|" binary/boot/grub/menu.lst - fi -fi - -sed -i -e "s|LINUX_LIVE|${LINUX_LIVE}|" -e "s|LINUX_INSTALL|${LINUX_INSTALL}|" -e "s|MEMTEST|${MEMTEST}|" binary/boot/grub/menu.lst -sed -i -e "s|LH_BOOTAPPEND_INSTALL|${LH_BOOTAPPEND_INSTALL}|" -e "s|LH_BOOTAPPEND_LIVE|${LH_BOOTAPPEND_LIVE}|" binary/boot/grub/menu.lst - -sed -i -e 's|\ $||g' binary/boot/grub/menu.lst - -# Saving cache -Save_cache cache/packages_binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .stage/binary_grub diff --git a/helpers/lh_binary_grub2 b/helpers/lh_binary_grub2 deleted file mode 100755 index 76b93734c..000000000 --- a/helpers/lh_binary_grub2 +++ /dev/null @@ -1,309 +0,0 @@ -#!/bin/sh - -# lh_binary_grub2(1) - installs grub2 into binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'installs grub2 into binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_BOOTLOADER}" != "grub2" ] -then - exit 0 -fi - -Echo_message "Begin installing grub2..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_grub - -# Checking grub2 templates -Check_templates grub2 - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Check architecture -Check_architecture amd64 i386 -Check_crossarchitecture - -# Checking depends -Check_package chroot/usr/bin/grub-mkimage grub-pc - -# Restoring cache -Restore_cache cache/packages_binary - -# Installing depends -Install_package - -# Local functions -Grub_live_entry () -{ - LABEL="${1}" - KERNEL="${2}" - INITRD="${3}" - APPEND="${4}" - - LINUX_LIVE="${LINUX_LIVE}\nmenuentry \"Debian GNU/Linux - ${LABEL}\" {" - LINUX_LIVE="${LINUX_LIVE}\nlinux\t\t/${KERNEL} boot=${INITFS} LH_BOOTAPPEND_LIVE ${APPEND}" - LINUX_LIVE="${LINUX_LIVE}\ninitrd\t\t/${INITRD}" - LINUX_LIVE="${LINUX_LIVE}\n}" -} - -Grub_install_entry () -{ - LABEL="${1}" - KERNEL="${2}" - INITRD="${3}" - APPEND="${4}" - - if [ "${LABEL}" != "rescue" ] && [ "${LABEL}" != "rescuegui" ] - then - APPEND="${APPEND} quiet" - fi - - LINUX_INSTALL="${LINUX_INSTALL}\nmenuentry \"Debian GNU/Linux - ${LABEL}\" {" - LINUX_INSTALL="${LINUX_INSTALL}\nlinux\t\t/${KERNEL} ${APPEND} LH_BOOTAPPEND_INSTALL" - LINUX_INSTALL="${LINUX_INSTALL}\ninitrd\t\t/${INITRD}" - LINUX_INSTALL="${LINUX_INSTALL}\n}" -} - -case "${LH_INITRAMFS}" in - casper) - INITFS="casper" - ;; - - live-initramfs) - INITFS="live" - ;; -esac - -# Setting destination directory -case "${LH_BINARY_IMAGES}" in - iso|tar) - case "${LH_INITRAMFS}" in - casper) - DESTDIR_LIVE="binary/casper" - ;; - - live-initramfs) - DESTDIR_LIVE="binary/live" - ;; - esac - - DESTDIR_INSTALL="binary/install" - ;; - - usb-hdd|net) - Echo_warning "Bootloader in this image type not yet supported by live-helper." - Echo_warning "This would produce a not bootable image, aborting (FIXME)." - exit 1 - ;; -esac - -Check_multiarchitecture - -# Creating directory -mkdir -p "${DESTDIR_LIVE}" - -# Setting boot parameters - -case "${LH_ENCRYPTION}" in - ""|false) - ;; - *) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} encryption=${LH_ENCRYPTION}" -esac - -if [ -n "${LH_USERNAME}" ] -then - case "${LH_INITRAMFS}" in - casper) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" - ;; - - live-initramfs) - if [ "${LH_USERNAME}" != "user" ] - then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" - fi - ;; - esac -fi - -if [ -n "${LH_HOSTNAME}" ] -then - case "${LH_INITRAMFS}" in - casper) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" - ;; - - live-initramfs) - if [ "${LH_HOSTNAME}" != "debian" ] - then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" - fi - ;; - esac -fi - -if [ "${LH_UNION_FILESYSTEM}" != "unionfs" ] -then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}" -fi - -if [ -n "${LH_NET_COW_PATH}" ] -then - Echo_error "Net cow not yet supported on grub" - exit 1 -fi - -if [ "${LH_EXPOSED_ROOT}" != "false" ] -then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} exposedroot" -fi - -LH_BOOTAPPEND_LIVE="$(echo ${LH_BOOTAPPEND_LIVE} | sed -e 's| ||')" - -# Parameters are listed at: linux/Documentation/kernel-parameters.txt -FAILSAFE="noapic noapm nodma nomce nolapic nosmp vga=normal" - -# Assembling kernel configuration - -# Default entries -DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" -DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})" -DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinuz-||')" - -Grub_live_entry "live" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" -Grub_live_entry "live (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" "${FAILSAFE}" - -for KERNEL in chroot/boot/vmlinuz-* -do - VERSION="$(basename ${KERNEL} | sed -e 's|vmlinuz-||')" - - Grub_live_entry "live, kernel ${VERSION}" "$(basename ${DESTDIR_LIVE})/$(basename ${KERNEL})" "$(basename ${DESTDIR_LIVE})/initrd.img-${VERSION}" - Grub_live_entry "live, kernel ${VERSION} (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/$(basename ${KERNEL})" "$(basename ${DESTDIR_LIVE})/initrd.img-${VERSION}" "${FAILSAFE}" -done - -LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" - -# Assembling debian-installer configuration -if [ "${LH_DEBIAN_INSTALLER}" != "false" ] -then - LINUX_LIVE="#\t \"Live\"\n${LINUX_LIVE}" - LINUX_INSTALL="#\t \"Installer\"\n" - - VMLINUZ_DI="install/vmlinuz" - INITRD_DI="install/initrd.gz" - APPEND_DI="vga=normal" - - VMLINUZ_GI="install/gtk/vmlinuz" - INITRD_GI="install/gtk/initrd.gz" - APPEND_GI="video=vesa:ywrap,mtrr vga=788" - - Grub_install_entry "install" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" - Grub_install_entry "installgui" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}" - Grub_install_entry "expert" "${VMLINUZ_DI}" "${INITRD_DI}" "priority=low ${APPEND_DI}" - Grub_install_entry "expertgui" "${VMLINUZ_GI}" "${INITRD_GI}" "priority=low ${APPEND_GI}" - Grub_install_entry "rescue" "${VMLINUZ_DI}" "${INITRD_DI}" "rescue/enable=true ${APPEND_DI}" - Grub_install_entry "rescuegui" "${VMLINUZ_GI}" "${INITRD_GI}" "rescue/enable=true ${APPEND_GI}" - Grub_install_entry "auto" "${VMLINUZ_DI}" "${INITRD_DI}" "auto=true priority=critical ${APPEND_DI}" - Grub_install_entry "autogui" "${VMLINUZ_GI}" "${INITRD_GI}" "auto=true priority=critical ${APPEND_GI}" -fi - -LINUX_INSTALL="$(/bin/echo ${LINUX_INSTALL} | sed -e 's|binary||g' -e 's|//|/|g')" - -# Assembling memtest configuration -if [ -f "${DESTDIR_LIVE}"/memtest ] -then - MEMTEST="#\t \"Other\"\n" - MEMTEST="${MEMTEST}\nmenuentry\t\"${LH_MEMTEST}\" {\nlinux16\t$(basename ${DESTDIR_LIVE})/memtest\n}" - MEMTEST="$(/bin/echo ${MEMTEST} | sed -e 's|//|/|g')" -fi - -# Copying templates -mkdir -p binary/boot/grub -cp -r "${TEMPLATES}"/* binary/boot/grub - -case ${LH_BINARY_IMAGES} in - iso) - FILES="chroot/usr/lib/grub/i386-pc/*.mod chroot/usr/lib/grub/i386-pc/*.lst chroot/usr/lib/grub/i386-pc/efiemu??.o chroot/usr/share/grub/*.pf2" - ;; - - tar|usb-hdd) - FILES="chroot/usr/lib/grub/i386-pc/*" - ;; -esac - -if [ "${LH_CHROOT_BUILD}" = "false" ] -then - FILES="$(echo ${FILES} | sed -e 's|chroot||g')" -fi - -# Copying grub -cp ${FILES} binary/boot/grub - -# Copying local configuration file -if [ -f config/binary_grub/grub.cfg ] -then - cp config/binary_grub/grub.cfg binary/boot/grub/grub.cfg -fi - -# Copying splash screen -if [ -f config/binary_grub/splash.tga ] -then - LH_GRUB_SPLASH="config/binary_grub/splash.tga" -fi - -if [ -n "${LH_GRUB_SPLASH}" ] -then - if [ "${LH_GRUB_SPLASH}" = "none" ] - then - # Removing splash file - rm -f binary/boot/grub/splash.tga - - # Removing splash entry - sed -i -e "s|background_image.*||" binary/boot/grub/grub.cfg - else - # Overwriting splash file - cp -f "${LH_GRUB_SPLASH}" binary/boot/grub - sed -i -e "s|background_image .*.tga|background_image \$\(root\)/boot/grub/$(basename ${LH_GRUB_SPLASH})|" binary/boot/grub/grub.cfg - fi -fi - -sed -i -e "s|LINUX_LIVE|${LINUX_LIVE}|" -e "s|LINUX_INSTALL|${LINUX_INSTALL}|" -e "s|MEMTEST|${MEMTEST}|" binary/boot/grub/grub.cfg -sed -i -e "s|LH_BOOTAPPEND_INSTALL|${LH_BOOTAPPEND_INSTALL}|" -e "s|LH_BOOTAPPEND_LIVE|${LH_BOOTAPPEND_LIVE}|" binary/boot/grub/grub.cfg - -sed -i -e 's|\ $||g' binary/boot/grub/grub.cfg - -# Saving cache -Save_cache cache/packages_binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .stage/binary_grub diff --git a/helpers/lh_binary_includes b/helpers/lh_binary_includes deleted file mode 100755 index 196f9027b..000000000 --- a/helpers/lh_binary_includes +++ /dev/null @@ -1,166 +0,0 @@ -#!/bin/sh - -# lh_binary_includes(1) - copy files into binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'copy files into binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_INCLUDES}" = "none" ] -then - exit 0 -fi - -Echo_message "Begin copying binary includes..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_includes - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Check user includes -if [ ! -d "${LH_INCLUDES}" ] -then - if [ -d ../"${LH_INCLUDES}" ] - then - LH_INCLUDES="../${LH_INCLUDES}" - else - Echo_error "user specified includes not accessible in %s" "${LH_INCLUDES}" - exit 1 - fi -fi - -# Checking local includes -if [ -d config/includes/"${LH_DISTRIBUTION}" ] -then - LH_INCLUDES="config/includes" -fi - -# Assemble architecture -case "${LH_ARCHITECTURE}" in - amd64) - ARCH="amd" - ;; - - i386) - ARCH="386" - ;; - - powerpc) - ARCH="ppc" - ;; - - sparc) - ARCH="spa" - ;; -esac - -# Working arround vfat limitations -if [ "${LH_BINARY_IMAGE}" = "usb-hdd" ] -then - case "${LH_BINARY_FILESYSTEM}" in - fat*) - CP_OPTIONS="-L" - ;; - esac -fi - -# Copying common templates -if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common ] && \ -Find_files "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common/* -then - cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common/* binary -fi - -if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common."${ARCH}" ] && \ -Find_files "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common."${ARCH}"/* -then - cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/common."${ARCH}"/* binary -fi - -# Copying live templates -if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live ] && \ -Find_files "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live/* -then - cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live/* binary -fi - -if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live."${ARCH}" ] && \ -Find_files "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live."${ARCH}"/* -then - cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/live."${ARCH}"/* binary -fi - -if [ "${LH_DEBIAN_INSTALLER}" != "false" ] -then - # Copying install templates - if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install ] && \ - Find_files "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install/* - then - cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install/* binary - fi - - if [ -d "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install."${ARCH}" ] && \ - Find_files "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install."${ARCH}"/* - then - cp -r ${CP_OPTIONS} "${LH_INCLUDES}"/"${LH_DISTRIBUTION}"/install."${ARCH}"/* binary - fi - - # Adjusting install templates - ARCHITECTURE="$(echo ${LH_ARCHITECTURE} | sed -e 's| |/|g')" - DISTRIBUTION="$(echo ${LH_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')" - DISTRIBUTION="${DISTRIBUTION}$(echo ${LH_DISTRIBUTION} | cut -b 2-)" - eval VERSION="$`echo RELEASE_${LH_DISTRIBUTION}`" - - if [ -d binary/pool/main/l/live-installer ] - then - TYPE="LIVE/INSTALL" - fi - - TYPE="LIVE/NETINST" - - DEBIAN_NAME="Debian GNU/Linux ${VERSION} \"${DISTRIBUTION}\" - Official ${ARCHITECTURE} ${TYPE} Binary $(date +%Y%m%d-%H:%M)" - DEBIAN_DATE="$(date +%Y%m%d-%H:%M)" - - if [ "${LH_ARCHITECTURE}" = "i386" ] - then - DEBIAN_TOOLS_HTML="

\n  \n /tools/\n \n\n and\n  \n /install/floppy/\n " - DEBIAN_TOOLS_TXT="/tools/ and /install/floppy/" - else - DEBIAN_TOOLS_HTML="

\n  \n /tools/\n \n\n\n\n\n\n" - DEBIAN_TOOLS_TXT="/tools/" - fi - - if [ -f binary/README.html ] - then - sed -i -e "s|DEBIAN_NAME|${DEBIAN_NAME}|g" -e "s|DEBIAN_DATE|${DEBIAN_DATE}|g" -e "s|DEBIAN_TOOLS|${DEBIAN_TOOLS_HTML}|g" binary/README.html - sed -i -e "s|DEBIAN_NAME|${DEBIAN_NAME}|g" -e "s|DEBIAN_DATE|${DEBIAN_DATE}|g" -e "s|DEBIAN_TOOLS|${DEBIAN_TOOLS_TXT}|g" binary/README.txt - fi -fi - -# Creating stage file -Create_stagefile .stage/binary_includes diff --git a/helpers/lh_binary_iso b/helpers/lh_binary_iso deleted file mode 100755 index 4012a7021..000000000 --- a/helpers/lh_binary_iso +++ /dev/null @@ -1,219 +0,0 @@ -#!/bin/sh - -# lh_binary_iso(1) - build iso binary image -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build iso binary image')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if ! In_list iso "${LH_BINARY_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building binary iso image..." - -# Requiring stage file -Require_stagefile .stage/config .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/genisoimage genisoimage - -if [ "${LH_BINARY_ISO_HYBRID}" = "true" ] -then - Check_package chroot/usr/bin/isohybrid syslinux-common -fi - -# Restoring cache -Restore_cache cache/packages_binary - -# Installing depends -Install_package - -# Remove old iso image -if [ -f binary.iso ] -then - rm -f binary.iso -fi - -# Handle genisoimage generic options -GENISOIMAGE_OPTIONS="-J -l -cache-inodes -allow-multidot" - -# Handle genisoimage live-helper specific options -if [ "${_QUIET}" = "true" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -quiet" -fi - -if [ "${_VERBOSE}" = "true" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v" -fi - -if [ -n "${LH_ISO_APPLICATION}" ] && [ "${LH_ISO_APPLICATION}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LH_ISO_APPLICATION}\"" -fi - -if [ -n "${LH_ISO_PREPARER}" ] && [ "${LH_ISO_PREPARER}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LH_ISO_PREPARER}\"" -fi - -if [ -n "${LH_ISO_PUBLISHER}" ] && [ "${LH_ISO_PUBLISHER}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LH_ISO_PUBLISHER}\"" -fi - -if [ -n "${LH_ISO_VOLUME}" ] && [ "${LH_ISO_VOLUME}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LH_ISO_VOLUME}\"" -fi - -# Handle genisoimage architecture specific options -case "${LH_BOOTLOADER}" in - grub) - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table" - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b boot/grub/stage2_eltorito" - GENISOIMAGE_EXCLUDE="boot/grub/stage2_eltorito" - ;; - - grub2) - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table" - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b boot/grub/grub_eltorito -J" - GENISOIMAGE_EXCLUDE="boot/grub/grub_eltorito" - ;; - - silo) - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -G boot/isofs.b -B ..." - GENISOIMAGE_EXCLUDE="boot/isofs.b" - ;; - - syslinux) - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table" - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b isolinux/isolinux.bin -c isolinux/boot.cat" - GENISOIMAGE_EXCLUDE="isolinux/isolinux.bin" - ;; - - yaboot) - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r --iso-level 2 --netatalk -hfs -probe -map" - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} binary/yaboot/hfs.map --chrp-boot -part -no-desktop" - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -hfs-bless binary/yaboot -hfs-volid Debian/Live_powerpc" - GENISOIMAGE_EXCLUDE="yaboot/hfs.map" - ;; - - *) - Echo_warning "Bootloader on your architecture not yet supported by live-helper." - Echo_warning "This will produce a most likely not bootable image (Continuing in 5 seconds)." - sleep 5 - ;; -esac - -if In_list "stripped minimal" "${LH_PACKAGES_LISTS}" -then - if [ "${LH_DEBIAN_INSTALLER}" != "live" ] - then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m ${GENISOIMAGE_EXCLUDE}" - fi -fi - -if [ "${LH_BOOTLOADER}" = "grub2" ] -then - -cat > binary.sh << EOF -#!/bin/sh - -input_dir=/usr/lib/grub/i386-pc - -# build core.img -core_img=\$(mktemp) -grub-mkimage -d \${input_dir} -o \${core_img} biosdisk iso9660 - -# build grub_eltorito image -cat \${input_dir}/cdboot.img \${core_img} > binary/boot/grub/grub_eltorito - -rm -f \${core_img} - -for file in \${input_dir}/*.mod \${input_dir}/efiemu??.o \ - \${input_dir}/command.lst \${input_dir}/moddep.lst \${input_dir}/fs.lst \ - \${input_dir}/handler.lst \${input_dir}/parttool.lst -do - if test -f "\$file" - then - cp -f "\$file" binary/boot/grub - fi -done -EOF - -else - echo "#!/bin/sh" > binary.sh -fi - -cat >> binary.sh << EOF - -genisoimage ${GENISOIMAGE_OPTIONS} -o binary.iso binary -EOF - -if [ "${LH_BINARY_ISO_HYRBID}" = "true" ] -then - -cat >> binary.sh << EOF - -isohybrid binary.iso -EOF - -fi - -case "${LH_CHROOT_BUILD}" in - true) - # Moving image - mv binary.sh chroot - mv binary chroot - - Chroot chroot "sh binary.sh" - - # Move image - mv chroot/binary chroot/binary.iso ./ - rm -f chroot/binary.sh - ;; - - false) - sh binary.sh - rm -f binary.sh - ;; -esac - -# Saving cache -Save_cache cache/packages_binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .stage/binary_iso diff --git a/helpers/lh_binary_linux-image b/helpers/lh_binary_linux-image deleted file mode 100755 index d08ae18ca..000000000 --- a/helpers/lh_binary_linux-image +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh - -# lh_binary_linux-image(1) - install linux-image into binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'install linux-image into binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] -then - exit 0 -fi - -Echo_message "Begin install linux-image..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_linux-image - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -case "${LH_INITRAMFS}" in - casper) - DESTDIR="binary/casper" - ;; - - live-initramfs) - DESTDIR="binary/live" - ;; -esac - -case "${LH_ARCHITECTURE}" in - powerpc) - LINUX="vmlinux" - ;; - - *) - LINUX="vmlinuz" - ;; -esac - -Check_multiarchitecture - -# Creating directory -mkdir -p "${DESTDIR}" - -# Installing linux-image -cp chroot/boot/"${LINUX}"-* "${DESTDIR}" -cp chroot/boot/initrd.img-* "${DESTDIR}" - -case "${LH_INITRAMFS}" in - live-initramfs) - cp chroot/usr/share/doc/live-initramfs/parameters.txt "${DESTDIR}"/parameters.txt || true - ;; -esac - -# Creating stage file -Create_stagefile .stage/binary_linux-image diff --git a/helpers/lh_binary_local-hooks b/helpers/lh_binary_local-hooks deleted file mode 100755 index 704879b7c..000000000 --- a/helpers/lh_binary_local-hooks +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh - -# lh_binary_local-hooks(1) - execute local hooks in binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'execute local hooks in binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin executing local hooks..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_local-hooks - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Processing local-hooks -if Find_files config/binary_local-hooks/* -then - for HOOK in config/binary_local-hooks/* - do - # Making hook executable - if [ ! -x "${HOOK}" ] - then - chmod +x "${HOOK}" - fi - - # Executing hook - ./"${HOOK}" || ( Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ) - done - - # Creating stage file - Create_stagefile .stage/binary_local-hooks -fi diff --git a/helpers/lh_binary_local-includes b/helpers/lh_binary_local-includes deleted file mode 100755 index 63986aeca..000000000 --- a/helpers/lh_binary_local-includes +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh - -# lh_binary_local-includes(1) - copy files into binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'copy files into binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin copying binary local includes..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_local-includes - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if Find_files config/binary_local-includes/ -then - # Copying includes - cd config/binary_local-includes - find . | cpio -dmpu --no-preserve-owner "${OLDPWD}"/binary - cd "${OLDPWD}" - - # Removing symlinks - if [ "${LH_BINARY_IMAGES}" = "usb-hdd" ] - then - find binary -type l | xargs rm -f - fi - - # Creating stage file - Create_stagefile .stage/binary_local-includes -fi diff --git a/helpers/lh_binary_local-packageslists b/helpers/lh_binary_local-packageslists deleted file mode 100755 index 43d8005ba..000000000 --- a/helpers/lh_binary_local-packageslists +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/sh - -# lh_binary_local-packageslists(1) - install local packages lists into binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'install local packages into binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin installing local packages lists..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_local-packageslists - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if Find_files config/binary_local-packageslists/* -then - # Restoring cache - Restore_cache cache/packages_chroot - - # Check depends - Check_package chroot/usr/bin/apt-ftparchive apt-utils - - # Installing depends - Install_package - - mkdir -p chroot/binary.deb/archives/partial - mv chroot/var/lib/dpkg/status chroot/var/lib/dpkg/status.tmp - touch chroot/var/lib/dpkg/status - - for PACKAGESLIST in config/binary_local-packageslists/* - do - # Generate package list - Expand_packagelist "${PACKAGESLIST}" "config/binary_local-packageslists" "config/chroot_local-packageslists" > chroot/root/"$(basename ${PACKAGESLIST})" - - # Downloading additional packages - Chroot chroot "xargs --arg-file=/root/$(basename ${PACKAGESLIST}) apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb --download-only install" - - # Remove package list - rm chroot/root/"$(basename ${PACKAGESLIST})" - done - - for FILE in chroot/binary.deb/archives/*.deb - do - SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')" - - if [ -z "${SOURCE}" ] - then - SOURCE="$(basename ${FILE} | awk -F_ '{ print $1 }')" - fi - - case "${SOURCE}" in - lib?*) - LETTER="$(echo ${SOURCE} | sed 's|\(....\).*|\1|')" - ;; - - *) - LETTER="$(echo ${SOURCE} | sed 's|\(.\).*|\1|')" - ;; - esac - - # Install directory - mkdir -p binary/pool/main/"${LETTER}"/"${SOURCE}" - - # Move files - mv "${FILE}" binary/pool/main/"${LETTER}"/"${SOURCE}" - done - - cd binary - mkdir -p dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE} - apt-ftparchive packages pool/main > dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages - gzip -9 -c dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages > dists/${LH_DISTRIBUTION}/main/binary-${LH_ARCHITECTURE}/Packages.gz - cd "${OLDPWD}" - - rm -rf chroot/binary.deb - mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status - - # Removing depends - Remove_package - - # Saving cache - Save_cache cache/packages_chroot - - # Creating stage file - Create_stagefile .stage/binary_local-packageslists -fi diff --git a/helpers/lh_binary_manifest b/helpers/lh_binary_manifest deleted file mode 100755 index 4c40115a7..000000000 --- a/helpers/lh_binary_manifest +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh - -# lh_binary_manifest(1) - create manifest -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'create manifest')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] -then - exit 0 -fi - -Echo_message "Begin creating manifest..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_manifest - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -case "${LH_INITRAMFS}" in - casper) - INITFS="casper" - - # Add filesystem.manifest - Chroot chroot "dpkg --get-selections" | awk '{ print $1 }' | sort -u > binary/casper/filesystem.manifest - ;; - - live-initramfs) - INITFS="live" - ;; -esac - -# Add packages.list -cat > binary/${INITFS}/packages.txt << EOF -This file contains the list of all packages installed in this live system. - - -EOF - -Chroot chroot "dpkg -l" >> binary/${INITFS}/packages.txt - -cp binary/${INITFS}/packages.txt binary.packages - -# Creating stage file -Create_stagefile .stage/binary_manifest diff --git a/helpers/lh_binary_md5sum b/helpers/lh_binary_md5sum deleted file mode 100755 index 57087d8ee..000000000 --- a/helpers/lh_binary_md5sum +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh - -# lh_binary_md5sum(1) - create binary md5sums -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'create binary md5sums')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_CHECKSUMS}" != "true" ] || [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] -then - exit 0 -fi - -Echo_message "Begin creating binary md5sum.txt..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_md5sum - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Remove old md5sums -if [ -f binary/md5sum.txt ] -then - rm -f binary/md5sum.txt -fi - -# Calculating md5sums -cd binary -find . -type f \! -path './isolinux/isolinux.bin' \! -path './boot/grub/stage2_eltorito' -print0 | sort -z | xargs -0 md5sum > ../md5sum.txt - -cat > md5sum.txt << EOF -This file contains the list of md5 checksums of all files on this medium. - -You can verify them automatically with the 'integrity-check' boot parameter, -or, manually with: 'md5sum -c md5sum.txt'. - - -EOF - -cat ../md5sum.txt >> md5sum.txt -rm -f ../md5sum.txt - -# File list -find . | sed -e 's|^.||g' | grep "^/" | sort > ../binary.list - -cd "${OLDPWD}" - -# Creating stage file -Create_stagefile .stage/binary_md5sum diff --git a/helpers/lh_binary_memtest b/helpers/lh_binary_memtest deleted file mode 100755 index 581ec9a1f..000000000 --- a/helpers/lh_binary_memtest +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/sh - -# lh_binary_memtest(1) - installs a memtest into binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'installs a memtest into binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] || [ "${LH_MEMTEST}" = "false" ] || [ "${LH_MEMTEST}" = "none" ] -then - exit 0 -fi - -Echo_message "Begin installing memtest..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_memtest - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ "${LH_ARCHITECTURE}" != "amd64" ] && [ "${LH_ARCHITECTURE}" != "i386" ] -then - Echo_warning "skipping binary_memtest, foreign architecture." - exit 0 -fi - -if [ "${LH_CHROOT_BUILD}" = "true" ] -then - - if [ -f chroot/usr/sbin/grub ] && [ ! -f chroot/boot/grub/menu.lst ] - then - GRUB="yes" - - mkdir -p chroot/boot/grub - touch chroot/boot/grub/menu.lst - fi -fi - -# Checking depends -case "${LH_MEMTEST}" in - memtest86) - Check_package chroot/boot/memtest86.bin memtest86 - ;; - - memtest86+) - Check_package chroot/boot/memtest86+.bin memtest86+ - ;; -esac - -# Restoring cache -Restore_cache cache/packages_binary - -# Installing depends -Install_package - -# Setting destination directory -case "${LH_INITRAMFS}" in - casper) - DESTDIR="binary/casper" - ;; - - live-initramfs) - DESTDIR="binary/live" - ;; -esac - -Check_multiarchitecture - -# Creating directory -mkdir -p "${DESTDIR}" - -# Installing memtest -case "${LH_CHROOT_BUILD}" in - true) - cp chroot/boot/${LH_MEMTEST}.bin "${DESTDIR}"/memtest - ;; - - false) - cp /boot/${LH_MEMTEST}.bin "${DESTDIR}"/memtest - ;; -esac - -# Saving cache -Save_cache cache/packages_binary - -# Removing depends -Remove_package - -if [ "${GRUB}" ] -then - rm -rf chroot/boot/grub -fi - -# Creating stage file -Create_stagefile .stage/binary_memtest diff --git a/helpers/lh_binary_net b/helpers/lh_binary_net deleted file mode 100755 index 05ecce71e..000000000 --- a/helpers/lh_binary_net +++ /dev/null @@ -1,167 +0,0 @@ -#!/bin/sh - -# lh_binary_net(1) - build netboot binary image -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build netboot binary image')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if ! In_list net "${LH_BINARY_IMAGES}" -then - exit 0 -fi - -if [ "${LH_NET_TARBALL}" = "none" ] -then - exit 0 -fi - -Echo_message "Begin building binary netboot image..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_net - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ "${LH_ARCHITECTURE}" = "sparc" ] -then - # Checking depends - Check_package chroot/usr/bin/elftoaout sparc-utils - - # Restoring cache - Restore_cache cache/packages_binary - - # Installing depends - Install_package - - # Set target and source directories - DESTDIR="tftpboot" - case "${LH_INITRAMFS}" in - casper) - ORIGDIR="binary/casper" - ;; - - live-initramfs) - ORIGDIR="binary/live" - ;; - esac - - # Find defaults - DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" - DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})" - DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinuz-||')" - DEFAULT_MAP="$(echo chroot/boot/System.map-*${DEFAULT_FLAVOUR})" - - gzip -cd ${ORIGDIR}/${DEFAULT_KERNEL} > kernel.tmp - - mkdir -p ${DESTDIR} - rm -f ${DESTDIR}/boot.img - elftoaout -o ${DESTDIR}/boot.img kernel.tmp - - case "${DEFAULT_FLAVOUR}" in - sparc32) - piggyback ${DESTDIR}/boot.img ${DEFAULT_MAP} ${ORIGDIR}/${DEFAULT_INITRD} - ;; - sparc64) - piggyback64 ${DESTDIR}/boot.img ${DEFAULT_MAP} ${ORIGDIR}/${DEFAULT_INITRD} - ;; - *) - Echo_error "Invalid default kernel flavour for sparc \"%s\"" "${DEFAULT_FLAVOUR}" - exit 1; - ;; - esac - - # Pad boot.img - REMAINDER=$((( 4 - $(stat -c %s ${DESTDIR}/boot.img) % 4 ) % 4)) - dd if=/dev/zero bs=1 count=${REMAINDER} >> ${DESTDIR}/boot.img - - # No need for kernel and initrd images in the binary - rm -f ${ORIGDIR}/vmlinuz-* - rm -f ${ORIGDIR}/initrd.img-* - - # Clean temporaries - rm -f kernel.tmp - - # Saving cache - Save_cache cache/packages_binary - - # Removing depends - Remove_package -fi - -# Remove old binary -rm -f binary-net.tar.bz2 -rm -f binary-net.tar.gz -rm -f binary-net.tar - -# Creating image file -ROOT_DIR=$(basename ${LH_NET_ROOT_PATH}) -if [ "${ROOT_DIR}" = "chroot" ] -then - mv chroot chroot.tmp -fi - -if [ "${ROOT_DIR}" != "binary" ] -then - mv binary ${ROOT_DIR} -fi - -mkdir binary.tmp -mv ${ROOT_DIR} tftpboot binary.tmp -cd binary.tmp - -case "${LH_NET_TARBALL}" in - bzip2) - tar cfj ../binary-net-tar.bz2 * - ;; - - gzip) - tar cf ../binary-net.tar * - gzip ${GZIP_OPTIONS} ../binary-net.tar - ;; - - tar) - tar cf ../binary-net.tar * - ;; -esac - -mv * ../ -cd "${OLDPWD}" -rmdir binary.tmp - -if [ "${ROOT_DIR}" != "binary" ] -then - mv ${ROOT_DIR} binary -fi - -if [ "${ROOT_DIR}" = "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 deleted file mode 100755 index a862895fe..000000000 --- a/helpers/lh_binary_rootfs +++ /dev/null @@ -1,453 +0,0 @@ -#!/bin/sh - -# lh_binary_rootfs(1) - build rootfs image -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build rootfs image')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin building root filesystem image..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap .stage/binary_chroot - -# Checking stage file -Check_stagefile .stage/binary_rootfs - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -case "${LH_ARCHITECTURE}" in - amd64|i386) - LINUX="vmlinuz" - ;; - - powerpc) - LINUX="vmlinux" - ;; -esac - -case "${LH_INITRAMFS}" in - casper) - INITFS="casper" - ;; - - live-initramfs) - INITFS="live" - ;; -esac - -# Creating directory -mkdir -p binary/${INITFS} - -for STAGE in ${LH_CACHE_STAGES} -do - if [ "${STAGE}" = "rootfs" ] && [ -d cache/stages_rootfs ] - then - # Removing old chroot - rm -rf binary/"${INITFS}"/filesystem.* - - # Restoring old cache - mkdir -p binary/"${INITFS}" - ${LH_ROOT_COMMAND} cp -a cache/stages_rootfs/filesystem.* binary/"${INITFS}" - - if [ -n "${LH_ROOT_COMMAND}" ] - then - ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) binary - fi - - # Creating stage file - Create_stagefile .stage/binary_rootfs - exit 0 - fi -done - -# Handling chroot excludes -if [ "${LH_CHROOT_BUILD}" = "true" ] -then - if [ -f config/binary_rootfs/excludes ] - then - cp config/binary_rootfs/excludes chroot/chroot/excludes - chroot chroot/chroot /usr/bin/env -i xargs --arg-file=/excludes -I FILE bash -c 'rm -rf FILE' - rm -f chroot/chroot/excludes - fi - - if [ "${LH_DEBIAN_INSTALLER}" != "live" ] - then - case "${LH_PACKAGES_LISTS}" in - stripped|minimal) - # kernel images - rm -f chroot/chroot/boot/${LINUX}* - rm -f chroot/chroot/boot/initrd.img* - - # kernel symlinks - rm -f chroot/chroot/${LINUX}* - rm -f chroot/chroot/initrd.img* - ;; - esac - fi -else - if [ "${LH_CHROOT_FILESYSTEM}" != "squashfs" ] - then - Echo_warning "rootfs excludes are not supported on non-chrooted builds unless squashfs as chroot filesystem is used, thus ignoring excludes now." - fi -fi - -case "${LH_CHROOT_FILESYSTEM}" in - ext2|ext3) - # Checking depends - Check_package chroot/usr/bin/genext2fs genext2fs - - # Restoring cache - Restore_cache cache/packages_binary - - # Installing depends - Install_package - - # Remove old image - if [ -f binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} ] - then - rm -f binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} - fi - - DU_DIM="$(du -ks chroot/chroot | cut -f1)" - REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LH_CHROOT_FILESYSTEM})" - - RESERVED_PERCENTAGE="--reserved-percentage" - - case "${LH_CHROOT_BUILD}" in - true) - Chroot chroot "genext2fs --size-in-blocks=${REAL_DIM} ${RESERVED_PERCENTAGE}=0 --root=chroot filesystem.${LH_CHROOT_FILESYSTEM}" - - # Move image - mv chroot/filesystem.${LH_CHROOT_FILESYSTEM} binary/${INITFS} - - if [ -e chroot/chroot.cache ] - then - rm -f .lock - mv chroot/chroot chroot.tmp - - lh chroot_linux-image remove ${*} - lh chroot_sources remove ${*} - lh chroot_apt remove ${*} - lh chroot_hostname remove ${*} - lh chroot_resolv remove ${*} - lh chroot_hosts remove ${*} - lh chroot_sysv-rc remove ${*} - lh chroot_dpkg remove ${*} - lh chroot_debianchroot remove ${*} - lh chroot_sysfs remove ${*} - lh chroot_selinuxfs remove ${*} - lh chroot_proc remove ${*} - lh chroot_devpts remove ${*} - - rm -rf chroot - mv chroot.tmp chroot - - lh chroot_devpts install ${*} - lh chroot_proc install ${*} - lh chroot_selinuxfs install ${*} - lh chroot_sysfs install ${*} - lh chroot_debianchroot install ${*} - lh chroot_dpkg install ${*} - lh chroot_sysv-rc install ${*} - lh chroot_hosts install ${*} - lh chroot_resolv install ${*} - lh chroot_hostname install ${*} - lh chroot_apt install ${*} - lh chroot_sources install ${*} - lh chroot_linux-image install ${*} - - touch .lock - else - rm -rf chroot/chroot - fi - ;; - - false) - genext2fs --size-in-blocks=${REAL_DIM} ${RESERVED_PERCENTAGE}=0 --root=chroot binary/${INITFS}/filesystem.${LH_CHROOT_FILESYSTEM} - ;; - esac - - # Saving cache - Save_cache cache/packages_binary - - # Removing depends - Remove_package - ;; - - jffs2) - # Checking depends - Check_package chroot/usr/sbin/mkfs.jffs2 mtd-tools - - # Restoring cache - Restore_cache cache/packages_binary - - # Installing depends - Install_package - - # Remove old jffs2 image - if [ -f binary/${INITFS}/filesystem.jffs2 ] - then - rm -f binary/${INITFS}/filesystem.jffs2 - fi - - if [ -n "${LH_JFFS2_ERASEBLOCK}" ] - then - JFFS2_OPTIONS="--eraseblock=${LH_JFFS2_ERASEBLOCK}" - fi - - case "${LH_CHROOT_BUILD}" in - true) - Chroot chroot "mkfs.jffs2 ${JFFS2_OPTIONS} --root=chroot --output filesystem.jffs2" - - # Move image - mv chroot/filesystem.jffs2 binary/${INITFS} - - if [ -e chroot/chroot.cache ] - then - rm -f .lock - mv chroot/chroot chroot.tmp - - lh chroot_linux-image remove ${*} - lh chroot_sources remove ${*} - lh chroot_apt remove ${*} - lh chroot_hostname remove ${*} - lh chroot_resolv remove ${*} - lh chroot_hosts remove ${*} - lh chroot_sysv-rc remove ${*} - lh chroot_dpkg remove ${*} - lh chroot_debianchroot remove ${*} - lh chroot_sysfs remove ${*} - lh chroot_selinuxfs remove ${*} - lh chroot_proc remove ${*} - lh chroot_devpts remove ${*} - - rm -rf chroot - mv chroot.tmp chroot - - lh chroot_devpts install ${*} - lh chroot_proc install ${*} - lh chroot_selinuxfs install ${*} - lh chroot_sysfs install ${*} - lh chroot_debianchroot install ${*} - lh chroot_dpkg install ${*} - lh chroot_sysv-rc install ${*} - lh chroot_hosts install ${*} - lh chroot_resolv install ${*} - lh chroot_hostname install ${*} - lh chroot_apt install ${*} - lh chroot_sources install ${*} - lh chroot_linux-image install ${*} - - touch .lock - else - rm -rf chroot/chroot - fi - ;; - - false) - mkfs.jffs2 ${JFFS2_OPTIONS} --root=chroot --output binary/${INITFS}/filesystem.jffs2 - ;; - esac - - # Saving cache - Save_cache cache/packages_binary - - # Removing depends - Remove_package - ;; - - plain) - if [ -d binary/${INITFS}/filesystem.dir ] - then - rm -rf binary/${INITFS}/filesystem.dir - fi - - case "${LH_CHROOT_BUILD}" in - true) - mv chroot/chroot binary/${INITFS}/filesystem.dir - ;; - - false) - cp -a chroot binary/${INITFS}/filesystem.dir - ;; - esac - ;; - - squashfs) - # Checking depends - Check_package chroot/usr/share/doc/squashfs-tools squashfs-tools - - # Restoring cache - Restore_cache cache/packages_binary - - # Installing depends - Install_package - - Echo_message "Preparing squashfs image..." - Echo_message "This may take a while." - - # Remove old squashfs image - if [ -f binary/${INITFS}/filesystem.squashfs ] - then - rm -f binary/${INITFS}/filesystem.squashfs - fi - - # Remove stale squashfs image - rm -f chroot/filesystem.squashfs - - MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -no-progress" - - if [ "${_VERBOSE}" = "true" ] - then - MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -info" - fi - - if [ -f config/binary_rootfs/squashfs.sort ] - then - MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -sort squashfs.sort" - cp config/binary_rootfs/squashfs.sort chroot #FIXME - fi - - case "${LH_CHROOT_BUILD}" in - true) - # Create image - Chroot chroot "mksquashfs chroot filesystem.squashfs ${MKSQUASHFS_OPTIONS}" - - # Move image - ${LH_ROOT_COMMAND} mv chroot/filesystem.squashfs binary/${INITFS} - ${LH_ROOT_COMMAND} rm -f chroot/squashfs.sort - - if [ -e chroot/chroot.cache ] - then - rm -f .lock - mv chroot/chroot chroot.tmp - - lh chroot_linux-image remove ${*} - lh chroot_sources remove ${*} - lh chroot_apt remove ${*} - lh chroot_hostname remove ${*} - lh chroot_resolv remove ${*} - lh chroot_hosts remove ${*} - lh chroot_sysv-rc remove ${*} - lh chroot_dpkg remove ${*} - lh chroot_debianchroot remove ${*} - lh chroot_sysfs remove ${*} - lh chroot_selinuxfs remove ${*} - lh chroot_proc remove ${*} - lh chroot_devpts remove ${*} - - rm -rf chroot - mv chroot.tmp chroot - - lh chroot_devpts install ${*} - lh chroot_proc install ${*} - lh chroot_selinuxfs install ${*} - lh chroot_sysfs install ${*} - lh chroot_debianchroot install ${*} - lh chroot_dpkg install ${*} - lh chroot_sysv-rc install ${*} - lh chroot_hosts install ${*} - lh chroot_resolv install ${*} - lh chroot_hostname install ${*} - lh chroot_apt install ${*} - lh chroot_sources install ${*} - lh chroot_linux-image install ${*} - - touch .lock - else - rm -rf chroot/chroot - fi - - ${LH_ROOT_COMMAND} chmod 0644 binary/${INITFS}/filesystem.squashfs - ;; - - false) - if [ -f config/binary_rootfs/excludes ] - then - case "${LH_DISTRIBUTION}" in - lenny|sid) - MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -wildcards -ef config/binary_rootfs/excludes" - ;; - esac - fi - - mksquashfs chroot binary/${INITFS}/filesystem.squashfs ${MKSQUASHFS_OPTIONS} - ;; - esac - - if [ -n "${LH_ROOT_COMMAND}" ] - then - ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) binary/${INITFS} - fi - - # Saving cache - Save_cache cache/packages_binary - - # Removing depends - Remove_package - ;; - - none) - if [ -d binary ] - then - rm -rf binary - fi - - case "${LH_CHROOT_BUILD}" in - true) - mv chroot/chroot binary - ;; - - false) - Echo_message "This may take a while." - cp -a chroot binary - ;; - esac - ;; - -esac - -for STAGE in ${LH_CACHE_STAGES} -do - if [ "${STAGE}" = "rootfs" ] - then - rm -rf cache/stages_rootfs - - mkdir -p cache/stages_rootfs - - if [ "${LH_CHROOT_FILESYSTEM}" != "none" ] - then - ${LH_ROOT_COMMAND} cp -a binary/"${INITFS}"/filesystem.* cache/stages_rootfs - fi - - if [ -n "${LH_ROOT_COMMAND}" ] - then - ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/stages_rootfs - fi - fi -done - -# Creating stage file -Create_stagefile .stage/binary_rootfs diff --git a/helpers/lh_binary_silo b/helpers/lh_binary_silo deleted file mode 100755 index d79d0b74d..000000000 --- a/helpers/lh_binary_silo +++ /dev/null @@ -1,272 +0,0 @@ -#!/bin/sh - -# lh_binary_silo(1) - installs silo into binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'installs silo into binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_BOOTLOADER}" != "silo" ] -then - exit 0 -fi - -# Check image type -case "${LH_BINARY_IMAGES}" in - iso|usb-hdd|tar) - ;; - - net) - # silo not required for sparc netbooting - exit 0 - ;; -esac - -Echo_message "Begin installing silo..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_silo - -# Checking silo templates -Check_templates silo - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Check architecture -Check_architecture sparc - -# Checking depends -Check_package chroot/usr/sbin/silo silo - -# Restoring cache -Restore_cache cache/packages_binary - -# Installing depends -Install_package - -# Local functions -Silo_live_entry () -{ - LABEL="${1}" - KERNEL="${2}" - INITRD="${3}" - APPEND="${4}" - - DIRECTORY="/$(basename ${DESTDIR_LIVE})" - - LINUX_LIVE="${LINUX_LIVE}\nimage=${DIRECTORY}/${KERNEL}\n" - LINUX_LIVE="${LINUX_LIVE}\t label=${LABEL}\n" - LINUX_LIVE="${LINUX_LIVE}\t initrd=${DIRECTORY}/${INITRD}\n" - LINUX_LIVE="${LINUX_LIVE}\t append=\"boot=${INITFS} LH_BOOTAPPEND_LIVE ${APPEND}\"\n" -} - -Silo_install_entry () -{ - LABEL="${1}" - KERNEL="${2}" - INITRD="${3}" - APPEND="${4}" - - DIRECTORY="/$(basename ${DESTDIR_INSTALL})" - - if [ "${LABEL}" != "rescue" ] && [ "${LABEL}" != "rescuegui" ] - then - APPEND="${APPEND} quiet" - fi - - LINUX_INSTALL="${LINUX_INSTALL}\nimage=${DIRECTORY}/${KERNEL}\n" - LINUX_INSTALL="${LINUX_INSTALL}\t label=${LABEL}\n" - LINUX_INSTALL="${LINUX_INSTALL}\t initrd=${DIRECTORY}/${INITRD}\n" - LINUX_INSTALL="${LINUX_INSTALL}\t append=\"LH_BOOTAPPEND_LIVE ${APPEND} LH_BOOTAPPEND_INSTALL\"\n" -} - -# Setting destination directories -DESTDIR_INSTALL="binary/install" -case "${LH_INITRAMFS}" in - casper) - INITFS="casper" - DESTDIR_LIVE="binary/casper" - ;; - - live-initramfs) - INITFS="live" - DESTDIR_LIVE="binary/live" - ;; -esac - -# Creating directory -mkdir -p "${DESTDIR_LIVE}" - -# Setting boot parameters -case "${LH_ENCRYPTION}" in - ""|false) - ;; - *) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} encryption=${LH_ENCRYPTION}" - ;; -esac - -if [ -n "${LH_USERNAME}" ] -then - case "${LH_INITRAMFS}" in - casper) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" - ;; - - live-initramfs) - if [ "${LH_USERNAME}" != "user" ] - then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" - fi - ;; - esac -fi - -if [ -n "${LH_HOSTNAME}" ] -then - case "${LH_INITRAMFS}" in - casper) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" - ;; - - live-initramfs) - if [ "${LH_HOSTNAME}" != "debian" ] - then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" - fi - ;; - esac -fi - -if [ "${LH_UNION_FILESYSTEM}" != "unionfs" ] -then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}" -fi - -if [ -n "${LH_NET_COW_PATH}" ] -then - Echo_error "Net cow not supported on silo" - exit 1 -fi - -if [ "${LH_EXPOSED_ROOT}" != "false" ] -then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} exposedroot" -fi - -LH_BOOTAPPEND_LIVE="$(echo ${LH_BOOTAPPEND_LIVE} | sed -e 's| ||')" - -# Parameters are listed at: linux/Documentation/kernel-parameters.txt -FAILSAFE="noapic noapm nodma nomce nolapic nosmp vga=ofonly" - -# Assembling kernel configuration - -# Default entries -DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" -DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})" -DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinuz-||')" - -Silo_live_entry "live" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" -Silo_live_entry "live-failsafe" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" "${FAILSAFE}" - -if [ "$(echo ${LH_LINUX_FLAVOURS} | wc -w)" -gt "1" ] -then - for KERNEL in chroot/boot/vmlinuz-* - do - KERNEL_IMAGE="$(basename ${KERNEL})" - KERNEL_VERSION="$(echo ${KERNEL_IMAGE} | sed -e 's|vmlinuz-||')" - INITRD="initrd.img-${KERNEL_VERSION}" - - Silo_live_entry "live-${KERNEL_VERSION}" "${KERNEL_IMAGE}" "${INITRD}" - Silo_live_entry "live-${KERNEL_VERSION}-failsafe" "${KERNEL_IMAGE}" "${INITRD}" "${FAILSAFE}" - done -fi - -LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" - -# Assembling debian-installer configuration -if [ "${LH_DEBIAN_INSTALLER}" != "false" ] -then - VMLINUZ_DI="vmlinuz" - INITRD_DI="initrd.gz" - APPEND_DI="vga=normal" - - Silo_install_entry "linux" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" - Silo_install_entry "install" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" - Silo_install_entry "expert" "${VMLINUZ_DI}" "${INITRD_DI}" "priority=low ${APPEND_DI}" - Silo_install_entry "rescue" "${VMLINUZ_DI}" "${INITRD_DI}" "rescue/enable=true ${APPEND_DI}" - Silo_install_entry "auto" "${VMLINUZ_DI}" "${INITRD_DI}" "auto=true priority=critical ${APPEND_DI}" -fi - -LINUX_INSTALL="$(/bin/echo ${LINUX_INSTALL} | sed -e 's|binary||g' -e 's|//|/|g')" - -case "${LH_BINARY_IMAGES}" in - iso|usb-hdd) - # Copying silo - mkdir -p binary/boot - - case "${LH_CHROOT_BUILD}" in - true) - cp chroot/boot/second.b binary/boot - ;; - - false) - cp /boot/second.b binary/boot - ;; - esac - - cp -r "${TEMPLATES}"/* binary/boot - - if [ "${LH_DEBIAN_INSTALLER}" = "false" ] - then - rm -f binary/boot/debian.txt.install - else - mv binary/boot/debian.txt.install binary/boot/debian.txt - fi - - # Configure silo templates - sed -i -e "s|LINUX_LIVE|${LINUX_LIVE}|" \ - -e "s|LINUX_INSTALL|${LINUX_INSTALL}|" \ - binary/boot/silo.conf - sed -i -e "s|LH_BOOTAPPEND_INSTALL|${LH_BOOTAPPEND_INSTALL}|" \ - -e "s|LH_BOOTAPPEND_LIVE|${LH_BOOTAPPEND_LIVE}|" \ - binary/boot/silo.conf - sed -i -e "s|LH_DATE|$(date +%Y%m%d)|" \ - -e "s|LH_VERSION|${VERSION}|" \ - -e "s|LH_DISTRIBUTION|${LH_DISTRIBUTION}|" \ - binary/boot/debian.txt - ;; -esac - -# Saving cache -Save_cache cache/packages_binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .stage/binary_silo diff --git a/helpers/lh_binary_syslinux b/helpers/lh_binary_syslinux deleted file mode 100755 index ba7f9d530..000000000 --- a/helpers/lh_binary_syslinux +++ /dev/null @@ -1,659 +0,0 @@ -#!/bin/sh - -# lh_binary_syslinux(1) - installs syslinux into binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'installs syslinux into binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_BOOTLOADER}" != "syslinux" ] -then - exit 0 -fi - -Echo_message "Begin installing syslinux..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_syslinux - -# Checking syslinux templates -Check_templates syslinux - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Check architecture -Check_architecture amd64 i386 -Check_crossarchitecture - -# Checking depends -Check_package chroot/usr/bin/syslinux syslinux - -# Restoring cache -Restore_cache cache/packages_binary - -# Installing depends -Install_package - -# Local functions -Utf8_to_latin1 () -{ - VALUE="${1}" - - echo "${VALUE}" | iconv -f utf-8 -t latin1 -} - -Syslinux_memtest_entry () -{ - LABEL="${1}" - MENULABEL="$(Utf8_to_latin1 "${2}")" - KERNEL="${3}" - - MEMTEST="${MEMTEST}\nlabel ${LABEL}\n" - - # Write the menu label if the syslinux menu is being use - MEMTEST="${MEMTEST}\tmenu label ${MENULABEL}\n" - MEMTEST="${MEMTEST}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n" - MEMTEST="$(/bin/echo ${MEMTEST} | sed -e 's|//|/|g')" -} - -Syslinux_live_entry () -{ - LABEL="${1}" - MENULABEL="$(Utf8_to_latin1 "${2}")" - MENULABEL="${2}" - KERNEL="${3}" - INITRD="${4}" - APPEND="${5}" - - case "${LH_BINARY_IMAGES}" in - iso|usb-hdd) - NUMBER="$(ls -1 ${KERNEL_PATH} | grep 'vmlinuz[0-9]\+$' | wc -l)" - NUMBER="$((${NUMBER} +1))" - - # Do not add numbering to filenames if first kernel/initrd - if [ "${NUMBER}" = "1" ] - then - NUMBER="" - fi - - # Note: ISOLINUX will not find the kernel if the name ends in ".img". - if [ -e ${KERNEL_PATH}/${KERNEL} ] - then - mv ${KERNEL_PATH}/${KERNEL} ${KERNEL_PATH}/vmlinuz${NUMBER} - fi - - if [ -e ${KERNEL_PATH}/${INITRD} ] - then - mv ${KERNEL_PATH}/${INITRD} ${KERNEL_PATH}/initrd${NUMBER}.img - fi - - KERNEL=vmlinuz${NUMBER} - INITRD=initrd${NUMBER}.img - ;; - esac - - # Regular kernel - LINUX_LIVE="${LINUX_LIVE}\nlabel ${LABEL}\n" - - # Write the menu label if the syslinux menu is being use - if [ -n "${MENULABEL}" ] - then - LINUX_LIVE="${LINUX_LIVE}\tmenu label ${MENULABEL}\n" - fi - - LINUX_LIVE="${LINUX_LIVE}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n" - LINUX_LIVE="${LINUX_LIVE}\tappend initrd=${LIVE_KERNEL_PATH}/${INITRD} boot=${INITFS} ${LH_BOOTAPPEND_LIVE} ${APPEND}\n" - - # Failsafe kernel - LINUX_LIVE="${LINUX_LIVE}\nlabel ${LABEL}failsafe\n" - - # Write the menu label if the syslinux menu is being use - if [ -n "${MENULABEL}" ] - then - LINUX_LIVE="${LINUX_LIVE}\tmenu label ${MENULABEL} (failsafe)\n" - fi - - LINUX_LIVE="${LINUX_LIVE}\tkernel ${LIVE_KERNEL_PATH}/${KERNEL}\n" - LINUX_LIVE="${LINUX_LIVE}\tappend initrd=${LIVE_KERNEL_PATH}/${INITRD} boot=${INITFS} ${LH_BOOTAPPEND_LIVE} ${APPEND} ${FAILSAFE}\n" -} - -Syslinux_install_entry () -{ - LABEL="${1}" - KERNEL="${2}" - INITRD="${3}" - APPEND="${4}" - - # Boot in quiet mode where appropriate - QAPPEND="quiet" - - for TYPE in Install Expert Rescue Auto - do - case "${TYPE}" in - Install) - TAPPEND="${APPEND} ${QAPPEND}" - ;; - - Expert) - TAPPEND="priority=low ${APPEND}" - ;; - - Rescue) - TAPPEND="rescue/enable=true ${APPEND} ${QAPPEND}" - ;; - - Auto) - TAPPEND="auto=true priority=critical ${APPEND} ${QAPPEND}" - ;; - esac - - case "${LABEL}" in - Text) - TYPE_SUFFIX="" - ;; - GUI) - TYPE_SUFFIX="gui" - ;; - esac - - LINUX_INSTALL="${LINUX_INSTALL}\nlabel $(echo "${TYPE}" | tr A-Z a-z)${TYPE_SUFFIX}\n" - LINUX_INSTALL="${LINUX_INSTALL}\tmenu label ${LABEL} ${TYPE}\n" - LINUX_INSTALL="${LINUX_INSTALL}\tkernel ${LIVE_INSTALL_KERNEL_PATH}/${KERNEL}\n" - LINUX_INSTALL="${LINUX_INSTALL}\tappend initrd=${LIVE_INSTALL_KERNEL_PATH}/${INITRD} ${TAPPEND} ${LH_BOOTAPPEND_INSTALL}\n" - done -} - -Copy_syslinux_templates () -{ - cp -r "${TEMPLATES}"/common/* ${SCREEN_PATH} - - if [ "${LH_SYSLINUX_MENU}" = "false" ] - then - cp "${TEMPLATES}"/normal/* ${SCREEN_PATH} - else - cp "${TEMPLATES}"/menu/* ${SCREEN_PATH} - - case "${LH_SYSLINUX_MENU}" in - gfxboot) - MENUMODULE="gfxboot.c32" - ;; - - menu) - MENUMODULE="menu.c32" - ;; - - vesamenu) - MENUMODULE="vesamenu.c32" - ;; - - *) - if [ -z "${LH_SYSLINUX_CFG}" ] - then - MENUMODULE=$(grep 'menu.c32' ${TEMPLATES}/menu/syslinux.cfg | sed 's|default\s*.*/\(.*menu.c32\)$|\1|g') - else - LH_SYSLINUX_CFG="${LH_SYSLINUX_CFG:-${TEMPLATES}/menu/syslinux.cfg}" - fi - ;; - esac - - case "${LH_CHROOT_BUILD}" in - true) - cp chroot/usr/lib/syslinux/"${MENUMODULE}" ${DATA_PATH} - ;; - false) - cp /usr/lib/syslinux/"${MENUMODULE}" ${DATA_PATH} - ;; - esac - fi - - if ls "${TEMPLATES}/${LH_LANGUAGE}"/* > /dev/null 2>&1 - then - cp -r "${TEMPLATES}"/"${LH_LANGUAGE}"/* ${SCREEN_PATH} - else - if ls "${TEMPLATES}"/en/* > /dev/null 2>&1 - then - cp -r "${TEMPLATES}"/en/* ${SCREEN_PATH} - fi - fi - - if ls ${SCREEN_PATH}/*.live > /dev/null 2>&1 - then - for FILE in ${SCREEN_PATH}/*.live - do - mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .live) - done - fi - - if [ "${LH_DEBIAN_INSTALLER}" != "false" ] - then - if ls ${SCREEN_PATH}/*.install > /dev/null 2>&1 - then - for FILE in ${SCREEN_PATH}/*.install - do - mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install) - done - fi - - case "${LH_ARCHITECTURE}" in - amd64|i386|powerpc) - if ls ${SCREEN_PATH}/*.install.g-i > /dev/null 2>&1 - then - for FILE in ${SCREEN_PATH}/*.install.g-i - do - mv ${FILE} $(dirname ${FILE})/$(basename ${FILE} .install.g-i) - done - fi - ;; - - *) - rm -f ${SCREEN_PATH}/*.install.g-i - ;; - esac - else - rm -f ${SCREEN_PATH}/*.install* - fi - - if [ "${LH_SYSLINUX_MENU}" != "false" ] - then - rm -f ${DATA_PATH}/boot.txt - fi - - # Copying custom splash screen - if [ "${LH_SYSLINUX_SPLASH}" = "none" ] - then - # no splash screen - SPLASH="" - rm -f ${SCREEN_PATH}/splash.rle - rm -f ${DATA_PATH}/splash.png - else - if [ "${LH_SYSLINUX_MENU}" = "false" ] - then - SPLASH="${LIVE_DATA_PATH}/splash.rle" - else - SPLASH="${LIVE_DATA_PATH}/splash.png" - fi - - if [ -n "${LH_SYSLINUX_SPLASH}" ] - then - if [ ! -e "${LH_SYSLINUX_SPLASH}" ] - then - Echo_error "%s doen't exist" "${LH_SYSLINUX_SPLASH}" - exit 1 - else - rm -f ${SCREEN_PATH}/splash.rle - rm -f ${DATA_PATH}/splash.png - cp -f "${LH_SYSLINUX_SPLASH}" ${DATA_PATH}/$(basename ${SPLASH}) - fi - fi - fi -} - -Configure_syslinux_templates () -{ - templates="$(find ${SYSLINUX_PATH} -type f -name '*.cfg' -o -name '*.txt')" - - for template_file in ${templates} - do - sed -i -e "s|{\$LINUX_LIVE}|${LINUX_LIVE}|" \ - -e "s|{\$LINUX_INSTALL}|${LINUX_INSTALL}|" \ - -e "s|{\$MEMTEST}|${MEMTEST}|" \ - -e "s|{\$LIVE_SCREEN_PATH}|${LIVE_SCREEN_PATH}|" \ - -e "s|{\$LIVE_DATA_PATH}|${LIVE_DATA_PATH}|" \ - -e "s|{\$LIVE_KERNEL_PATH}|${LIVE_KERNEL_PATH}|" \ - -e "s|{\$SPLASH}|${SPLASH}|" \ - -e "s|{\$LH_DISTRIBUTION}|${LH_DISTRIBUTION}|" \ - -e "s|{\$LH_DATE}|$(date +%Y%m%d)|" \ - -e "s|{\$LH_MEDIA}|${MEDIA}|" \ - -e "s|{\$LH_VERSION}|${VERSION}|" \ - -e "s|{\$LH_SYSLINUX_TIMEOUT}|${LH_SYSLINUX_TIMEOUT}0|" \ - $template_file - done - - case "${LH_BINARY_IMAGES}" in - usb-hdd) - if [ -f "${SYSLINUX_PATH}/exithelp.cfg" ] - then - sed -i -e "s|config isolinux.cfg|config syslinux.cfg|" "${SYSLINUX_PATH}"/exithelp.cfg - fi - ;; - - net) - if [ -f "${SCREEN_PATH}/exithelp.cfg" ] - then - sed -i -e "s|config isolinux.cfg|config ${LIVE_KERNEL_PATH}/pxelinux.cfg/default|" "${SCREEN_PATH}"/exithelp.cfg - fi - ;; - esac -} - -# Setting up common variables -case "${LH_INITRAMFS}" in - casper) - INITFS="casper" - ;; - - live-initramfs) - INITFS="live" - ;; -esac - -# Setting boot method specific variables -case "${LH_BINARY_IMAGES}" in - iso) - SYSLINUX_PATH="binary/isolinux" - KERNEL_PATH="binary/${INITFS}" - SCREEN_PATH="${SYSLINUX_PATH}" - DATA_PATH="${SCREEN_PATH}" - LIVE_KERNEL_PATH="/${INITFS}" - LIVE_INSTALL_KERNEL_PATH="/install" - LIVE_SCREEN_PATH="/isolinux" - LIVE_DATA_PATH="${LIVE_SCREEN_PATH}" - MEDIA="CD-ROM" - ;; - - net) - SYSLINUX_PATH="tftpboot" - KERNEL_PATH="${SYSLINUX_PATH}/debian-live/${LH_ARCHITECTURE}" - SCREEN_PATH="${SYSLINUX_PATH}/debian-live/${LH_ARCHITECTURE}/boot-screens" - DATA_PATH="${SCREEN_PATH}" - LIVE_KERNEL_PATH="debian-live/${LH_ARCHITECTURE}" - LIVE_INSTALL_KERNEL_PATH="debian-install/${LH_ARCHITECTURE}" - LIVE_SCREEN_PATH="debian-live/${LH_ARCHITECTURE}/boot-screens" - LIVE_DATA_PATH="${LIVE_SCREEN_PATH}" - MEDIA="netboot" - ;; - - tar|usb-hdd) - SYSLINUX_PATH="binary/syslinux" - KERNEL_PATH="binary/${INITFS}" - SCREEN_PATH="${SYSLINUX_PATH}" - DATA_PATH="${SCREEN_PATH}" - LIVE_KERNEL_PATH="/${INITFS}" - LIVE_INSTALL_KERNEL_PATH="/install" - LIVE_SCREEN_PATH="/syslinux" - LIVE_DATA_PATH="${LIVE_SCREEN_PATH}" - MEDIA="hd-media" - ;; -esac - -Check_multiarchitecture - -# Creating directories -mkdir -p "${KERNEL_PATH}" -mkdir -p "${SCREEN_PATH}" -mkdir -p "${DATA_PATH}" - -# Setting boot parameters -case "${LH_ENCRYPTION}" in - ""|false) - ;; - *) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} encryption=${LH_ENCRYPTION}" - ;; -esac - -if [ -n "${LH_USERNAME}" ] -then - case "${LH_INITRAMFS}" in - casper) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" - ;; - - live-initramfs) - if [ "${LH_USERNAME}" != "user" ] - then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" - fi - ;; - esac -fi - -if [ -n "${LH_HOSTNAME}" ] -then - case "${LH_INITRAMFS}" in - casper) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" - ;; - - live-initramfs) - if [ "${LH_HOSTNAME}" != "debian" ] - then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" - fi - ;; - esac -fi - -if [ "${LH_UNION_FILESYSTEM}" != "unionfs" ] -then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}" -fi - -if [ "${LH_EXPOSED_ROOT}" != "false" ] -then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} exposedroot" -fi - -if [ "${LH_BINARY_IMAGES}" = "net" ] -then - case "${LH_NET_ROOT_FILESYSTEM}" in - nfs) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} netboot=nfs nfsroot=${LH_NET_ROOT_SERVER}:${LH_NET_ROOT_PATH}" - ;; - - cifs) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} netboot=cifs nfsroot=//${LH_NET_ROOT_SERVER}${LH_NET_ROOT_PATH}" - ;; - - *) - Echo_error "Unsupported net filesystem" - exit 1 - ;; - esac - - if [ -n "${LH_NET_ROOT_MOUNTOPTIONS}" ] - then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} nfsopts=${LH_NET_ROOT_MOUNTOPTIONS}" - fi -fi - -if [ -n "${LH_NET_COW_PATH}" ] -then - case "${LH_NET_COW_FILESYSTEM}" in - nfs) - if [ -n "${LH_NET_COW_MOUNTOPTIONS}" ] - then - LH_NET_COW_MOUNTOPTIONS=",${LH_NET_COW_MOUNTOPTIONS}" - fi - - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} nfscow=${LH_NET_COW_SERVER}:${LH_NET_COW_PATH}${LH_NET_COW_MOUNTOPTIONS}" - ;; - - *) - Echo_error "Unsupported net filesystem" - exit 1 - ;; - esac -fi - -LH_BOOTAPPEND_LIVE="$(echo ${LH_BOOTAPPEND_LIVE} | sed -e 's| ||')" - -# Parameters are listed at: linux/Documentation/kernel-parameters.txt -FAILSAFE="noapic noapm nodma nomce nolapic nosmp vga=normal" - -# Moving kernels into place -if [ "binary/${INITFS}" != "${KERNEL_PATH}" ] -then - mv binary/${INITFS}/vmlinuz* ${KERNEL_PATH} - mv binary/${INITFS}/initrd* ${KERNEL_PATH} - - if [ "${LH_MEMTEST}" != "false" ] && [ "${LH_MEMTEST}" != "none" ] - then - mv binary/${INITFS}/memtest ${KERNEL_PATH} - fi -fi - -# Default entries -DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" -DEFAULT_KERNEL="$(basename chroot/boot/vmlinuz-*${DEFAULT_FLAVOUR})" -DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinuz-||')" - -Syslinux_live_entry "live" "${LH_SYSLINUX_MENU_LIVE_ENTRY}" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" - -if [ "$(echo ${LH_LINUX_FLAVOURS} | wc -w)" -gt "1" ] -then - for FLAVOUR in ${LH_LINUX_FLAVOURS} - do - if [ "${FLAVOUR}" != "${DEFAULT_FLAVOUR}" ] - then - FLAVOUR_KERNEL="$(basename chroot/boot/vmlinuz-*${FLAVOUR})" - FLAVOUR_INITRD="initrd.img-$(echo ${FLAVOUR_KERNEL} | sed -e 's|vmlinuz-||')" - Syslinux_live_entry "live-${FLAVOUR}" "${LH_SYSLINUX_MENU_LIVE_ENTRY} ${FLAVOUR}" "${FLAVOUR_KERNEL}" "${FLAVOUR_INITRD}" - fi - done -fi - -# Only needed for non-vesamenu, non-gfxboot syslinux -case "${LH_SYSLINUX_MENU}" in - false|menu) - # Adding syslinux hardcoded default label entry - Syslinux_live_entry "linux" "" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" - ;; -esac - -# Assembling debian-installer configuration -if [ "${LH_DEBIAN_INSTALLER}" != "false" ] -then - VMLINUZ_DI="vmlinuz" - INITRD_DI="initrd.gz" - APPEND_DI="vga=normal" - - VMLINUZ_GI="gtk/vmlinuz" - INITRD_GI="gtk/initrd.gz" - APPEND_GI="video=vesa:ywrap,mtrr vga=788" - - if [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${VMLINUZ_DI}" ] && [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${INITRD_DI}" ] - then - Syslinux_install_entry "Text" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" - fi - - if [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${VMLINUZ_GI}" ] && [ -f "binary/${LIVE_INSTALL_KERNEL_PATH}/${INITRD_GI}" ] - then - Syslinux_install_entry "GUI" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}" - fi -fi - -# Assembling memtest configuration -if [ -f "${KERNEL_PATH}"/memtest ] -then - Syslinux_memtest_entry "memtest" "${LH_SYSLINUX_MENU_MEMTEST_ENTRY}" "memtest" -fi - -# Copy templates to base syslinux directory -Copy_syslinux_templates - -# Fill in templates with created values -Configure_syslinux_templates - -# Configure syslinux setup per boot method -case "${LH_BINARY_IMAGES}" in - iso) - case "${LH_CHROOT_BUILD}" in - true) - cp chroot/usr/lib/syslinux/isolinux.bin ${SCREEN_PATH} - ;; - false) - cp /usr/lib/syslinux/isolinux.bin ${SCREEN_PATH} - ;; - esac - - mv ${SCREEN_PATH}/syslinux.cfg ${SCREEN_PATH}/isolinux.cfg - - # Copying configuration file - if [ -n "${LH_SYSLINUX_CFG}" ] - then - cp "${LH_SYSLINUX_CFG}" ${SCREEN_PATH}/isolinux.cfg - fi - ;; - - net) - case "${LH_CHROOT_BUILD}" in - true) - cp chroot/usr/lib/syslinux/pxelinux.0 ${KERNEL_PATH} - ;; - false) - cp /usr/lib/syslinux/pxelinux.0 ${KERNEL_PATH} - ;; - esac - - mkdir -p ${KERNEL_PATH}/pxelinux.cfg - ln -s ${LIVE_KERNEL_PATH}/pxelinux.cfg ${SYSLINUX_PATH}/pxelinux.cfg - ln -s ${LIVE_KERNEL_PATH}/pxelinux.0 ${SYSLINUX_PATH}/pxelinux.0 - - # Adjusting include pathes - for FILE in ${SCREEN_PATH}/*.cfg - do - sed -i -e "s|^include |include ${LIVE_SCREEN_PATH}/|g" "${FILE}" - done - - sed -i -e "s| f| ${LIVE_SCREEN_PATH}/f|g" ${SCREEN_PATH}/prompt.cfg - - mv ${SCREEN_PATH}/syslinux.cfg ${KERNEL_PATH}/pxelinux.cfg/default - - # Copying configuration file - if [ -n "${LH_SYSLINUX_CFG}" ] - then - cp "${LH_SYSLINUX_CFG}" ${KERNEL_PATH}/pxelinux.cfg/default - fi - ;; - - tar|usb-hdd) - case "${LH_CHROOT_BUILD}" in - true) - cp chroot/usr/lib/syslinux/isolinux.bin ${SCREEN_PATH}/syslinux.bin - ;; - false) - cp /usr/lib/syslinux/isolinux.bin ${SCREEN_PATH}/syslinux.bin - ;; - esac - - # Copying configuration file - if [ -n "${LH_SYSLINUX_CFG}" ] - then - cp "${LH_SYSLINUX_CFG}" ${SCREEN_PATH}/syslinux.cfg - fi - ;; -esac - -# Saving cache -Save_cache cache/packages_binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .stage/binary_syslinux diff --git a/helpers/lh_binary_tar b/helpers/lh_binary_tar deleted file mode 100755 index 019b42f44..000000000 --- a/helpers/lh_binary_tar +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh - -# lh_binary_tar(1) - build harddisk binary image -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build harddisk binary image')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if ! In_list tar "${LH_BINARY_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building binary harddisk image..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_tar - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Remove old binary -rm -f binary.tar.gz - -tar cf binary-tar.tar binary -gzip ${GZIP_OPTIONS} binary-tar.tar - -# Creating stage file -Create_stagefile .stage/binary_tar diff --git a/helpers/lh_binary_usb-hdd b/helpers/lh_binary_usb-hdd deleted file mode 100755 index 53d9e37c0..000000000 --- a/helpers/lh_binary_usb-hdd +++ /dev/null @@ -1,280 +0,0 @@ -#!/bin/sh - -# lh_binary_usb-hdd(1) - build binary usb-hdd image -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build binary image')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if ! In_list usb-hdd "${LH_BINARY_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building binary usb-hdd image..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap .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/share/doc/mtools mtools -Check_package chroot/sbin/parted parted - -if [ "${LH_ARCHITECTURE}" = "sparc" ] -then - case "${LH_BINARY_FILESYSTEM}" in - ext2|ext3) - Check_package chroot/sbin/mkfs.ext2 e2fsprogs - ;; - - *) - Echo_error "Sparc only supports booting from ext2, ext3 (or ufs)" - exit 1 - ;; - esac -fi - -case "${LH_BOOTLOADER}" in - grub) - Check_package chroot/usr/sbin/grub grub - ;; - - syslinux) - Check_package chroot/usr/bin/syslinux syslinux - ;; -esac - -# Restoring cache -Restore_cache cache/packages_binary - -# Installing depends -Install_package - -# Remove old binary -if [ -f binary.img ] -then - rm -f binary.img -fi - -# Enforce fat32 if we find individual files bigger than 2GB -if [ "${LH_BINARY_FILESYSTEM}" = "fat16" ] && [ -n "$(find binary -size +1999M)" ] -then - Echo_warning "FAT16 doesn't support files larger than 2GB, automatically enforcing FAT32." - - LH_BINARY_FILESYSTEM="fat32" - export LH_BINARY_FILESYSTEM -fi - -# Enforce fat32 if we have images in total bigger than 2GB -if [ "${LH_BINARY_FILESYSTEM}" = "fat16" ] && [ "$(du -s binary | awk '{ print $1 }')" -gt "1900000" ] -then - Echo_warning "FAT16 doesn't support partitions larger than 2GB, automatically enforcing FAT32" - - LH_BINARY_FILESYSTEM="fat32" - export LH_BINARY_FILESYSTEM -fi - -# Everything which comes here needs to be cleaned up, -DU_DIM="$(du -ms binary | cut -f1)" -REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LH_BINARY_FILESYSTEM})" -dd if=/dev/zero of=chroot/binary.img bs=1024k count=0 seek=${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 !!!" -Losetup $FREELO chroot/binary.img 0 - -case "${LH_ARCHITECTURE}" in - sparc) - PARTITION_TABLE_TYPE="sun" - ;; - *) - PARTITION_TABLE_TYPE="msdos" - ;; -esac - -case "${LH_BINARY_FILESYSTEM}" in - ext2|ext3) - PARTITION_TYPE="ext2" - ;; - - fat16|fat32) - PARTITION_TYPE="${LH_BINARY_FILESYSTEM}" - ;; - - *) - Echo_error "Unsupported binary filesystem %s" "${LH_BINARY_FILESYSTEM}" - exit 1 - ;; -esac - -case "${LH_CHROOT_BUILD}" in - true) - Chroot chroot "parted -s ${FREELO} mklabel ${PARTITION_TABLE_TYPE}" || true - Chroot chroot "parted -s ${FREELO} mkpart primary ${PARTITION_TYPE} 0.0 100%" || true - Chroot chroot "parted -s ${FREELO} set 1 boot on" || true - Chroot chroot "parted -s ${FREELO} set 1 lba off" || true - - if [ "${LH_BOOTLOADER}" = "syslinux" ] - then - dd if=chroot/usr/lib/syslinux/mbr.bin of=${FREELO} bs=440 count=1 - fi - ;; - - false) - parted -s ${FREELO} mklabel ${PARTITION_TABLE_TYPE} || true - parted -s ${FREELO} mkpart primary ${PARTITION_TYPE} 0.0 100% || true - parted -s ${FREELO} set 1 boot on || true - parted -s ${FREELO} set 1 lba off || true - - if [ "${LH_BOOTLOADER}" = "syslinux" ] - then - dd if=/usr/lib/syslinux/mbr.bin of=${FREELO} bs=440 count=1 - fi - ;; -esac - -sleep 1 -${LH_LOSETUP} -d ${FREELO} - -FREELO="$(${LH_LOSETUP} -f)" -Losetup $FREELO chroot/binary.img 1 - -case "${LH_BINARY_FILESYSTEM}" in - ext2|ext3) - MKFS="${LH_BINARY_FILESYSTEM}" - MKFS_OPTIONS="-L DEBIAN_LIVE -m 0" - ;; - - fat16) - MKFS="vfat" - MKFS_OPTIONS="-F 16 -n DEBIAN_LIVE" - ;; - - fat32) - MKFS="vfat" - MKFS_OPTIONS="-F 32 -n DEBIAN_LIVE" - ;; -esac - -case "${LH_CHROOT_BUILD}" in - true) - Chroot chroot "mkfs.${MKFS} ${MKFS_OPTIONS} ${FREELO}" - ;; - - false) - mkfs.${MKFS} ${MKFS_OPTIONS} ${FREELO} - ;; -esac - -case "${LH_BINARY_FILESYSTEM}" in - fat*) - CP_OPTIONS="-L" - ;; -esac - -mkdir -p chroot/binary.tmp -${LH_ROOT_COMMAND} mount ${FREELO} chroot/binary.tmp -cp -r -T ${CP_OPTIONS} binary/ chroot/binary.tmp - -FIXME() -{ -if [ "${LH_BOOTLOADER}" = "grub" ] -then - -cat > chroot/grub.sh << EOF -cd binary.tmp -grub --batch << EOM -find /live/vmlinuz -EOM -EOF - - rootpartition="$(Chroot chroot 'sh grub.sh' 2>/dev/null | grep -A 1 'find /live/vmlinuz' | grep -v 'find /live/vmlinuz')" - usbdev="$(echo $rootpartition | sed -e 's|,[[:digit:]]||')" - echo "Root partition is $rootpartition, device is: $usbdev" - - echo "WAITING..." && read WAIT - -#cat > chroot/grub.sh << EOF -#grub --batch << EOM -#root $rootpartition -#setup $usbdev -#EOM -#EOF - -#Chroot chroot "sh grub.sh" - - rm -f chroot/grub.sh -fi -} - -${LH_ROOT_COMMAND} umount chroot/binary.tmp -rmdir chroot/binary.tmp - -if [ "${LH_BOOTLOADER}" = "syslinux" ] -then - case "${LH_CHROOT_BUILD}" in - true) - Chroot chroot "syslinux ${FREELO}" - ;; - - false) - syslinux ${FREELO} - ;; - esac -fi - -sleep 1 -${LH_LOSETUP} -d ${FREELO} - -echo "!!! The above error/warning messages can be ignored !!!" - -if [ -n "${MAKEDEV}" ] -then - rm -rf chroot/dev - mv chroot/dev.tmp chroot/dev -fi - -mv chroot/binary.img ./ - -# Saving cache -Save_cache cache/packages_binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .stage/binary_usb-hdd diff --git a/helpers/lh_binary_virtual-hdd b/helpers/lh_binary_virtual-hdd deleted file mode 100755 index 6a65d1922..000000000 --- a/helpers/lh_binary_virtual-hdd +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/sh - -# lh_binary_virtual-hdd(1) - build binary virtual-hdd image -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build binary image')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if ! In_list virtual-hdd "${LH_BINARY_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building binary virtual-hdd image..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap .stage/chroot_proc - -# Checking stage file -Check_stagefile .stage/binary_virtual-hdd - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ "${LH_CHROOT_BUILD}" = "true" ] -then - case "${LH_BINARY_FILESYSTEM}" in - ext2|ext3) - Check_package chroot/sbin/mkfs.ext2 e2fsprogs - ;; - esac -fi - -# Restoring cache -Restore_cache cache/packages_binary - -# Installing depends -Install_package - -# Remove old binary -if [ -f binary-virtual.img ] -then - rm -f binary-virtual.img -fi - -Echo_message "Creating virtual disk image..." -dd if=/dev/zero of=binary-virtual.img bs=1024k count=0 seek=${LH_VIRTUAL_ROOT_SIZE} - -if [ "${LH_CHROOT_BUILD}" = "true" ] -then - mv binary-virtual.img chroot - - case "${LH_BINARY_FILESYSTEM}" in - ext2) - Chroot chroot "mkfs.ext2 -F binary-virtual.img" - ;; - - ext3) - Chroot chroot "mkfs.ext3 -F binary-virtual.img" - ;; - esac - - mv chroot/binary-virtual.img ./ -else - case "${LH_BINARY_FILESYSTEM}" in - ext2) - mkfs.ext2 -F binary-virtual.img - ;; - - ext3) - mkfs.ext3 -F binary-virtual.img - ;; - esac -fi - -mkdir -p binary.tmp -${LH_ROOT_COMMAND} mount -o loop binary-virtual.img binary.tmp -cp -a binary/ binary.tmp - -${LH_ROOT_COMMAND} umount binary.tmp -rmdir binary.tmp - -# Saving cache -Save_cache cache/packages_binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .stage/binary_virtual-hdd diff --git a/helpers/lh_binary_win32-loader b/helpers/lh_binary_win32-loader deleted file mode 100755 index 685121828..000000000 --- a/helpers/lh_binary_win32-loader +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/sh - -# lh_binary_win32-loader(1) - copy win32-loader into binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'copy win32-loader into binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_WIN32_LOADER}" != "true" ] || [ "${LH_BINARY_IMAGES}" = "virtual-hdd" ] -then - exit 0 -fi - -Echo_message "Begin copying win32-loader..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_win32-loader - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -case "${LH_ARCHITECTURE}" in - amd64|i386) - if [ "${LH_CHROOT_BUILD}" = "true" ] - then - # Checking depends - Check_package chroot/usr/lib/win32-loader/win32-loader.exe win32-loader - - # Restoring cache - Restore_cache cache/packages_binary - - # Installing depends - Install_package - - # Copying win32-loader - cp chroot/usr/lib/win32-loader/* binary - else - cp /usr/lib/win32-loader/* binary - fi - - mv binary/win32-loader.exe binary/setup.exe - - if [ "${LH_DEBIAN_INSTALLER}" != "false" ] - then - -cat > binary/win32-loader.ini << EOF -[installer] -arch=${LH_ARCHITECTURE} -i386/linux=install/vmlinuz -i386/initrd=install/initrd.gz -i386/gtk/linux=install/vmlinuz -i386/gtk/initrd=install/gtk/initrd.gz - -[grub] -g2ldr=g2ldr -g2ldr.mbr=g2ldr.mbr -EOF - - fi - - # Saving cache - Save_cache cache/packages_binary - - # Removing depends - Remove_package - ;; - - *) - Echo_warning "win32-loader inclusion is set to true but not compatible with your architecture, ignoring." - ;; -esac - -# Creating stage file -Create_stagefile .stage/binary_win32-loader diff --git a/helpers/lh_binary_yaboot b/helpers/lh_binary_yaboot deleted file mode 100755 index fdd857d99..000000000 --- a/helpers/lh_binary_yaboot +++ /dev/null @@ -1,313 +0,0 @@ -#!/bin/sh - -# lh_binary_yaboot(1) - installs yaboot into binary -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'installs yaboot into binary')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_BOOTLOADER}" != "yaboot" ] -then - exit 0 -fi - -Echo_message "Begin installing yaboot..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/binary_yaboot - -# Checking yaboot templates -Check_templates yaboot - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Check architecture -Check_architecture powerpc ppc64 -Check_crossarchitecture - -# Checking depends -Check_package chroot/usr/lib/yaboot/yaboot yaboot - -# Restoring cache -Restore_cache cache/packages_binary - -# Installing depends -Install_package - -# Local functions -Yaboot_live_entry () -{ - LABEL="${1}" - KERNEL="${2}" - INITRD="${3}" - APPEND="${4}" - - DIRECTORY="/$(basename ${DESTDIR_LIVE})" - - LINUX_LIVE="${LINUX_LIVE}\nimage=${DIRECTORY}/${KERNEL}\n" - LINUX_LIVE="${LINUX_LIVE}\tlabel=${LABEL}\n" - LINUX_LIVE="${LINUX_LIVE}\tinitrd=${DIRECTORY}/${INITRD}\n" - LINUX_LIVE="${LINUX_LIVE}\tappend=\"boot=${INITFS} LH_BOOTAPPEND_LIVE ${APPEND}\"\n" - LINUX_LIVE="${LINUX_LIVE}\tinitrd-size=10240\n" -} - -Yaboot_install_entry () -{ - LABEL="${1}" - KERNEL="${2}" - INITRD="${3}" - APPEND="${4}" - - DIRECTORY="/$(basename ${DESTDIR_INSTALL})" - - QAPPEND="quiet" - - for TYPE in Install Expert Rescue Auto - do - case "${TYPE}" in - Install) - TAPPEND="${APPEND} ${QAPPEND}" - ;; - - Expert) - TAPPEND="priority=low ${APPEND}" - ;; - - Rescue) - TAPPEND="rescue/enable=true ${APPEND} ${QAPPEND}" - ;; - - Auto) - TAPPEND="auto=true priority=critical ${APPEND} ${QAPPEND}" - ;; - esac - - case "${LABEL}" in - Text) - TYPE_SUFFIX="" - ;; - GUI) - TYPE_SUFFIX="gui" - ;; - esac - - LINUX_INSTALL="${LINUX_INSTALL}\nimage=${DIRECTORY}/${KERNEL}\n" - LINUX_INSTALL="${LINUX_INSTALL}\tlabel=${TYPE}${TYPE_SUFFIX}\n" - LINUX_INSTALL="${LINUX_INSTALL}\tinitrd=${DIRECTORY}/${INITRD}\n" - LINUX_INSTALL="${LINUX_INSTALL}\tappend=\"${TAPPEND} ${LH_BOOTAPPEND_INSTALL}\"\n" - LINUX_INSTALL="${LINUX_INSTALL}\tinitrd-size=10240\n" - done -} - -case "${LH_INITRAMFS}" in - casper) - INITFS="casper" - ;; - - live-initramfs) - INITFS="live" - ;; -esac - -# Setting destination directory -case "${LH_BINARY_IMAGES}" in - iso) - case "${LH_INITRAMFS}" in - casper) - DESTDIR_LIVE="binary/casper" - ;; - - live-initramfs) - DESTDIR_LIVE="binary/live" - ;; - esac - - DESTDIR_INSTALL="binary/install" - ;; - - net|tar|usb-hdd) - Echo_error "not yet supported, aborting (FIXME)." - exit 1 - ;; -esac - -Check_multiarchitecture - -# Creating directory -mkdir -p "${DESTDIR_LIVE}" - -# Setting boot parameters -case "${LH_ENCRYPTION}" in - ""|false) - ;; - *) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} encryption=${LH_ENCRYPTION}" - ;; -esac - -if [ -n "${LH_USERNAME}" ] -then - case "${LH_INITRAMFS}" in - casper) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" - ;; - - live-initramfs) - if [ "${LH_USERNAME}" != "user" ] - then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} username=${LH_USERNAME}" - fi - ;; - esac -fi - -if [ -n "${LH_HOSTNAME}" ] -then - case "${LH_INITRAMFS}" in - casper) - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" - ;; - - live-initramfs) - if [ "${LH_HOSTNAME}" != "debian" ] - then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} hostname=${LH_HOSTNAME}" - fi - ;; - esac -fi - -if [ "${LH_UNION_FILESYSTEM}" != "unionfs" ] -then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} union=${LH_UNION_FILESYSTEM}" -fi - -if [ -n "${LH_NET_COW_PATH}" ] -then - Echo_error "Net cow not yet supported on yaboot" - exit 1 -fi - -if [ "${LH_EXPOSED_ROOT}" != "false" ] -then - LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE} exposedroot" -fi - -LH_BOOTAPPEND_LIVE="$(echo ${LH_BOOTAPPEND_LIVE} | sed -e 's| ||')" - -# Parameters are listed at: linux/Documentation/kernel-parameters.txt -FAILSAFE="noapic noapm nodma nomce nolapic nosmp vga=ofonly" - -# Assembling kernel configuration - -# Default entries -DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" -DEFAULT_KERNEL="$(basename chroot/boot/vmlinux-*${DEFAULT_FLAVOUR})" -DEFAULT_INITRD="initrd.img-$(echo ${DEFAULT_KERNEL} | sed -e 's|vmlinux-||')" - -Yaboot_live_entry "live" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" -Yaboot_live_entry "live-failsafe" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" "${FAILSAFE}" - -if [ "$(echo ${LH_LINUX_FLAVOURS} | wc -w)" -gt "1" ] -then - for KERNEL in chroot/boot/vmlinux-* - do - KERNEL_IMAGE="$(basename ${KERNEL})" - KERNEL_VERSION="$(echo ${KERNEL_IMAGE} | sed -e 's|vmlinux-||')" - INITRD="initrd.img-${KERNEL_VERSION}" - - Yaboot_live_entry "live-${KERNEL_VERSION}" "${KERNEL_IMAGE}" "${INITRD}" - Yaboot_live_entry "live-${KERNEL_VERSION}-failsafe" "${KERNEL_IMAGE}" "${INITRD}" "${FAILSAFE}" - done -fi - -LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" - -# Assembling debian-installer configuration -if [ "${LH_DEBIAN_INSTALLER}" != "false" ] -then - VMLINUZ_DI="vmlinuz" - INITRD_DI="initrd.gz" - APPEND_DI="vga=normal" - - VMLINUZ_GI="gtk/vmlinuz" - INITRD_GI="gtk/initrd.gz" - APPEND_GI="video=vesa:ywrap,mtrr vga=788" - - if [ -f "binary/${DESTDIR_INSTALL}/${VMLINUZ_DI}" ] && [ -f "binary/${DESTDIR_INSTALL}/${INITRD_DI}" ] - then - Yaboot_install_entry "Text" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" - fi - - if [ -f "binary/${DESTDIR_INSTALL}/${VMLINUZ_GI}" ] && [ -f "binary/${DESTDIR_INSTALL}/${INITRD_GI}" ] - then - Yaboot_install_entry "GUI" "${VMLINUZ_GI}" "${INITRD_GI}" "${APPEND_GI}" - fi -fi - -LINUX_INSTALL="$(/bin/echo ${LINUX_INSTALL} | sed -e 's|binary||g' -e 's|//|/|g')" - -case "${LH_BINARY_IMAGES}" in - iso|usb-hdd) - # Copying yaboot - mkdir -p binary/yaboot - - case "${LH_CHROOT_BUILD}" in - true) - cp chroot/usr/lib/yaboot/yaboot binary/yaboot - ;; - - false) - cp /usr/lib/yaboot/yaboot binary/yaboot - ;; - esac - - cp -r "${TEMPLATES}"/* binary/yaboot - - if [ "${LH_BINARY_IMAGES}" = "usb-hdd" ] - then - mv binary/yaboot/yaboot.conf binary/yaboot/yaboot.conf.tmp - echo "root=/dev/ram" > binary/yaboot/yaboot.conf - cat binary/yaboot/yaboot.conf.tmp >> binary/yaboot/yaboot.conf - rm -f binary/yaboot/yaboot.conf.tmp - fi - - # Configure yaboot templates - sed -i -e "s|LINUX_LIVE|${LINUX_LIVE}|" -e "s|LINUX_INSTALL|${LINUX_INSTALL}|" binary/yaboot/yaboot.conf - sed -i -e "s|LH_BOOTAPPEND_INSTALL|${LH_BOOTAPPEND_INSTALL}|" -e "s|LH_BOOTAPPEND_LIVE|${LH_BOOTAPPEND_LIVE}|" binary/yaboot/yaboot.conf - sed -i -e "s|LH_DATE|$(date +%Y%m%d)|" -e "s|LH_VERSION|${VERSION}|" binary/yaboot/boot.msg - ;; -esac - -# Saving cache -Save_cache cache/packages_binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .stage/binary_yaboot diff --git a/helpers/lh_bootstrap b/helpers/lh_bootstrap deleted file mode 100755 index 823c4654a..000000000 --- a/helpers/lh_bootstrap +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -# lh_bootstrap(1) - bootstrap a Debian system -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'bootstrap a Debian system')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Setup cleanup function -Setup_cleanup - -# Bootstrapping system -lh bootstrap_cache restore ${*} -lh bootstrap_copy ${*} -lh bootstrap_cdebootstrap ${*} -lh bootstrap_debootstrap ${*} -lh bootstrap_cache save ${*} diff --git a/helpers/lh_bootstrap_cache b/helpers/lh_bootstrap_cache deleted file mode 100755 index a0254283f..000000000 --- a/helpers/lh_bootstrap_cache +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh - -# lh_bootstrap_cache(1) - cach bootstrap stage -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'cache bootstrap stage')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Check architecture -Check_crossarchitecture - -Echo_message "Begin caching bootstrap stage..." - -for STAGE in ${LH_CACHE_STAGES} -do - if [ "${STAGE}" = "bootstrap" ] - then - case "${1}" in - restore) - # Checking stage file - Check_stagefile .stage/bootstrap_cache.restore - - if [ -d cache/stages_bootstrap ] - then - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Removing old chroot - rm -rf chroot - - # Restoring old cache - ${LH_ROOT_COMMAND} cp -a cache/stages_bootstrap chroot - - if [ -n "${LH_ROOT_COMMAND}" ] - then - ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot - fi - - # Creating stage file - Create_stagefile .stage/bootstrap_cache.restore - Create_stagefile .stage/bootstrap - - exit 0 - fi - ;; - - save) - # Checking stage file - Check_stagefile .stage/bootstrap_cache.save - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - rm -rf cache/stages_bootstrap - - mkdir -p cache - - ${LH_ROOT_COMMAND} cp -a chroot cache/stages_bootstrap - - if [ -n "${LH_ROOT_COMMAND}" ] - then - ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/stages_bootstrap - fi - - # Creating stage file - Create_stagefile .stage/bootstrap_cache.save - ;; - esac - fi -done diff --git a/helpers/lh_bootstrap_cdebootstrap b/helpers/lh_bootstrap_cdebootstrap deleted file mode 100755 index 1f9340b3a..000000000 --- a/helpers/lh_bootstrap_cdebootstrap +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/sh - -# lh_bootstrap_cdebootstrap(1) - bootstrap a Debian system with cdebootstrap(1) -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'bootstrap a Debian system with cdebootstrap(1)')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_BOOTSTRAP}" != "cdebootstrap" ] && [ "${LH_BOOTSTRAP}" != "cdebootstrap-static" ] -then - exit 0 -fi - -# Check architecture -Check_crossarchitecture - -Echo_message "Begin bootstrapping system..." - -Check_package /usr/bin/${LH_BOOTSTRAP} cdebootstrap - -# Ensure that a system is built as root -lh testroot - -# Checking stage file -Check_stagefile .stage/bootstrap -Check_stagefile .stage/bootstrap_cache.restore - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Creating chroot directory -mkdir -p chroot - -# Setting cdebootstrap options -if [ -n "${LH_ARCHITECTURE}" ] -then - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --arch=${LH_ARCHITECTURE}" -fi - -if [ -n "${LH_BOOTSTRAP_CONFIG}" ] -then - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --suite-config=${LH_BOOTSTRAP_CONFIG}" -fi - -if [ -n "${LH_BOOTSTRAP_INCLUDE}" ] -then - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --include=$(echo ${LH_BOOTSTRAP_INCLUDE} | sed 's| *|,|g')" -fi - -if [ -n "${LH_BOOTSTRAP_EXCLUDE}" ] -then - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LH_BOOTSTRAP_EXCLUDE} | sed 's| *|,|g')" -fi - -if [ -n "${LH_BOOTSTRAP_KEYRING}" ] -then - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --keyring=${LH_BOOTSTRAP_KEYRING}" -fi - -if [ -z "${LH_BOOTSTRAP_FLAVOUR}" ] -then - case "${LH_PACKAGES_LISTS}" in - stripped|minimal) - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=minimal" - ;; - *) - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=standard" - ;; - esac -else - case "${LH_BOOTSTRAP_FLAVOUR}" in - stripped|minimal) - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=minimal" - ;; - - *) - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=${LH_BOOTSTRAP_FLAVOUR}" - ;; - esac -fi - -if [ "${_DEBUG}" = "true" ] -then - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --debug" -fi - -if [ "${_QUIET}" = "true" ] -then - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --quiet" -fi - -if [ "${_VERBOSE}" = "true" ] -then - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --verbose" -fi - -if [ "${LH_APT_SECURE}" = "false" ] -then - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --allow-unauthenticated" -fi - -if [ -x "/usr/bin/cdebootstrap" ] || [ -x "/usr/bin/cdebootstrap-static" ] -then - if [ "${LH_CACHE_PACKAGES}" = "true" ] - then - if [ -d cache/packages_bootstrap ] - then - mkdir -p chroot/var/cache/bootstrap - cp cache/packages_bootstrap/*.deb chroot/var/cache/bootstrap - fi - - Echo_breakage "Running ${LH_BOOTSTRAP} (download-only)... " - ${LH_ROOT_COMMAND} ${LH_BOOTSTRAP} ${CDEBOOTSTRAP_OPTIONS} --download-only "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" - - if [ -n "${LH_ROOT_COMMAND}" ] - then - ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot - fi - - # Removing old cache - if [ -d cache/packages_bootstrap ] - then - rm -f cache/packages_bootstrap/*.deb - fi - - # Saving new cache - mkdir -p cache/packages_bootstrap - - cp chroot/var/cache/bootstrap/*.deb cache/packages_bootstrap - fi - - Echo_breakage "Running ${LH_BOOTSTRAP}... " - ${LH_ROOT_COMMAND} ${LH_BOOTSTRAP} ${CDEBOOTSTRAP_OPTIONS} "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" - - if [ -n "${LH_ROOT_COMMAND}" ] - then - ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot - fi - - # Remove cdebootstrap-helper-diverts (needed at least for minimal flavours) - case "${LH_PACKAGES_LISTS}" in - stripped|minimal) - Chroot chroot "dpkg -P cdebootstrap-helper-diverts" - ;; - esac - - # Deconfiguring cdebootstrap configurations - rm -f chroot/etc/apt/sources.list - rm -f chroot/etc/hosts - rm -f chroot/etc/resolv.conf - - # Removing bootstrap cache - rm -rf chroot/var/cache/bootstrap - - # Creating stage file - Create_stagefile .stage/bootstrap -else - Echo_error "Can't process file /usr/bin/${LH_BOOTSTRAP} (FIXME)" - exit 1 -fi diff --git a/helpers/lh_bootstrap_copy b/helpers/lh_bootstrap_copy deleted file mode 100755 index 456c89dce..000000000 --- a/helpers/lh_bootstrap_copy +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/sh - -# lh_bootstrap_copy(1) - bootstrap by copying the host system -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'bootstrap by copying the host system')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_BOOTSTRAP}" != "copy" ] -then - exit 0 -fi - -# Check architecture -Check_crossarchitecture - -Echo_message "Begin bootstrapping system..." - -# Ensure that a system is built as root -lh testroot - -# Checking stage file -Check_stagefile .stage/bootstrap - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Copying host system -mkdir chroot -cd chroot -tar c / --exclude /proc --exclude /sys --exclude "$(dirname ${PWD})" | tar xv -cd .. - -# Creating stage file -Create_stagefile .stage/bootstrap diff --git a/helpers/lh_bootstrap_debootstrap b/helpers/lh_bootstrap_debootstrap deleted file mode 100755 index b1a53493e..000000000 --- a/helpers/lh_bootstrap_debootstrap +++ /dev/null @@ -1,161 +0,0 @@ -#!/bin/sh - -# lh_bootstrap_debootstrap(1) - bootstrap a Debian system with debootstrap(8) -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'bootstrap a Debian system with debootstrap(8)')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_BOOTSTRAP}" != "debootstrap" ] -then - exit 0 -fi - -# Check architecture -Check_crossarchitecture - -Echo_message "Begin bootstrapping system..." - -Check_package /usr/sbin/debootstrap debootstrap - -# Ensure that a system is built as root -lh testroot - -# Checking stage file -Check_stagefile .stage/bootstrap -Check_stagefile .stage/bootstrap_cache.restore - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Creating chroot directory -mkdir -p chroot - -# Setting debootstrap options -if [ -n "${LH_ARCHITECTURE}" ] -then - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --arch ${LH_ARCHITECTURE}" -fi - -if [ "${LH_ARCHIVE_AREAS}" != "main" ] -then - # Modify archive areas to remove leading/trailing whitespaces and replace other whitepspace with commas - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --components $(echo ${LH_ARCHIVE_AREAS} | sed -e 's| |,|g')" -fi - -if [ -n "${LH_BOOTSTRAP_CONFIG}" ] -then - if [ -d "/usr/share/debootstrap/scripts/" ] - then - LH_DEBOOTSTRAP_SCRIPT="/usr/share/debootstrap/scripts/${LH_BOOTSTRAP_CONFIG}" - else - LH_DEBOOTSTRAP_SCRIPT="/usr/lib/debootstrap/scripts/${LH_BOOTSTRAP_CONFIG}" - fi -fi - -if [ -n "${LH_BOOTSTRAP_INCLUDE}" ] -then - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --include=$(echo ${LH_BOOTSTRAP_INCLUDE} | sed 's| *|,|g')" -fi - -if [ -n "${LH_BOOTSTRAP_EXCLUDE}" ] -then - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LH_BOOTSTRAP_EXCLUDE} | sed 's| *|,|g')" -fi - -if [ "${LH_USE_FAKEROOT}" != "true" ] -then - if [ -z "${LH_BOOTSTRAP_FLAVOUR}" ] - then - if In_list "stripped minimal" "${LH_PACKAGES_LISTS}" - then - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=minbase" - fi - else - case "${LH_BOOTSTRAP_FLAVOUR}" in - stripped|minimal) - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=minbase" - ;; - standard) - ;; - - *) - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=${LH_BOOTSTRAP_FLAVOUR}" - esac - fi -else - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=fakechroot" -fi - -if [ "${_VERBOSE}" = "true" ] -then - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --verbose" -fi - -if [ -x "/usr/sbin/debootstrap" ] -then - if [ "${LH_CACHE_PACKAGES}" = "true" ] - then - if [ -d cache/packages_bootstrap ] - then - mkdir -p chroot/var/cache/apt/archives - cp cache/packages_bootstrap/*.deb chroot/var/cache/apt/archives - fi - - Echo_breakage "Running debootstrap (download-only)... " - ${LH_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" "${LH_DEBOOTSTRAP_SCRIPT}" - - if [ -n "${LH_ROOT_COMMAND}" ] - then - ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot - fi - - # Removing old cache - if [ -d cache/packages_bootstrap ] - then - rm -f cache/packages_bootstrap/*.deb - fi - - # Saving new cache - mkdir -p cache/packages_bootstrap - - cp chroot/var/cache/apt/archives/*.deb cache/packages_bootstrap - fi - - Echo_breakage "Running debootstrap... " - ${LH_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} "${LH_DISTRIBUTION}" chroot "${LH_MIRROR_BOOTSTRAP}" "${LH_DEBOOTSTRAP_SCRIPT}" - - if [ -n "${LH_ROOT_COMMAND}" ] - then - ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot - fi - - # Removing bootstrap cache - rm -f chroot/var/cache/apt/archives/*.deb - - # Creating stage file - Create_stagefile .stage/bootstrap -else - Echo_error "Can't process file /usr/bin/debootstrap (FIXME)" - exit 1 -fi diff --git a/helpers/lh_build b/helpers/lh_build deleted file mode 100755 index 835ad8e2c..000000000 --- a/helpers/lh_build +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh - -# lh_build(1) - build a Debian Live system -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Read meta config -if [ "${1}" != "noautoconfig" ] && [ -x auto/build ] -then - ./auto/build ${@} -fi - -if [ "${1}" = "noautoconfig" ] -then - shift -fi - -# Setting static variables -DESCRIPTION="$(Echo 'build a Debian Live system')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -if [ ! -d config ] -then - Echo_warning "No config/ directory; using defaults for all options" -fi - -if [ "$(pwd)" = "/" ] -then - Echo_error "Cannot build live image from the root directory (/)" - exit 1 -fi - -if echo $(pwd) | grep -qs " " -then - Echo_error "Cannot build live image from a directory containing spaces" - exit 1 -fi - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Checking defaults -Check_defaults - -# Bootstrapping system -lh bootstrap ${*} - -# Customizing chroot -lh chroot ${*} - -# Building binary images -lh binary ${*} - -# Building source images -lh source ${*} diff --git a/helpers/lh_chroot b/helpers/lh_chroot deleted file mode 100755 index 65c5e659f..000000000 --- a/helpers/lh_chroot +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh - -# lh_chroot(1) - customize the Debian system -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'customize the Debian system')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Setup cleanup function -Setup_cleanup - -# Configuring chroot -lh chroot_cache restore ${*} -lh chroot_devpts install ${*} -lh chroot_proc install ${*} -lh chroot_selinuxfs install ${*} -lh chroot_sysfs install ${*} -lh chroot_debianchroot install ${*} -lh chroot_dpkg install ${*} -lh chroot_sysv-rc install ${*} -lh chroot_hosts install ${*} -lh chroot_resolv install ${*} -lh chroot_hostname install ${*} -lh chroot_apt install ${*} -lh chroot_sources install ${*} -lh chroot_linux-image install ${*} - -# Customizing chroot -lh chroot_preseed ${*} -lh chroot_local-preseed ${*} -lh chroot_tasks ${*} -lh chroot_packageslists ${*} -lh chroot_local-packageslists ${*} -lh chroot_packages ${*} -lh chroot_local-packages ${*} -lh chroot_install-packages ${*} -lh chroot_localization ${*} -lh chroot_local-includes ${*} -lh chroot_local-patches ${*} -lh chroot_sysvinit ${*} -lh chroot_local-hooks ${*} -lh chroot_hooks ${*} -lh chroot_symlinks ${*} -lh chroot_hacks ${*} -lh chroot_interactive ${*} - -# Deconfiguring chroot -lh chroot_linux-image remove ${*} -lh chroot_sources remove ${*} -lh chroot_apt remove ${*} -lh chroot_hostname remove ${*} -lh chroot_resolv remove ${*} -lh chroot_hosts remove ${*} -lh chroot_sysv-rc remove ${*} -lh chroot_dpkg remove ${*} -lh chroot_debianchroot remove ${*} -lh chroot_sysfs remove ${*} -lh chroot_selinuxfs remove ${*} -lh chroot_proc remove ${*} -lh chroot_devpts remove ${*} -lh chroot_cache save ${*} diff --git a/helpers/lh_chroot_apt b/helpers/lh_chroot_apt deleted file mode 100755 index 6836c2d75..000000000 --- a/helpers/lh_chroot_apt +++ /dev/null @@ -1,242 +0,0 @@ -#!/bin/sh - -# lh_chroot_apt(1) - manage /etc/apt/apt.conf -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'manage /etc/apt/apt.conf')" -HELP="" -USAGE="${PROGRAM} {install|install-binary|remove} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -case "${1}" in - install|install-binary) - Echo_message "Configuring file /etc/apt/apt.conf" - - # Checking stage file - Check_stagefile .stage/chroot_apt - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - mkdir -p chroot/etc/apt/apt.conf.d - - # Configuring apt ftp proxy - if [ -n "${LH_APT_FTP_PROXY}" ] - then - echo "Acquire::ftp::Proxy \"${LH_APT_FTP_PROXY}\";" > chroot/etc/apt/apt.conf.d/00ftp-proxy - fi - - # Configuring apt http proxy - if [ -n "${LH_APT_HTTP_PROXY}" ] - then - echo "Acquire::http::Proxy \"${LH_APT_HTTP_PROXY}\";" > chroot/etc/apt/apt.conf.d/00http-proxy - fi - - # Configuring apt pdiffs - case "${LH_APT_PDIFFS}" in - true) - echo "Acquire::PDiffs \"true\";" > chroot/etc/apt/apt.conf.d/00pdiffs - ;; - - false) - echo "Acquire::PDiffs \"false\";" > chroot/etc/apt/apt.conf.d/00pdiffs - ;; - 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 - case "${LH_APT_RECOMMENDS}" in - true) - echo "APT::Install-Recommends \"true\";" > chroot/etc/apt/apt.conf.d/00recommends - echo "Aptitude::Recommends-Important \"true\";" >> chroot/etc/apt/apt.conf.d/00recommends - ;; - - false) - echo "APT::Install-Recommends \"false\";" > chroot/etc/apt/apt.conf.d/00recommends - echo "Aptitude::Recommends-Important \"false\";" >> chroot/etc/apt/apt.conf.d/00recommends - ;; - esac - - # Configuring apt secure - case "${LH_APT_SECURE}" in - true) - echo "APT::Get::AllowUnauthenticated \"false\";" > chroot/etc/apt/apt.conf.d/00secure - echo "Aptitude::CmdLine::Ignore-Trust-Violations \"false\";" >> chroot/etc/apt/apt.conf.d/00secure - ;; - - false) - echo "APT::Get::AllowUnauthenticated \"true\";" > chroot/etc/apt/apt.conf.d/00secure - echo "Aptitude::CmdLine::Ignore-Trust-Violations \"true\";" >> chroot/etc/apt/apt.conf.d/00secure - ;; - esac - - # Configuring apt config - if [ -f config/chroot_apt/apt.conf ] - then - if [ -f chroot/etc/apt/apt.conf ] - then - mv chroot/etc/apt/apt.conf chroot/etc/apt/apt.conf.orig - fi - - cp config/chroot_apt/apt.conf chroot/etc/apt/apt.conf - fi - - # Configuring apt preferences - if [ -f config/chroot_apt/preferences ] - then - if [ -f chroot/etc/apt/preferences ] - then - mv chroot/etc/apt/preferences chroot/etc/apt/preferences.orig - fi - - cp config/chroot_apt/preferences chroot/etc/apt/preferences - fi - - if Find_files config/chroot_local-packages/*.deb - then - echo >> chroot/etc/apt/preferences - echo "# Added by lh_chroot_apt ${@}" >> chroot/etc/apt/preferences - echo "Package: *" >> chroot/etc/apt/preferences - echo "Pin: release o=chroot_local-packages" >> chroot/etc/apt/preferences - - case "${1}" in - install) - # Ensure local packages have priority - echo "Pin-Priority: 1001" >> chroot/etc/apt/preferences - ;; - - install-binary) - # Ensure local packages are not re-installed during lh_binary - echo "Pin-Priority: 99" >> chroot/etc/apt/preferences - - echo >> chroot/etc/apt/preferences - echo "Package: *" >> chroot/etc/apt/preferences - echo "Pin: release o=debian" >> chroot/etc/apt/preferences - echo "Pin-Priority: 99" >> chroot/etc/apt/preferences - ;; - esac - fi - - # Creating stage file - Create_stagefile .stage/chroot_apt - ;; - - remove) - Echo_message "Deconfiguring file /etc/apt/apt.conf" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Deconfiguring aptitude ftp proxy - rm -f chroot/etc/apt/apt.conf.d/00ftp-proxy - - # Deconfiguring aptitude http proxy - rm -f chroot/etc/apt/apt.conf.d/00http-proxy - - # Deconfiguring aptitude pdiffs - if [ "${LH_APT_PDIFFS}" = "true" ] - then - rm -f chroot/etc/apt/apt.conf.d/00pdiffs - fi - - # Deconfiguring aptitude pipeline - rm -f chroot/etc/apt/apt.conf.d/00pipeline - - # Deconfiguring aptitude recommends - if [ "${LH_APT_RECOMMENDS}" = "true" ] - then - rm -f chroot/etc/apt/apt.conf.d/00recommends - fi - - # Deconfiguring aptitude secure - if [ "${LH_APT_SECURE}" = "true" ] - then - rm -f chroot/etc/apt/apt.conf.d/00secure - fi - - # Configuring apt config - if [ -f config/chroot_apt/apt.conf ] - then - if [ -f chroot/etc/apt/apt.conf ] - then - mv chroot/etc/apt/apt.conf chroot/etc/apt/apt.conf.orig - fi - - cp config/chroot_apt/apt.conf chroot/etc/apt/apt.conf - - if [ -f chroot/etc/apt/apt.conf.orig ] - then - mv chroot/etc/apt/apt.conf.orig chroot/etc/apt/apt.conf - fi - fi - - # Deconfiguring apt preferences - if [ -f config/chroot_apt/preferences ] - then - if [ -f chroot/etc/apt/preferences ] - then - mv chroot/etc/apt/preferences chroot/etc/apt/preferences.orig - fi - - cp config/chroot_apt/preferences chroot/etc/apt/preferences - - if [ -f chroot/etc/apt/preferences.orig ] - then - mv chroot/etc/apt/preferences.orig chroot/etc/apt/preferences - fi - fi - - if Find_files config/chroot_local-packages/*.deb - then - if [ -f chroot/etc/apt/preferences ] - then - # delete additions from lh_chroot_apt install|install-binary to preferences - sed -i '/# Added by lh_chroot_apt/,$d' chroot/etc/apt/preferences - # delete the last empty line - sed -i '${/^[[:blank:]]*$/d;}' chroot/etc/apt/preferences - # if the resulting preferences file is empty there was no user additions, remove it - if [ ! -s chroot/etc/apt/preferences ] - then - rm -rf chroot/etc/apt/preferences - fi - fi - - fi - - # Removing stage file - rm -f .stage/chroot_apt - ;; - - *) - Usage - ;; -esac diff --git a/helpers/lh_chroot_cache b/helpers/lh_chroot_cache deleted file mode 100755 index dacf8c023..000000000 --- a/helpers/lh_chroot_cache +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/sh - -# lh_chroot_cache(1) - cach chroot stage -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'cache chroot stage')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin caching chroot stage..." - -for STAGE in ${LH_CACHE_STAGES} -do - if [ "${STAGE}" = "chroot" ] - then - case "${1}" in - restore) - # Checking stage file - Check_stagefile .stage/chroot_cache.restore - - if [ -d cache/stages_chroot ] - then - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Removing old chroot - rm -rf chroot - - # Restoring old cache - ${LH_ROOT_COMMAND} cp -a cache/stages_chroot chroot - - if [ -n "${LH_ROOT_COMMAND}" ] - then - ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot - fi - - # Creating stage file - Create_stagefile .stage/chroot_cache.restore - - exit 0 - fi - ;; - - save) - # Checking stage file - Check_stagefile .stage/chroot_cache.save - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - rm -rf cache/stages_chroot - - mkdir -p cache - - ${LH_ROOT_COMMAND} cp -a chroot cache/stages_chroot - - if [ -n "${LH_ROOT_COMMAND}" ] - then - ${LH_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/stages_chroot - fi - - # Creating stage file - Create_stagefile .stage/chroot_cache.save - ;; - esac - fi -done diff --git a/helpers/lh_chroot_debianchroot b/helpers/lh_chroot_debianchroot deleted file mode 100755 index 6916d2dad..000000000 --- a/helpers/lh_chroot_debianchroot +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh - -# lh_chroot_debianchroot(1) - manage /etc/debian_chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'manage /etc/debian_chroot')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /etc/debian_chroot" - - # Checking stage file - Check_stagefile .stage/chroot_debianchroot - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ -f chroot/etc/debian_chroot ] - then - # Save chroot file - mv chroot/etc/debian_chroot chroot/etc/debian_chroot.orig - fi - - # Create chroot file - echo "live" > chroot/etc/debian_chroot - - # Creating stage file - Create_stagefile .stage/chroot_debianchroot - ;; - - remove) - Echo_message "Deconfiguring file /etc/debian_chroot" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ -f chroot/etc/debian_chroot.orig ] - then - # Restore chroot file - mv chroot/etc/debian_chroot.orig chroot/etc/debian_chroot - else - # Remove chroot file - rm -f chroot/etc/debian_chroot - fi - - # Removing stage file - rm -f .stage/chroot_debianchroot - ;; - - *) - Usage - ;; -esac diff --git a/helpers/lh_chroot_devpts b/helpers/lh_chroot_devpts deleted file mode 100755 index 9248595d1..000000000 --- a/helpers/lh_chroot_devpts +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh - -# lh_chroot_devpts(1) - mount /dev/pts -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'mount /dev/pts')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Ensure that a system is built as root -lh testroot - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -case "${1}" in - install) - Echo_message "Begin mounting /dev/pts..." - - # Checking stage file - Check_stagefile .stage/chroot_devpts - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LH_USE_FAKEROOT}" != "true" ] - then - # Creating mountpoint - mkdir -p chroot/dev/pts - - # Mounting /dev/pts - ${LH_ROOT_COMMAND} mount devpts-live -t devpts chroot/dev/pts || true - fi - - # Creating stage file - Create_stagefile .stage/chroot_devpts - ;; - - remove) - Echo_message "Begin unmounting /dev/pts..." - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Unmounting /dev/pts - if [ "${LH_USE_FAKEROOT}" != "true" ] - then - if grep -qs "$(pwd)/chroot/dev/pts" /proc/mounts || Find_files chroot/dev/pts/* - then - ${LH_ROOT_COMMAND} umount chroot/dev/pts - else - ${LH_ROOT_COMMAND} umount -f chroot/dev/pts > /dev/null 2>&1 || true - fi - fi - - # Removing stage file - rm -f .stage/chroot_devpts - ;; - - *) - Usage - ;; -esac diff --git a/helpers/lh_chroot_dpkg b/helpers/lh_chroot_dpkg deleted file mode 100755 index bf2950a77..000000000 --- a/helpers/lh_chroot_dpkg +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh - -# lh_chroot_dpkg(1) - manage /sbin/dpkg -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'manage /sbin/dpkg')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /sbin/start-stop-daemon" - - # Checking stage file - Check_stagefile .stage/chroot_dpkg - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Save start-stop-daemon program - mv chroot/sbin/start-stop-daemon chroot/sbin/start-stop-daemon.orig - - # Create start-stop-daemon program - -cat > chroot/sbin/start-stop-daemon << EOF -#!/bin/sh - -exit 0 -EOF - - chmod 755 chroot/sbin/start-stop-daemon - - # Creating stage file - Create_stagefile .stage/chroot_dpkg - ;; - - remove) - Echo_message "Deconfiguring file /sbin/start-stop-daemon" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Restore start-stop-daemon program - if [ -e chroot/sbin/start-stop-daemon.orig ] - then - mv chroot/sbin/start-stop-daemon.orig chroot/sbin/start-stop-daemon - fi - - # Removing stage file - rm -f .stage/chroot_dpkg - ;; - - *) - Usage - ;; -esac diff --git a/helpers/lh_chroot_hacks b/helpers/lh_chroot_hacks deleted file mode 100755 index 66fb36506..000000000 --- a/helpers/lh_chroot_hacks +++ /dev/null @@ -1,188 +0,0 @@ -#!/bin/sh - -# lh_chroot_hacks(1) - execute hacks in chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'execute hacks in chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin executing hacks..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_hacks - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Removing udev mac caching rule -rm -f chroot/etc/udev/rules.d/*persistent-net.rules - -case "${LH_BINARY_IMAGES}" in - net) - if [ ! -f chroot/usr/bin/smbmount ] - then - Apt install smbfs - fi - - if [ ! -d chroot/etc/initramfs-tools ] - then - mkdir chroot/etc/initramfs-tools - fi - if [ ! "$(grep 'MODULES=netboot' chroot/etc/initramfs-tools/initramfs.conf)" ] - then - # Configuring initramfs for NFS -cat >> chroot/etc/initramfs-tools/initramfs.conf << EOF -MODULES=netboot -BOOT=nfs -NFSROOT=auto -EOF - fi - ;; -esac - -# Update initramfs (always, because of udev rules in initrd) -Chroot chroot "update-initramfs -k all -t -u" - -# Ensure readable permissions on initramfs. loop-aes-utils sets umask to -# protect GPG keys, which live-helper does not support. -# Note: Use find rather than chmod on the wildcard, one never knows what -# people might do in local hooks, and there might be no initrds at all. -find chroot/boot -name 'initrd*' -print0 | xargs -r -0 chmod go+r - -# Remove build systems clock drift -echo "0.0 0 0.0" > chroot/etc/adjtime - -# Remove cruft -rm -f chroot/boot/initrd*bak* -rm -f chroot/etc/apt/trusted.gpg~ -rm -f chroot/etc/group- chroot/etc/passwd- -rm -f chroot/etc/gshadow- chroot/etc/shadow- -rm -f chroot/var/cache/debconf/*-old -rm -f chroot/var/lib/dpkg/*-old - -if [ -n "${LH_ROOT_COMMAND}" ] -then - ${LH_ROOT_COMMAND} chown -R --quiet $(whoami):$(whoami) chroot -fi - -case "${LH_INITRAMFS}" in - casper) - ID="999" - ;; - - *) - ID="1000" - ;; -esac - -if [ -d chroot/home/${LH_USERNAME} ] -then - chown -R --quiet ${ID}:${ID} chroot/home/${LH_USERNAME} -fi - -if [ "${LH_DEBIAN_INSTALLER}" = "live" ] -then - # This is a temporary hack to get rid of fstab; - # needs cleanup in live-initramfs first to proper fix. - rm -f chroot/etc/fstab - - # There is a timing issue somewhere when using live-installer - # and the apt-get update waypoint: At the time when we're installing - # bootloader, it tries to fetch them from the net but the e.g. - # 'chroot /target apt-get install grub' fails because of missing - # packages lists. As a very cheap workaround, we ensure that the - # bootloader is already installed in the image. Very ugly, but it's to - # late to fix it in d-i because lenny rc2 has been already released. - case "${LH_ARCHITECTURE}" in - amd64|i386) - case "${LH_BOOTLOADER}" in - grub) - Apt install grub - ;; - - grub2) - Apt install grub2 - ;; - esac - ;; - - powerpc) - Apt install yaboot - ;; - esac -fi - -if [ "${LH_EXPOSED_ROOT}" = "true" ] -then - # Make sure RW dirs exist so that the initramfs script has - # a directory in which to bind the tmpfs filesystems - COW_DIRECTORIES="/home /live /tmp /var/lib/live /var/lock /var/log /var/run /var/tmp /var/spool" - - for DIRECTORY in ${COW_DIRECTORIES} - do - mkdir -p chroot/"${DIRECTORY}" - done - - # Config files which need to be RW - COW_FILES="/etc/adjtime /etc/fstab /etc/hostname /etc/hosts /etc/live.conf /etc/network/interfaces /etc/resolv.conf /etc/udev/rules.d/*persistent-net.rules /etc/udev/rules.d/*persistent-cd.rules /etc/X11/xorg.conf" - - # Where we will store RW config files - RW_DIRECTORY="/var/lib/live" - - for FILE in ${COW_FILES} - do - DIRECTORY="$(dirname ${FILE})" - FILE="$(basename ${FILE})" - RELATIVE_PATH="$(echo ${DIRECTORY} | sed 's|[^/]\+|..|g; s|^/||g')" - - # Touch files in case they don't yet exist - mkdir -p chroot/${DIRECTORY} - touch chroot/${DIRECTORY}/${FILE} - - # Move files to the read-write directory - mkdir -p chroot/${RW_DIRECTORY}/${DIRECTORY} - mv chroot/${DIRECTORY}/${FILE} chroot/${RW_DIRECTORY}/${DIRECTORY} - - # Create a symbolic link to RW config file - ln -s ${RELATIVE_PATH}/${RW_DIRECTORY}/${DIRECTORY}/${FILE} chroot/${DIRECTORY}/${FILE} - done - - # Mount doesn't write to a symlink so use /proc/mounts instead, - # see debian bug #154438 for more info - rm -f chroot/etc/mtab - ln -s /proc/mounts chroot/etc/mtab -fi - -# Show popular warnings -if [ -e chroot/etc/init.d/resolvconf ] -then - Echo_warning "Your live system appears to include resolvconf which is by its nature incompatible in most ways with debian-live." - Echo_warning "Keeping resolvconf installed *can* lead to broken network support in the resulting live system." - Echo_warning "Unless you really know what you are doing, we recommend that you neither install resolvconf explicitly nor implicitly through another package's relation (e.g. by having automatic installation of recommended packages to true)." -fi - -# Creating stage file -Create_stagefile .stage/chroot_hacks diff --git a/helpers/lh_chroot_hooks b/helpers/lh_chroot_hooks deleted file mode 100755 index 986aab593..000000000 --- a/helpers/lh_chroot_hooks +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh - -# lh_chroot_hooks(1) - execute hooks in chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'execute hooks in chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin executing hooks..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_hooks - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Processing hooks -HOOKS="$(echo ${LH_HOOKS} ${LH_PACKAGES_LISTS} ${LH_TASKS} | sed -e 's| |\n|g' | sort -u)" - -for HOOK in ${HOOKS} -do - # Special handling for kde - if [ "${HOOK}" = "kde-desktop" ] && [ -n "$(echo ${HOOKS} | grep gnome-desktop)" ] - then - continue - fi - - if [ -f ${LH_BASE:-/usr/share/live-helper}/hooks/"${HOOK}" ] - then - # Copying hook - cp ${LH_BASE:-/usr/share/live-helper}/hooks/"${HOOK}" chroot/root - - # Making hook executable - if [ ! -x chroot/root/"${HOOK}" ] - then - chmod +x chroot/root/"${HOOK}" - fi - - # Executing hook - Chroot chroot "./root/${HOOK}" || ( Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ) - - # Removing hook - rm -f chroot/root/"${HOOK}" - - # Creating stage file - Create_stagefile .stage/chroot_hooks - fi -done diff --git a/helpers/lh_chroot_hostname b/helpers/lh_chroot_hostname deleted file mode 100755 index 9cafcf635..000000000 --- a/helpers/lh_chroot_hostname +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/sh - -# lh_chroot_hostname(1) - manage /bin/hostname -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'manage /bin/hostname')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /etc/hostname" - - # Checking stage file - Check_stagefile .stage/chroot_hostname - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Save hostname - mv chroot/bin/hostname chroot/bin/hostname.orig - - # Create hostname file - echo "localhost.localdomain" > chroot/etc/hostname - - Echo_message "Configuring file /bin/hostname" - - # Create hostname program - -cat > chroot/bin/hostname << EOF -#!/bin/sh - -echo "localhost.localdomain" -EOF - - chmod 755 chroot/bin/hostname - - # Creating stage file - Create_stagefile .stage/chroot_hostname - ;; - - remove) - Echo_message "Deconfiguring file /etc/hostname" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Copying hostname from local-includes, if existing - if [ -e config/chroot_local-includes/etc/hostname ] - then - cp -a config/chroot_local-includes/etc/hostname chroot/etc/hostname - fi - - Echo_message "Deconfiguring file /bin/hostname" - - # Restore hostname file - if [ -e chroot/bin/hostname.orig ] - then - mv chroot/bin/hostname.orig chroot/bin/hostname - fi - - # Removing stage file - rm -f .stage/chroot_hostname - ;; - - *) - Usage - ;; -esac diff --git a/helpers/lh_chroot_hosts b/helpers/lh_chroot_hosts deleted file mode 100755 index 2b7fc2555..000000000 --- a/helpers/lh_chroot_hosts +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/sh - -# lh_chroot_hosts(1) - manage /etc/hosts -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'manage /etc/hosts')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /etc/hosts" - - # Checking stage file - Check_stagefile .stage/chroot_hosts - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ -f chroot/etc/hosts ] - then - # Save hosts file - mv chroot/etc/hosts chroot/etc/hosts.orig - fi - - # Creating hosts file - -cat > chroot/etc/hosts << EOF -127.0.0.1 localhost localhost.localdomain -127.0.1.1 debian -EOF - - if [ -f /etc/hosts ] - then - # Append hosts file - #grep -e "127.0.0.1" -e "127.0.1.1" /etc/hosts >> chroot/etc/hosts - cat /etc/hosts >> chroot/etc/hosts - fi - - # Creating stage file - Create_stagefile .stage/chroot_hosts - ;; - - remove) - Echo_message "Deconfiguring file /etc/hosts" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ -e config/chroot_local-includes/etc/hosts ] - then - # Copying local hosts - cp -a config/chroot_local-includes/etc/hosts chroot/etc/hosts - rm -f chroot/etc/hosts.orig - elif [ -f chroot/etc/hosts.orig ] - then - # Restore hosts file - mv chroot/etc/hosts.orig chroot/etc/hosts - else - # Blank out hosts file, don't remove in case - # its a symlink, as in the case of exposedroot mode - Truncate chroot/etc/hosts - fi - - # Removing stage file - rm -f .stage/chroot_hosts - ;; - - *) - Usage - ;; -esac diff --git a/helpers/lh_chroot_install-packages b/helpers/lh_chroot_install-packages deleted file mode 100755 index b200e0a03..000000000 --- a/helpers/lh_chroot_install-packages +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh - -# lh_chroot_install-packages(1) - install queued packages into chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'install queued packages into chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin installing packages..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_install-packages - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ -e chroot/root/chroot_packages ] && [ -s chroot/root/chroot_packages ] -then - # Restoring cache - Restore_cache cache/packages_chroot - - # Installing packages - case "${LH_APT}" in - apt|apt-get) - Chroot chroot "xargs --arg-file=/root/chroot_packages apt-get ${APT_OPTIONS} install" - ;; - - aptitude) - Chroot chroot "xargs --arg-file=/root/chroot_packages aptitude ${APTITUDE_OPTIONS} install" - ;; - esac - - # Tidying up - rm -f chroot/root/chroot_packages - - # Saving cache - Save_cache cache/packages_chroot - -fi - -# Creating stage file -Create_stagefile .stage/chroot_install-packages diff --git a/helpers/lh_chroot_interactive b/helpers/lh_chroot_interactive deleted file mode 100755 index eb9c011c8..000000000 --- a/helpers/lh_chroot_interactive +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -# lh_chroot_interactive(1) - make build interactive -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'make build interactive')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_INTERACTIVE}" = "false" ] -then - exit 0 -fi - -Echo_message "Begin interactive build..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_interactive - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -case "${LH_INTERACTIVE}" in - true|shell) - Echo_message "Pausing build: starting interactive shell..." - Chroot chroot "/bin/bash --login" - ;; - x11) - Echo_message "Pausing build: starting interactive X11..." - Chroot chroot "startx" - ;; - xnest) - Echo_message "Pausing build: starting interactive Xnest..." - #Chroot chroot "" # FIXME - ;; -esac - -# Creating stage file -Create_stagefile .stage/chroot_symlinks diff --git a/helpers/lh_chroot_linux-image b/helpers/lh_chroot_linux-image deleted file mode 100755 index 76515ef23..000000000 --- a/helpers/lh_chroot_linux-image +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/sh - -# lh_chroot_linux-image(1) - manage /etc/kernel-img.conf -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'manage /etc/kernel-img.conf')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /etc/kernel-img.conf" - - # Checking stage file - Check_stagefile .stage/chroot_linux-image - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ -f chroot/etc/kernel-img.conf ] - then - # Saving kernel-img.conf - cp chroot/etc/kernel-img.conf chroot/etc/kernel-img.conf.old - fi - - # Configuring kernel-img.conf -cat >> chroot/etc/kernel-img.conf << EOF -do_bootloader = No -do_initrd = Yes -warn_initrd = No -EOF - - # Diverting update-initramfs - #if [ "${LH_INITRAMFS}" = "live-initramfs" ] - #then - # mv chroot/usr/sbin/update-initramfs chroot/usr/sbin/update-initramfs.live-helper - #fi - - if [ "${LH_LINUX_PACKAGES}" != "none" ] - then - for FLAVOUR in ${LH_LINUX_FLAVOURS} - do - for PACKAGE in ${LH_LINUX_PACKAGES} - do - echo ${PACKAGE}-${FLAVOUR} >> chroot/root/chroot_packages - done - done - fi - - # Queue installation of linux-image and ${LH_INITRAMFS} - if [ "${LH_INITRAMFS}" != "none" ] - then - echo ${LH_INITRAMFS} >> chroot/root/chroot_packages - fi - - # Creating stage file - Create_stagefile .stage/chroot_linux-image - ;; - - remove) - Echo_message "Deconfiguring file /etc/kernel-img.conf" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ -f chroot/etc/kernel-img.conf.old ] - then - # Restoring kernel-img.conf file - mv chroot/etc/kernel-img.conf.old chroot/etc/kernel-img.conf - else - # Removing kernel-img.conf file - Truncate chroot/etc/kernel-img.conf - fi - - # Removing stage file - rm -f .stage/chroot_linux-image - ;; - - *) - Usage - ;; -esac diff --git a/helpers/lh_chroot_local-hooks b/helpers/lh_chroot_local-hooks deleted file mode 100755 index 0155e791b..000000000 --- a/helpers/lh_chroot_local-hooks +++ /dev/null @@ -1,69 +0,0 @@ -#!/bin/sh - -# lh_chroot_local-hooks(1) - execute local hooks in chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'execute local hooks in chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin executing local hooks..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_local-hooks - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Processing local-hooks -if Find_files config/chroot_local-hooks/* -then - # Restoring cache - Restore_cache cache/packages_chroot - - for HOOK in config/chroot_local-hooks/* - do - # Copying hook - cp "${HOOK}" chroot/root - - # Making hook executable - if [ ! -x chroot/root/"$(basename ${HOOK})" ] - then - chmod +x chroot/root/"$(basename ${HOOK})" - fi - - # Executing hook - Chroot chroot "/root/$(basename ${HOOK})" || ( Echo_error "${HOOK} failed (exit non-zero). You should check for errors."; exit 1 ) - - # Removing hook - rm -f chroot/root/"$(basename ${HOOK})" - done - - # Saving cache - Save_cache cache/packages_chroot - - # Creating stage file - Create_stagefile .stage/chroot_local-hooks -fi diff --git a/helpers/lh_chroot_local-includes b/helpers/lh_chroot_local-includes deleted file mode 100755 index 399175010..000000000 --- a/helpers/lh_chroot_local-includes +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -# lh_chroot_local-includes(1) - copy local files into chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'copy local files into chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin copying chroot local includes..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_local-includes - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if Find_files config/chroot_local-includes/ -then - # Copying includes - cd config/chroot_local-includes - find . | cpio -dmpu --no-preserve-owner "${OLDPWD}"/chroot - cd "${OLDPWD}" - - # Creating stage file - Create_stagefile .stage/chroot_local-includes -fi diff --git a/helpers/lh_chroot_local-packages b/helpers/lh_chroot_local-packages deleted file mode 100755 index f2cdfb07d..000000000 --- a/helpers/lh_chroot_local-packages +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/sh - -# lh_chroot_local-packages(1) - queue install of local packages into chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'queue install of local packages into chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin queueing installation of local packages..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_local-packages - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if Find_files chroot/root/local-packages/*.deb -then - gunzip < chroot/root/local-packages/Packages.gz | awk '/^Package: / { print $2 }' \ - >> chroot/root/chroot_packages - - # Creating stage file - Create_stagefile .stage/chroot_local-packages -fi diff --git a/helpers/lh_chroot_local-packageslists b/helpers/lh_chroot_local-packageslists deleted file mode 100755 index 5e51ed931..000000000 --- a/helpers/lh_chroot_local-packageslists +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -# lh_chroot_local-packageslists(1) - queue install of local packages lists into chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'queue install of local packages lists into chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin queueing installation of local packages lists..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_local-packageslists - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if ls config/chroot_local-packageslists/*.list > /dev/null 2>&1 -then - for LIST in config/chroot_local-packageslists/*.list - do - # Generating local package list - Expand_packagelist "$(basename ${LIST})" "config/chroot_local-packageslists" \ - >> chroot/root/chroot_packages - done - - # Creating stage file - Create_stagefile .stage/chroot_local-packageslists -fi diff --git a/helpers/lh_chroot_local-patches b/helpers/lh_chroot_local-patches deleted file mode 100755 index 303ffd156..000000000 --- a/helpers/lh_chroot_local-patches +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh - -# lh_chroot_local-patches(1) - apply local patches against chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'apply local patches against chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin applying chroot local patches..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_local-patches - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if Find_files config/chroot_local-patches/ -then - # Restoring cache - Restore_cache cache/packages_chroot - - # Checking depends - Check_package chroot/usr/bin/patch patch - - # Installing depends - Install_package - - for PATCH in config/chroot_local-patches/* - do - Echo_message "Applying patch %s..." "${PATCH}" - Chroot chroot "patch -p1" < ${PATCH} - done - - # Removing depends - Remove_package - - # Saving cache - Save_cache cache/packages_chroot - - # Creating stage file - Create_stagefile .stage/chroot_local-patches -fi diff --git a/helpers/lh_chroot_local-preseed b/helpers/lh_chroot_local-preseed deleted file mode 100755 index 2256babe5..000000000 --- a/helpers/lh_chroot_local-preseed +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh - -# lh_chroot_local-preseed(1) - use debconf local preseeding file -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'execute local preseed in chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin executing local preseeds..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_local-preseed - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if Find_files config/chroot_local-preseed/* -then - # Check dependency - Check_package chroot/usr/bin/debconf-set-selections debconf - - # Install dependency - Install_package - - for PRESEED in config/chroot_local-preseed/* - do - # Copying local preseed - cp "${PRESEED}" chroot/root/preseed - - Chroot chroot "debconf-set-selections /root/preseed" - - # Removing local preseed file - rm -f chroot/root/preseed - done - - # Remove dependency - Remove_package - - # Creating stage file - Create_stagefile .stage/chroot_local-preseed -fi diff --git a/helpers/lh_chroot_localization b/helpers/lh_chroot_localization deleted file mode 100755 index a277f1731..000000000 --- a/helpers/lh_chroot_localization +++ /dev/null @@ -1,655 +0,0 @@ -#!/bin/sh - -# lh_chroot_localization(1) - install localization packages into chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'install localization packages into chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin installing localization packages..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_localization - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Setting localizations -if [ -n "${LH_LANGUAGE}" ] -then - case "${LH_LANGUAGE}" in - af) - # Afrikaans - LOCALIZATIONS="iceweasel kde openoffice" - ;; - - as-in) - # Assamese - LOCALIZATIONS="openoffice" - ;; - - ar) - # Arabic - LOCALIZATIONS="iceweasel kde openoffice" - ;; - - az) - # Azerbaijani - LOCALIZATIONS="kde" - ;; - - be) - # Belarusian - LOCALIZATIONS="iceape iceweasel openoffice" - - # Overrides - OPENOFFICE="be-by" - ;; - - bg) - # Bulgarian - LOCALIZATIONS="icedove iceweasel kde openoffice" - ;; - - bn) - # Bengali - LOCALIZATIONS="kde openoffice" - ;; - - br) - # Breton - LOCALIZATIONS="kde openoffice" - ;; - - bs) - # Bosnian - LOCALIZATION="kde openoffice" - ;; - - ca) - # Catalan - LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" - ;; - - cs) - # Czech - LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" - ;; - - cy-gb) - # Welsh - LOCALIZATIONS="iceweasel kde koffice openoffice" - - # Overrides - KDE="cy" - KOFFICE="cy" - OPENOFFICE="cy" - ;; - - da) - # Danish - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - ;; - - de) - # German - LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" - ;; - - dz-bt) - # Dzongkha - LOCALIZATIONS="iceweasel openoffice" - - # Overrides - OPENOFFICE="dz" - ;; - - el) - # Greek - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - ;; - - en-gb) - # English (Great Britain) - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - - # Overrides - KDE="engb" - KOFFICE="engb" - ;; - - en-za) - # English (South Africa) - LOCALIZATIONS="openoffice" - ;; - - eo) - # Esperanto - LOCALIZATIONS="kde openoffice" - ;; - - es-ar) - # Spanish (Argentina) - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - - # Overrides - KDE="es" - KOFFICE="es" - OPENOFFICE="es" - ;; - - es-es) - # Spanish (Spain) - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - - # Overrides - KDE="es" - KOFFICE="es" - OPENOFFICE="es" - ;; - - et-ee) - # Estonian - LOCALIZATIONS="iceweasel kde koffice openoffice" - - # Overrides - KDE="et" - KOFFICE="et" - OPENOFFICE="et" - ;; - - eu) - # Basque - LOCALIZATIONS="icedove iceweasel kde koffice" - ;; - - fa-ir) - # Persian - LOCALIZATIONS="iceweasel kde openoffice" - - # Overrides - KDE="fa" - OPENOFFICE="fa" - ;; - - fi) - # Finnish - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - ;; - - fr) - # French - LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" - ;; - - fur-it) - # Furlan - LOCALIZATIONS="iceweasel" - ;; - - fy-nl) - # Frisian - LOCALIZATIONS="iceweasel kde" - - # Overrides - KDE="fy" - ;; - - ga-ie) - # Irish (Ireland) - LOCALIZATIONS="icedove iceweasel kde openoffice" - - # Overrides - ICEDOVE="ga" - KDE="ga" - OPENOFFICE="ga" - ;; - - gl) - # Galician - LOCALIZATIONS="kde" - ;; - - gu-in) - # Gujarati (India) - LOCALIZATIONS="icedove iceweasel openoffice" - - # Overrides - ICEDOVE="gu" - ;; - - he) - # Hebrew - LOCALIZATIONS="iceape icedove iceweasel kde openoffice" - ;; - - hi) - # Hindi - LOCALIZATIONS="kde openoffice" - ;; - - hr) - # Croatian - LOCALIZATIONS="kde koffice openoffice" - ;; - - hu) - # Hungarian - LOCALIZATIONS="icedove iceweasel kde openoffice" - ;; - - in) - # Indic - LOCALIZATIONS="openoffice" - ;; - - is) - # Icelandic - LOCALIZATIONS="kde" - ;; - - it) - # Italian - LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" - ;; - - ja) - # Japanese - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - ;; - - ka) - # Georgian - LOCALIZATIONS="iceweasel openoffice" - ;; - - km) - # Khmer - LOCALIZATIONS="kde openoffice" - ;; - - ko) - # Korean - LOCALIZATIONS="icedove iceweasel kde openoffice" - ;; - - ku) - # Kurdish - LOCALIZATIONS="iceweasel openoffice" - ;; - - lo) - # Lao - LOCALIZATIONS="openoffice" - ;; - - lt) - # Lithuanian - LOCALIZATIONS="icedove iceweasel kde openoffice" - ;; - - lv) - # Latvian - LOCALIZATIONS="kde koffice openoffice" - ;; - - mk) - # Macedonian - LOCALIZATIONS="icedove iceweasel kde openoffice" - ;; - - ml-in) - # Malayalam - LOCALIZATIONS="openoffice" - ;; - - mn) - # Mongolian - LOCALIZATIONS="iceweasel kde" - ;; - - ms) - # Malay - LOCALIZATIONS="kde koffice" - ;; - - nb-no) - # Bokmaal (Norway) - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - - # Overrides - ICEDOVE="nb" - KDE="nb" - KOFFICE="nb" - OPENOFFICE="nb" - ;; - - nds) - # Low Saxon - LOCALIZATIONS="kde" - ;; - - ne) - # Nepalese - LOCALIZATIONS="openoffice" - ;; - - nl) - # Dutch - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - ;; - - nn-no) - # Nynorsk (Norway) - LOCALIZATIONS="iceweasel kde openoffice" - - # Overrides - KDE="nn" - OPENOFFICE="nn" - ;; - - nr) - # Ndebele - LOCALIZATIONS="openoffice" - ;; - - ns) - # Northernsotho - LOCALIZATIONS="openoffice" - ;; - - or-in) - # Oriya - LOCALIZATIONS="openoffice" - ;; - - pa-in) - # Punjabi (India) - LOCALIZATIONS="icedove iceweasel kde openoffice" - - # Overrides - ICEDOVE="pa" - KDE="pa" - ;; - - pl) - # Polish - LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" - ;; - - pt-br) - # Portugese (Brazil) - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - - # Overrides - KDE="ptbr" - KOFFICE="ptbr" - ;; - - pt-pt) - # Portugese (Portugal) - LOCALIZATIONS="iceweasel kde koffice openoffice" - - # Overrides - KDE="pt" - KOFFICE="pt" - OPENOFFICE="pt" - ;; - - ro) - # Romanian - LOCALIZATIONS="iceweasel kde" - ;; - - roa-es-val) - # Valencian (Spain) - LOCALIZATIONS="iceweasel" - ;; - - ru) - # Russian - LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice" - ;; - - rw) - # Kinarwanda - LOCALIZATIONS="kde openoffice" - ;; - - se) - # Northern Sami - LOCALIZATIONS="kde" - ;; - - sk) - # Slovak - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - ;; - - sl) - # Slovenian - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - ;; - - sr-cs) - # Serbian - LOCALIZATIONS="kde koffice openoffice" - - # Overrides - KDE="sr" - KOFFICE="sr" - ;; - - sr-latin) - # Latin Serbian - LOCALIZATIONS="kde koffice" - - # Overrides - KDE="srlatin" - KOFFICE="srlatin" - ;; - - ss) - # Swazi - LOCALIZATIONS="kde openoffice" - ;; - - st) - # Southern_sotho - LOCALIZATIONS="openoffice" - ;; - - sv-se) - # Swedish - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - - # Overrides - ICEDOVE="sv" - KDE="sv" - KOFFICE="sv" - OPENOFFICE="sv" - ;; - - ta-in) - # Tamil - LOCALIZATIONS="kde openoffice" - - # Overrides - KDE="ta" - ;; - - te-in) - # Telugu - LOCALIZATIONS="openoffice" - ;; - - tg) - # Tajik - LOCALIZATIONS="kde openoffice" - ;; - - th) - # Thai - LOCALIZATIONS="openoffice" - ;; - - tn) - # Tswana - LOCALIZATIONS="openoffice" - ;; - - tr) - # Turkish - LOCALIZATIONS="icedove iceweasel kde kofffice openoffice" - ;; - - ts) - # Tsonga - LOCALIZATIONS="openoffice" - ;; - - uk-ua) - # Ukrainian - LOCALIZATIONS="icedove iceweasel kde kofffice openoffice" - - # Overrides - ICEDOVE="uk" - KDE="uk" - KDE="uk" - OPENOFFICE="uk" - ;; - - uz) - # Uzbek - LOCALIZATIONS="kde" - ;; - - ve) - # Venda - LOCALIZATIONS="openoffice" - ;; - - vi) - # Vietnamese - LOCALIZATIONS="openoffice" - ;; - - xh) - # Xhosa - LOCALIZATIONS="openoffice" - ;; - - za) - # South African - LOCALIZATIONS="openoffice" - ;; - - zh-cn) - # Chinese (China) - LOCALIZATIONS="icedove iceweasel kde koffice openoffice" - - # Overrides - KDE="zhcn" - KOFFICE="zhcn" - ;; - - zh-tw) - # Chinese (Taiwan) - LOCALIZATIONS="iceweasel kde koffice openoffice" - - # Overrides - KDE="zhtw" - KOFFICE="zhtw" - ;; - - zu) - # Zulu - LOCALIZATIONS="openoffice" - ;; - esac - - # Setting languages - ICEAPE="${ICEAPE:-$LH_LANGUAGE}" - ICEDOVE="${ICEDOVE:-$LH_LANGUAGE}" - ICEWEASEL="${ICEWEASEL:-$LH_LANGUAGE}" - KDE="${KDE:-$LH_LANGUAGE}" - KOFFICE="${KOFFICE:-$LH_LANGUAGE}" - OPENOFFICE="${OPENOFFICE:-$LH_LANGUAGE}" - - # Setting packages - for LOCALIZATION in ${LOCALIZATIONS} - do - case "${LOCALIZATION}" in - iceape) - Check_installed chroot/usr/bin/iceape iceape; [ $INSTALL_STATUS -eq 0 ] && Check_package "" iceweasel-l10n-"${ICEAPE}" - ;; - - icedove) - Check_installed chroot/usr/bin/icedove icedove - if [ $INSTALL_STATUS -eq 0 ] - then - if [ "${LH_DISTRIBUTION}" = lenny ] - then - Check_package "" icedove-locale-"${ICEDOVE}" - else - Check_package "" icedove-l10n-"${ICEDOVE}" - fi - fi - ;; - - iceweasel) - Check_installed chroot/usr/bin/iceweasel iceweasel; [ $INSTALL_STATUS -eq 0 ] && Check_package "" iceweasel-l10n-"${ICEWEASEL}" - ;; - - kde) - Check_installed chroot/usr/bin/kstart kdebase-bin; [ $INSTALL_STATUS -eq 0 ] && Check_package "" kde-i18n-"${KDE}" - ;; - - koffice) - Check_installed chroot/usr/bin/koconverter koffice; [ $INSTALL_STATUS -eq 0 ] && Check_package "" koffice-i18n-"${KOFFICE}" - ;; - - openoffice) - Check_installed chroot/usr/bin/ooffice openoffice.org-common; [ $INSTALL_STATUS -eq 0 ] && Check_package "" openoffice.org-l10n-"${OPENOFFICE}" - ;; - esac - done - - Check_installed chroot/usr/bin/gwenview gwenview; [ $INSTALL_STATUS -eq 0 ] && Check_package "" gwenview-i18n - Check_installed chroot/usr/bin/k3b k3b; [ $INSTALL_STATUS -eq 0 ] && Check_package "" k3b-i18n - - # Restoring cache - Restore_cache cache/packages_chroot - - # Installing packages - Install_package - - # Saving cache - Save_cache cache/packages_chroot - - # Creating stage file - Create_stagefile .stage/chroot_localization -fi diff --git a/helpers/lh_chroot_packages b/helpers/lh_chroot_packages deleted file mode 100755 index 61a2fa645..000000000 --- a/helpers/lh_chroot_packages +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh - -# lh_chroot_packages(1) - queue install of packages into chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'queue install of packages into chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin queueing installation of packages..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_packages - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ -n "${LH_PACKAGES}" ] && [ "${LH_PACKAGES}" != "none" ] -then - echo ${LH_PACKAGES} >> chroot/root/chroot_packages - - # Creating stage file - Create_stagefile .stage/chroot_packages -fi diff --git a/helpers/lh_chroot_packageslists b/helpers/lh_chroot_packageslists deleted file mode 100755 index 3ec26fb6b..000000000 --- a/helpers/lh_chroot_packageslists +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -# lh_chroot_packageslists(1) - queue install of packages lists into chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'queue install of packages lists into chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin queueing installation of packages lists..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_packageslists - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ -n "${LH_PACKAGES_LISTS}" ] && [ "${LH_PACKAGES_LISTS}" != "none" ] -then - - for LIST in ${LH_PACKAGES_LISTS} - do - # Generating package list - Expand_packagelist "${LIST}" >> chroot/root/chroot_packages - done - - # Creating stage file - Create_stagefile .stage/chroot_packageslists -fi diff --git a/helpers/lh_chroot_preseed b/helpers/lh_chroot_preseed deleted file mode 100755 index 6058e733a..000000000 --- a/helpers/lh_chroot_preseed +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh - -# lh_chroot_preseed(1) - use debconf preseeding file -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'execute preseed in chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin executing preseed..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_preseed - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Processing preseeds -for PRESEED in ${LH_PACKAGES_LISTS} ${LH_TASKS} -do - if [ -f ${LH_BASE:-/usr/share/live-helper}/preseed/"${PRESEED}" ] - then - # Check dependency - Check_package chroot/usr/bin/debconf-set-selections debconf - - # Install dependency - Install_package - - # Copying preseed - cp "${PRESEED}" chroot/root/preseed - - Chroot 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 -done diff --git a/helpers/lh_chroot_proc b/helpers/lh_chroot_proc deleted file mode 100755 index 392fa5ee1..000000000 --- a/helpers/lh_chroot_proc +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh - -# lh_chroot_proc(1) - mount /proc -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'mount /proc')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Ensure that a system is built as root -lh testroot - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -case "${1}" in - install) - Echo_message "Begin mounting /proc..." - - # Checking stage file - Check_stagefile .stage/chroot_proc - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LH_USE_FAKEROOT}" != "true" ] - then - # Creating mountpoint - mkdir -p chroot/proc - - # Mounting /proc - ${LH_ROOT_COMMAND} mount proc-live -t proc chroot/proc - else - rm -rf chroot/proc - ln -s /proc chroot/ - fi - - # Creating stage file - Create_stagefile .stage/chroot_proc - ;; - - remove) - Echo_message "Begin unmounting /proc..." - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LH_USE_FAKEROOT}" != "true" ] - then - # Workaround binfmt-support /proc locking - if [ -e chroot/proc/sys/fs/binfmt_misc/status ] - then - ${LH_ROOT_COMMAND} umount chroot/proc/sys/fs/binfmt_misc - fi - - # Unmounting /proc - #fuser -km chroot/proc - if [ -e chroot/proc/version ] - then - ${LH_ROOT_COMMAND} umount chroot/proc - fi - else - rm -rf chroot/proc - mkdir -p chroot/proc - fi - - # Removing stage file - rm -f .stage/chroot_proc - ;; - - *) - Usage - ;; -esac diff --git a/helpers/lh_chroot_resolv b/helpers/lh_chroot_resolv deleted file mode 100755 index 0b24a2398..000000000 --- a/helpers/lh_chroot_resolv +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/sh - -# lh_chroot_resolv(1) - manage /etc/resolv.conf -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'manage /etc/resolv.conf')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /etc/resolv.conf" - - # Checking stage file - Check_stagefile .stage/chroot_resolv - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ -e chroot/etc/resolv.conf ] - then - # Save resolv file or symlink - mv chroot/etc/resolv.conf chroot/etc/resolv.conf.orig - - # Also truncate it, otherwise we'll end up with the one - # created by debootstrap in the final image. - # - # If you want to have a custom resolv.conf, please - # overwrite it with normal local_includes mechanism. - Truncate chroot/etc/resolv.conf.orig - fi - - if [ -f /etc/resolv.conf ] - then - # Copy resolv file - cp /etc/resolv.conf chroot/etc/resolv.conf - fi - - # Creating stage file - Create_stagefile .stage/chroot_resolv - ;; - - remove) - Echo_message "Deconfiguring file /etc/resolv.conf" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ -e config/chroot_local-includes/etc/resolv.conf ] - then - # Copying local resolv.conf - cp -a config/chroot_local-includes/etc/resolv.conf chroot/etc/resolv.conf - rm -f chroot/etc/resolv.conf.orig - elif [ -e chroot/etc/resolv.conf.orig ] - then - # Restoring resolv file or symlink - mv chroot/etc/resolv.conf.orig chroot/etc/resolv.conf - else - # Truncating resolv file - Truncate chroot/etc/resolv.conf - fi - - # Removing stage file - rm -f .stage/chroot_resolv - ;; - - *) - Usage - ;; -esac diff --git a/helpers/lh_chroot_selinuxfs b/helpers/lh_chroot_selinuxfs deleted file mode 100755 index 558d3d7d3..000000000 --- a/helpers/lh_chroot_selinuxfs +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh - -# lh_chroot_sysfs(1) - mount /selinux -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'mount /selinux')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Ensure that a system is built as root -lh testroot - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -case "${1}" in - install) - if [ -e /selinux/enforce ] && [ "$(cat /selinux/enforce)" = "1" ] - then - Echo_message "Begin mounting /selinux..." - - # Checking stage file - Check_stagefile .stage/chroot_selinuxfs - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LH_USE_FAKEROOT}" != "true" ] - then - # Create mountpoint - mkdir -p chroot/selinux - - # Mounting /selinux - ${LH_ROOT_COMMAND} mount selinuxfs-live -t selinuxfs chroot/selinux - else - rm -rf chroot/selinux - ln -s /selinux chroot/ - fi - - # Creating stage file - Create_stagefile .stage/chroot_selinuxfs - fi - ;; - - remove) - Echo_message "Begin unmounting /selinux..." - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LH_USE_FAKEROOT}" != "true" ] - then - # Unmounting /selinux - #fuser -km chroot/selinux - if [ -e chroot/selinux/enforce ] - then - ${LH_ROOT_COMMAND} umount chroot/selinux - fi - else - if [ -e chroot/selinux ] - then - rm -rf chroot/selinux - mkdir -p chroot/selinux - fi - fi - - # Removing stage file - rm -f .stage/chroot_selinux - ;; - - *) - Usage - ;; -esac diff --git a/helpers/lh_chroot_sources b/helpers/lh_chroot_sources deleted file mode 100755 index 81c02681f..000000000 --- a/helpers/lh_chroot_sources +++ /dev/null @@ -1,466 +0,0 @@ -#!/bin/sh - -# lh_chroot_sources(1) - manage /etc/apt/sources.list -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'manage /etc/apt/sources.list')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -_LH_LOCAL_KEY_EMAIL="live-helper-local-key@invalid" - -case "${1}" in - install) - Echo_message "Configuring file /etc/apt/sources.list" - - # Checking stage file - Check_stagefile .stage/chroot_sources - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Configure custom sources.list - echo "deb ${LH_MIRROR_CHROOT} ${LH_DISTRIBUTION} ${LH_ARCHIVE_AREAS}" > chroot/etc/apt/sources.list - - if [ "${LH_SOURCE}" = "true" ] - then - echo "deb-src ${LH_MIRROR_CHROOT} ${LH_DISTRIBUTION} ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list - fi - - if [ "${LH_SECURITY}" = "true" ] - then - case "${LH_MODE}" in - ubuntu) - echo "deb ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}-security ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list - - if [ "${LH_SOURCE}" = "true" ] - then - echo "deb-src ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}-security ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list - fi - ;; - - *) - if [ "${LH_DISTRIBUTION}" != "sid" ] && [ "${LH_DISTRIBUTION}" != "unstable" ] - then - echo "deb ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list - - if [ "${LH_SOURCE}" = "true" ] - then - echo "deb-src ${LH_MIRROR_CHROOT_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list - fi - fi - ;; - esac - fi - - # Check local sources.list - if Find_files config/chroot_sources/*.chroot - then - # Deconfigure (possibly) old sources.list snipplets - if Find_files config/chroot_sources/*.binary - then - for FILE in config/chroot_sources/*.binary - do - rm -f "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary).list" - done - fi - - # Configure new sources.list snipplets - for FILE in config/chroot_sources/*.chroot - do - cp "${FILE}" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot).list" - done - fi - - # Configure local package repository - if Find_files config/chroot_local-packages/*.deb - then - rm -rf chroot/root/local-packages - mkdir -p chroot/root/local-packages - - if [ "$(stat --printf %d config/chroot_local-packages)" = "$(stat --printf %d chroot/root/local-packages)" ] - then - CP_OPTIONS="-l" - fi - - # Copy packages - if Find_files config/chroot_local-packages/*_"${LH_ARCHITECTURE}".deb - then - cp ${CP_OPTIONS} config/chroot_local-packages/*_"${LH_ARCHITECTURE}".deb chroot/root/local-packages - fi - - if Find_files config/chroot_local-packages/*_all.deb - then - cp ${CP_OPTIONS} config/chroot_local-packages/*_all.deb chroot/root/local-packages - fi - - if Find_files chroot/root/local-packages/*.deb - then - # If we bootstrapped a minimal chroot, we need - # to install apt-utils before we have have - # completed all the indices. - case "${LH_BOOTSTRAP_FLAVOUR}" in - stripped|minimal) - Chroot chroot "apt-get update" - ;; - esac - - # Restoring cache - Restore_cache cache/packages_chroot - - # Check depends - Check_package chroot/usr/bin/apt-ftparchive apt-utils - - # Installing depends - Install_package - - # Generate Packages and Packages.gz - echo "cd /root/local-packages && apt-ftparchive packages . > Packages" | Chroot chroot sh - gzip -9 -c chroot/root/local-packages/Packages > chroot/root/local-packages/Packages.gz - - # Generate Release - echo "cd /root/local-packages && apt-ftparchive \ - -o APT::FTPArchive::Release::Origin=chroot_local-packages \ - release . > Release" | Chroot chroot sh - - if [ "${LH_APT_SECURE}" = "true" ] - then - _LH_DOTGNUPG_EXISTED=0 - if [ -d chroot/root/.gnupg ] - then - _LH_DOTGNUPG_EXISTED=1 - fi - - # Ensure ~/.gnupg exists (required for gnupg >= ~1.4.9) - mkdir -p chroot/root/.gnupg - - # Temporarily replace /dev/random with /dev/urandom so as not - # to block automated image builds; we don't care about the - # security of this key anyway. - mv chroot/dev/random chroot/dev/random.orig - cp -a chroot/dev/urandom chroot/dev/random - - if Find_files cache/local-package-keyring.* - then - cp cache/local-package-keyring.* chroot/root - else - # Generate temporary key - echo "Key-Type: RSA - Key-Length: 1024 - Subkey-Type: ELG-E - Subkey-Length: 1024 - Name-Real: live-helper local packages key - Name-Email: ${_LH_LOCAL_KEY_EMAIL} - Expire-Date: 0 - %secring /root/local-package-keyring.sec - %pubring /root/local-package-keyring.pub - %commit" | Chroot chroot "gpg --batch --gen-key" || _LH_RET=${?} - - case "${_LH_RET}" in - ""|2) - # Gnupg sometimes seems to return with a status of 2 when there was not - # enough entropy (and key creation blocks temporarily) even if the - # operation was ultimately successful. - ;; - *) - Echo_error "GPG exited with error status %s" "${_LH_RET}" - exit ${_LH_RET} - ;; - esac - - # Save keyrings to avoid regeneration - cp chroot/root/local-package-keyring.* cache/ - fi - - # Sign release - Chroot chroot "gpg --no-default-keyring --secret-keyring /root/local-package-keyring.sec \ - --keyring /root/local-package-keyring.pub -abs -o \ - /root/local-packages/Release.gpg /root/local-packages/Release" - - # Import key - Chroot chroot "gpg --no-default-keyring --secret-keyring /root/local-package-keyring.sec \ - --keyring /root/local-package-keyring.pub --armor \ - --export ${_LH_LOCAL_KEY_EMAIL}" | Chroot chroot "apt-key add -" - - # Remove temporary keyrings - rm chroot/root/local-package-keyring.pub - rm chroot/root/local-package-keyring.sec - - # Revert /dev/random - mv chroot/dev/random.orig chroot/dev/random - - # Remove /root/.gnupg if we created it during the signing process - if [ "${_LH_DOTGNUPG_EXISTED}" -eq 0 ] - then - rm -rf chroot/root/.gnupg - fi - fi - - # Add to sources.list - echo "" >> chroot/etc/apt/sources.list - echo "# Local packages" >> chroot/etc/apt/sources.list - echo "deb file:/root/local-packages ./" >> chroot/etc/apt/sources.list - - # Removing depends - Remove_package - - # Saving cache - Save_cache cache/packages_chroot - else - Echo_warning "Local packages must be named with suffix '_all.deb' or '_\$architecture.deb'." - fi - fi - - # Update indices from cache - if [ "${LH_CACHE_INDICES}" = "true" ] && [ -d cache/indices_bootstrap ] - then - if Find_files cache/indices_bootstrap/secring.gpg* - then - cp -f cache/indices_bootstrap/secring.gpg* chroot/etc/apt - fi - - if Find_files cache/indices_bootstrap/trusted.gpg* - then - cp -f cache/indices_bootstrap/trusted.gpg* chroot/etc/apt - fi - - if [ -f cache/indices_bootstrap/pkgcache.bin ] - then - cp -f cache/indices_bootstrap/pkgcache.bin chroot/var/cache/apt - fi - - if [ -f cache/indices_bootstrap/srcpkgcache.bin ] - then - cp -f cache/indices_bootstrap/srcpkgcache.bin chroot/var/cache/apt - fi - - if Find_files cache/indices_bootstrap/*_Packages - then - cp -f cache/indices_bootstrap/*_Packages chroot/var/lib/apt/lists - fi - - if Find_files cache/indices_bootstrap/*_Sources - then - cp -f cache/indices_bootstrap/*_Sources chroot/var/lib/apt/lists - fi - - if Find_files cache/indices_bootstrap/*_Release* - then - cp -f cache/indices_bootstrap/*_Release* chroot/var/lib/apt/lists - fi - - if [ "${LH_APT}" = "aptitude" ] && [ ! -x /usr/bin/aptitude ] - then - Chroot chroot "apt-get ${APT_OPTIONS} install aptitude" - fi - else # Get fresh indices - # Check local gpg keys - if Find_files config/chroot_sources/*.chroot.gpg - then - for FILE in config/chroot_sources/*.chroot.gpg - do - cp ${FILE} chroot/root - Chroot chroot "apt-key add /root/$(basename ${FILE})" - rm -f chroot/root/$(basename ${FILE}) - done - fi - - # Check local keyring packages - if Find_files config/chroot_sources/*.deb - then - for PACKAGE in config/chroot_sources/*.deb - do - cp ${PACKAGE} chroot/root - Chroot chroot "dpkg -i /root/$(basename ${PACKAGE})" - rm -f chroot/root/$(basename ${PACKAGE}) - done - fi - - # Installing aptitude - if [ "${LH_APT}" = "aptitude" ] && [ ! -x /usr/bin/aptitude ] - then - Chroot chroot "apt-get ${APT_OPTIONS} update" - Chroot chroot "apt-get ${APT_OPTIONS} install aptitude" - fi - - Apt update - Apt upgrade - Apt dist-upgrade - - # Installing keyring packages - if [ -n "${LH_KEYRING_PACKAGES}" ] - then - Chroot chroot "apt-get --yes --force-yes install ${LH_KEYRING_PACKAGES}" - Apt update - fi - - if [ "${LH_CACHE_INDICES}" = "true" ] - then - 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 - - cp -f chroot/var/cache/apt/pkgcache.bin cache/indices_bootstrap - - if Find_files chroot/var/cache/apt/srcpkgcache.bin - then - cp -f chroot/var/cache/apt/srcpkgcache.bin cache/indices_bootstrap - fi - - cp -f chroot/var/lib/apt/lists/*_Packages cache/indices_bootstrap - - if Find_files chroot/var/lib/apt/lists/*_Sources - then - cp -f chroot/var/lib/apt/lists/*_Sources cache/indices_bootstrap - fi - - cp -f chroot/var/lib/apt/lists/*_Release* cache/indices_bootstrap - fi - fi - - # Creating stage file - Create_stagefile .stage/chroot_sources - ;; - - remove) - Echo_message "Deconfiguring file /etc/apt/sources.list" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Configure generic indices - # Don't do anything if it's not required - if [ "${LH_MIRROR_CHROOT}" = "${LH_MIRROR_BINARY}" ] && \ - [ "${LH_MIRROR_CHROOT_SECURITY}" = "${LH_MIRROR_BINARY_SECURITY}" ] && \ - [ ! -d chroot/root/local-packages ] - then - # Removing stage file - rm -f .stage/chroot_sources - - exit 0 - fi - - # Cleaning apt list cache - rm -rf chroot/var/lib/apt/lists - mkdir -p chroot/var/lib/apt/lists/partial - - echo "deb ${LH_MIRROR_BINARY} ${LH_DISTRIBUTION} ${LH_ARCHIVE_AREAS}" > chroot/etc/apt/sources.list - - if [ "${LH_SOURCE}" = "true" ] - then - echo "deb-src ${LH_MIRROR_BINARY} ${LH_DISTRIBUTION} ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list - fi - - if [ "${LH_SECURITY}" = "true" ] - then - case "${LH_MODE}" in - ubuntu) - echo "deb ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}-security ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list - - if [ "${LH_SOURCE}" = "true" ] - then - echo "deb-src ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}-security ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list - fi - ;; - - *) - if [ "${LH_DISTRIBUTION}" != "sid" ] && [ "${LH_DISTRIBUTION}" != "unstable" ] - then - echo "deb ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list - - if [ "${LH_SOURCE}" = "true" ] - then - echo "deb-src ${LH_MIRROR_BINARY_SECURITY} ${LH_DISTRIBUTION}/updates ${LH_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list - fi - fi - ;; - esac - fi - - # Check local sources.list - if Find_files config/chroot_sources/*.binary - then - # Deconfigure (possibly) old sources.list snipplets - if Find_files config/chroot_sources/*.chroot - then - for FILE in config/chroot_sources/*.chroot - do - rm -f "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot).list" - done - fi - - # Configure new sources.list snipplets - for FILE in config/chroot_sources/*.binary - do - cp "${FILE}" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary).list" - done - fi - - # Check local gpg keys - if Find_files config/chroot_sources/*.binary.gpg - then - for FILE in config/chroot_sources/*.binary.gpg - do - cp ${FILE} chroot/root - Chroot chroot "apt-key add /root/$(basename ${FILE})" - rm -f chroot/root/$(basename ${FILE}) - done - fi - - # Updating indices - Apt update - - # Cleaning apt package cache - rm -rf chroot/var/cache/apt - mkdir -p chroot/var/cache/apt/archives/partial - - # Cleaning apt package lists - if [ "${LH_BINARY_INDICES}" = "false" ] - then - rm -rf chroot/var/lib/apt/lists - mkdir -p chroot/var/lib/apt/lists/partial - fi - - # Remove local package repository - rm -rf chroot/root/local-packages - - # Remove local packages key if it exists - if apt-key list | grep -q ${_LH_LOCAL_KEY_EMAIL} - then - apt-key del ${_LH_LOCAL_KEY_EMAIL} - fi - - # Removing stage file - rm -f .stage/chroot_sources - ;; - - *) - Usage - ;; -esac diff --git a/helpers/lh_chroot_symlinks b/helpers/lh_chroot_symlinks deleted file mode 100755 index 576f06e2e..000000000 --- a/helpers/lh_chroot_symlinks +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh - -# lh_chroot_symlinks(1) - convert symlinks -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'convert symlinks')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_SYMLINKS}" != "true" ] -then - exit 0 -fi - -Echo_message "Begin converting symlinks..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_symlinks - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Checking depends -Check_package chroot/usr/bin/symlinks symlinks - -# Installing depends -Install_package - -# Converting symlinks -Chroot chroot "symlinks -c -r -s /" - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .stage/chroot_symlinks diff --git a/helpers/lh_chroot_sysfs b/helpers/lh_chroot_sysfs deleted file mode 100755 index f6acb6478..000000000 --- a/helpers/lh_chroot_sysfs +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh - -# lh_chroot_sysfs(1) - mount /sys -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'mount /sys')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Ensure that a system is built as root -lh testroot - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -case "${1}" in - install) - Echo_message "Begin mounting /sys..." - - # Checking stage file - Check_stagefile .stage/chroot_sysfs - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LH_USE_FAKEROOT}" != "true" ] - then - # Create mountpoint - mkdir -p chroot/sys - - # Mounting /sys - ${LH_ROOT_COMMAND} mount sysfs-live -t sysfs chroot/sys - else - rm -rf chroot/sys - ln -s /sys chroot/ - fi - - # Creating stage file - Create_stagefile .stage/chroot_sysfs - ;; - - remove) - Echo_message "Begin unmounting /sys..." - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LH_USE_FAKEROOT}" != "true" ] - then - # Unmounting /sys - #fuser -km chroot/sys - if [ -e chroot/sys/class ] - then - ${LH_ROOT_COMMAND} umount chroot/sys - fi - else - rm -rf chroot/sys - mkdir -p chroot/sys - fi - - # Removing stage file - rm -f .stage/chroot_sysfs - ;; - - *) - Usage - ;; -esac diff --git a/helpers/lh_chroot_sysv-rc b/helpers/lh_chroot_sysv-rc deleted file mode 100755 index 74a9702f7..000000000 --- a/helpers/lh_chroot_sysv-rc +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh - -# lh_chroot_sysv-rc(1) - manage /usr/sbin/policy-rc.d -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'manage /usr/sbin/policy-rc.d')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /usr/sbin/policy-rc.d" - - # Checking stage file - Check_stagefile .stage/chroot_sysv-rc - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ -f chroot/usr/sbin/policy-rc.d ] - then - # Save policy-rc.d file - mv chroot/usr/sbin/policy-rc.d chroot/usr/sbin/policy-rc.d.orig - fi - - # Create policy-rc.d file -cat > chroot/usr/sbin/policy-rc.d << EOF -#!/bin/sh -echo "All runlevel operations denied by policy" >&2 -exit 101 -EOF - - chmod 0755 chroot/usr/sbin/policy-rc.d - - # Creating stage file - Create_stagefile .stage/chroot_sysv-rc - ;; - - remove) - Echo_message "Deconfiguring file /usr/sbin/policy-rc.d" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ -f chroot/usr/sbin/policy-rc.d.orig ] - then - # Restore policy-rc.d file - mv chroot/usr/sbin/policy-rc.d.orig chroot/usr/sbin/policy-rc.d - else - # Remove policy-rc.d file - rm -f chroot/usr/sbin/policy-rc.d - fi - - # Removing stage file - rm -f .stage/chroot_sysv-rc - ;; - - *) - Usage - ;; -esac diff --git a/helpers/lh_chroot_sysvinit b/helpers/lh_chroot_sysvinit deleted file mode 100755 index 7c8c98312..000000000 --- a/helpers/lh_chroot_sysvinit +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh - -# lh_chroot_sysvinit(1) - configure sysvinit -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'configure sysvinit')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Configuring package sysvinit" - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_sysvinit - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ "${LH_SYSVINIT}" = "true" ] -then - # Disable all - for FILE in chroot/etc/init.d/* - do - Chroot chroot "update-rc.d -f $(basename ${FILE}) remove" - done - - # Re-enable all required (taken from -f standard chroot) - for PACKAGE in ${LH_INITRAMFS} console-common cron dpkg ifupdown initscripts kbd klogd libc6 libdevmapper1.02 libselinux1 libsepol1 login makedev module-init-tools netbase openbsd-inetd procps sudo sysklogd udev util-linux - do - if [ -f chroot/var/lib/dpkg/info/${PACKAGE}.postinst ] - then - # Re-configure if existing - Chroot chroot "/var/lib/dpkg/info/${PACKAGE}.postinst configure" - fi - done - - # Creating stage file - Create_stagefile .stage/chroot_sysvinit -fi diff --git a/helpers/lh_chroot_tasks b/helpers/lh_chroot_tasks deleted file mode 100755 index ff8e60ae1..000000000 --- a/helpers/lh_chroot_tasks +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh - -# lh_chroot_tasks(1) - install tasks into chroot -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'install tasks into chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Echo_message "Begin installing tasks..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/chroot_tasks - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ -n "${LH_TASKS}" ] && [ "${LH_TASKS}" != "none" ] -then - # Restoring cache - Restore_cache cache/packages_chroot - - # Checking depends - case "${LH_TASKSEL}" in - aptitude) - Check_package chroot/usr/bin/aptitude aptitude - ;; - - tasksel) - Check_package chroot/usr/bin/tasksel tasksel - ;; - esac - - # Installing depends - Install_package - - # Installing tasks - case "${LH_TASKSEL}" in - aptitude) - Chroot chroot "aptitude ${APTITUDE_OPTIONS} install ${LH_TASKS}" - ;; - - tasksel) - for TASK in ${LH_TASKS} - do - Chroot chroot "tasksel --debconf-apt-progress --logstderr install ${TASK}" - done - ;; - esac - - # Removing depends - Remove_package - - # Saving cache - Save_cache cache/packages_chroot - - # Creating stage file - Create_stagefile .stage/chroot_tasks -fi diff --git a/helpers/lh_clean b/helpers/lh_clean deleted file mode 100755 index 8f7420930..000000000 --- a/helpers/lh_clean +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/sh - -# lh_clean(1) - clean up system build directories -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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 - -# Read meta config -if [ "${1}" != "noautoconfig" ] && [ -x auto/clean ] -then - ./auto/clean ${@} -fi - -if [ "${1}" = "noautoconfig" ] -then - shift -fi - -# Including common functions -. "${LH_BASE:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'clean up system build directories')" -HELP="" -USAGE="${PROGRAM} [--all] [--cache] [--chroot] [--binary] [--purge] [--remove] [--stage] [--source]" - -#Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Avoid cases were users accidentally nuke their config/binary -if [ ! -d config ] && [ "$(basename ${PWD})" = "config" ] -then - Echo_error "%s is not a good Debian Live working directory to clean." "${PWD}" - exit 1 -fi - -rm -f .lock - -if [ -z "${*}" ] -then - ARGUMENTS="--all" -else - ARGUMENTS="${@}" -fi - -for ARGUMENT in ${ARGUMENTS} -do - case "${ARGUMENT}" in - --all) - LH=1 "${0}" noautoconfig --chroot - LH=1 "${0}" noautoconfig --binary - LH=1 "${0}" noautoconfig --stage - LH=1 "${0}" noautoconfig --source - - if [ -d auto ] - then - rmdir --ignore-fail-on-non-empty auto - fi - ;; - - --cache) - ${LH_ROOT_COMMAND} rm -rf cache - ;; - - --chroot) - Echo_message "Cleaning chroot" - ${LH_ROOT_COMMAND} umount -f chroot/sys > /dev/null 2>&1 || true - ${LH_ROOT_COMMAND} umount -f chroot/proc/sys/fs/binfmt_misc > /dev/null 2>&1 || true - ${LH_ROOT_COMMAND} umount -f chroot/proc > /dev/null 2>&1 || true - ${LH_ROOT_COMMAND} umount -f chroot/lib/init/rw > /dev/null 2>&1 || true - ${LH_ROOT_COMMAND} umount -f chroot/dev/shm > /dev/null 2>&1 || true - ${LH_ROOT_COMMAND} umount -f chroot/dev/pts > /dev/null 2>&1 || true - ${LH_ROOT_COMMAND} umount -f chroot/dev > /dev/null 2>&1 || true - - ${LH_ROOT_COMMAND} umount -f chroot/binary.tmp > /dev/null 2>&1 || true - ${LH_ROOT_COMMAND} umount -f chroot/dev.tmp/pts > /dev/null 2>&1 || true - - ${LH_ROOT_COMMAND} rm -rf chroot chroot.tmp - - rm -f .stage/chroot* - ;; - - --binary) - ${LH_ROOT_COMMAND} umount -f binary.tmp > /dev/null 2>&1 || true - rm -rf binary.tmp binary.deb binary.udeb - rm -f binary.iso - rm -f binary*.img - rm -f binary*.tar.gz - rm -f binary.sh - rm -f binary.list binary.packages md5sum.txt - - rm -rf binary - rm -rf tftpboot - - rm -f .stage/binary* - ;; - - --remove) - LH=1 "${0}" --all - rm -rf cache/packages_* - ;; - - --purge) - LH=1 "${0}" --all - LH=1 "${0}" --cache - - if [ -e auto/config ] - then - rm -f .stage/config - fi - ;; - - --stage) - rm -rf .stage - ;; - - --source) - rm -f source.iso - rm -f source*.img - rm -f source*.tar - rm -f source*.tar.gz - rm -f source.list - rm -f source-selection.txt - - rm -rf source - - rm -f .stage/source* - ;; - - -h|--help) - Help - ;; - - -u|--usage) - Usage - ;; - - -v|--version) - Version - ;; - - *) - Usage - exit 1 - ;; - esac -done diff --git a/helpers/lh_config b/helpers/lh_config deleted file mode 100755 index 83a824263..000000000 --- a/helpers/lh_config +++ /dev/null @@ -1,1304 +0,0 @@ -#!/bin/sh - -# lh_config(1) - create configuration for live-helper(7) -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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 - -# Read meta config -if [ "${1}" != "noautoconfig" ] && [ -x auto/config ] -then - ./auto/config ${@} -fi - -if [ "${1}" = "noautoconfig" ] -then - shift -fi - -# Including common functions -. "${LH_BASE:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -SYSTEM_LH_CONFFILE="/etc/default/live-helper" -DESCRIPTION="$(Echo 'create configuration for live-helper(7)')" -USAGE="${PROGRAM} [--apt apt|aptitude]\n\ -\t [--apt-ftp-proxy URL]\n\ -\t [--apt-http-proxy URL]\n\ -\t [--apt-pdiffs true|false]\n\ -\t [--apt-options OPTION|\"OPTIONS\"]\n\ -\t [--aptitude-options OPTION|\"OPTIONS\"]\n\ -\t [--apt-pipeline FIXME]\n\ -\t [--apt-recommends true|false]\n\ -\t [--apt-secure true|false]\n\ -\t [-a|--architecture ARCHITECTURE]\n\ -\t [-b|--binary-images iso|net|tar|usb-hdd]\n\ -\t [--binary-filesystem fat16|fat32]\n\ -\t [--binary-indices true|false|none]\n\ -\t [--bootappend-install PARAMETER|\"PARAMETERS\"]\n\ -\t [--bootappend-live PARAMETER|\"PARAMETERS\"]\n\ -\t [--bootloader grub|syslinux|yaboot]\n\ -\t [--bootstrap cdebootstrap|cdebootstrap-static|debootstrap|copy]\n\ -\t [--bootstrap-config FILE]\n\ -\t [-f|--bootstrap-flavour minimal|standard]\n\ -\t [--bootstrap-keyring PACKAGE]\n\ -\t [--breakpoints]\n\ -\t [--cache true|false]\n\ -\t [--cache-indices true|false]\n\ -\t [--cache-packages true|false]\n\ -\t [--cache-stages STAGE|\"STAGES\"]\n\ -\t [--checksums true|false]\n\ -\t [--chroot-build true|false]\n\ -\t [--chroot-filesystem ext2|ext3|squashfs|plain|jffs2]\n\ -\t [-c|--conffile FILE]\n\ -\t [--clean\n\ -\t [--debconf-frontend dialog|editor|noninteractive|readline]\n\ -\t [--debconf-nowarnings true|false]\n\ -\t [--debconf-priority low|medium|high|critical]\n\ -\t [--debian-installer true|cdrom|netinst|netboot|businesscard|live|false]\n\ -\t [--debian-installer-distribution CODENAME|daily]\n\ -\t [--debian-installer-preseedfile FILE|URL]\n\ -\t [--debian-installer-gui true|false]\n\ -\t [--debug]\n\ -\t [-d|--distribution CODENAME]\n\ -\t [--dump]\n\ -\t [-e|--encryption false|aes128|aes192|aes256]\n\ -\t [--fdisk fdisk|fdisk.dist]\n\ -\t [--force]\n\ -\t [--genisoimage genisomage|mkisofs]\n\ -\t [--grub-splash FILE]\n\ -\t [--gzip-options OPTION|\"OPTIONS\"]\n\ -\t [--hooks FILE]\n\ -\t [--hostname NAME]\n\ -\t [--ignore-system-defaults]\n\ -\t [--includes PATH]\n\ -\t [--initramfs auto|live-initramfs|casper]\n\ -\t [--interactive shell]\n\ -\t [--iso-application NAME]\n\ -\t [--iso-preparer NAME]\n\ -\t [--iso-publisher NAME]\n\ -\t [--iso-volume NAME]\n\ -\t [--jffs2-eraseblock SIZE]\n\ -\t [--keyring-packages PACKAGE|\"PACKAGES\"]\n\ -\t [-l|--language LANGUAGE]\n\ -\t [-k|--linux-flavours FLAVOUR|\"FLAVOURS\"]\n\ -\t [--linux-packages \"PACKAGES\"]\n\ -\t [--losetup losetup|losetup.orig]\n\ -\t [--memtest memtest86+|memtest86]\n\ -\t [-m|--mirror-bootstrap URL]\n\ -\t [--mirror-chroot URL]\n\ -\t [--mirror-chroot-security URL]\n\ -\t [--mirror-binary URL]\n\ -\t [--mirror-binary-security URL]\n\ -\t [--mode debian|emdebian]\n\ -\t [--net-root-filesystem nfs|cfs]\n\ -\t [--net-root-mountoptions OPTIONS]\n\ -\t [--net-root-path PATH]\n\ -\t [--net-root-server IP|HOSTNAME]\n\ -\t [--net-cow-filesystem nfs|cfs]\n\ -\t [--net-cow-mountoptions OPTIONS]\n\ -\t [--net-cow-path PATH]\n\ -\t [--net-cow-server IP|HOSTNAME]\n\ -\t [--net-tarball bzip2|gzip|tar|none]\n\ -\t [-p|--packages-lists FILE]\n\ -\t [--packages PACKAGE|\"PACKAGES\"]\n\ -\t [--quiet]\n\ -\t [--root-command sudo]\n\ -\t [--use-fakeroot true|false]\n\ -\t [--archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\ -\t [--security true|false]\n\ -\t [--source true|false]\n\ -\t [-s|--source-images iso|net|tar|usb-hdd]\n\ -\t [--symlinks true|false]\n\ -\t [--syslinux-splash FILE]\n\ -\t [--syslinux-timeout SECONDS]\n\ -\t [--syslinux-menu true|false]\n\ -\t [--sysvinit true|false]\n\ -\t [--tasksel aptitude|tasksel]\n\ -\t [--tasks TASK]\n\ -\t [--templates PATH]\n\ -\t [--union-filesystem aufs|unionfs]\n\ -\t [--virtual-root-size MB]\n\ -\t [--exposed-root true|false]\n\ -\t [--username NAME]\n\ -\t [--verbose]\n\ -\t [--win32-loader true|false]" - -Local_arguments () -{ - LONG_OPTIONS="apt:,apt-ftp-proxy:,apt-http-proxy:,apt-pdiffs:,apt-options:,aptitute-options:, - apt-pipeline:,apt-recommends:,apt-secure:,bootstrap:,cache:,cache-indices:,cache-packages:, - cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,dump,genisoimage:, - initramfs:,fdisk:,losetup:,mode:,root-command:,use-fakeroot:,tasksel:,includes:, - templates:,architecture:,bootstrap-config:,bootstrap-flavour:,bootstrap-keyring:,clean, - distribution:,mirror-bootstrap:,mirror-chroot:,mirror-chroot-security:,mirror-binary:, - mirror-binary-security:,archive-areas:,chroot-filesystem:,union-filesystem:,exposed-root:,virtual-root-size:, - gzip-options:,hooks:,interactive:,keyring-packages:,language:,linux-flavours:,linux-packages:, - packages:,packages-lists:,tasks:,security:,symlinks:,sysvinit:,binary-filesystem:,binary-images:, - binary-indices:,bootappend-install:,bootappend-live:,bootloader:,checksums:,chroot-build:, - debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:, - encryption:,grub-splash:,hostname:,iso-application:,iso-preparer:,iso-publisher:, - iso-volume:,jffs2-eraseblock:,memtest:,net-root-filesystem:,net-root-mountoptions:, - net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:, - net-cow-server:,net-tarball:,syslinux-splash:,syslinux-timeout:,syslinux-menu:, - username:,win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force, - help,ignore-system-defaults,quiet,usage,verbose,version" - # Remove spaces added by indentation - LONG_OPTIONS="$(echo ${LONG_OPTIONS} | tr -d ' ')" - ARGUMENTS="$(getopt --longoptions ${LONG_OPTIONS} --name=${PROGRAM} --options a:f:d:m:l:k:p:b:e:s:c:huv --shell sh -- "${@}")" - - if [ "${?}" != "0" ] - then - Echo_error "terminating" >&2 - exit 1 - fi - - eval set -- "${ARGUMENTS}" - - while true - do - case "${1}" in - --dump) - # Dump version - if [ -x "$(which dpkg-query 2>/dev/null)" ] - then - VERSION_DPKG="$(dpkg-query -f='${Version}' --show live-helper)" - fi - - Echo "%s: This is live-helper version %s" "${0}" "${VERSION_DPKG:-${VERSION}}" - - # Dump conffile contents - Print_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source - - # Dump contents of directories that contain text files - for DIRECTORY in config/binary_local-packageslists config/chroot_local-packageslists config/chroot_apt config/chroot_local-patches config/chroot_local-preseed config/binary_rootfs - do - if Find_files "${DIRECTORY}" - then - Echo_file "${DIRECTORY}"/* - fi - done - - # Dump directory listings of all directories under config/ - for DIRECTORY in $(find config/ -mindepth 1 -maxdepth 1 -type d) - do - if Find_files "${DIRECTORY}" - then - ls -lR "${DIRECTORY}" | while read LINE - do - echo "${DIRECTORY}: ${LINE}" - done - fi - done - - exit 0 - ;; - - --clean) - # Remove empty directories in config tree - if ls config/*/ > /dev/null 2>&1 - then - rmdir --ignore-fail-on-non-empty config/*/ - fi - - if [ -d config ] - then - rmdir --ignore-fail-on-non-empty config - fi - - if [ -d auto/functions ] - then - rmdir --ignore-fail-on-non-empty auto/functions - fi - - if [ -d auto ] - then - rmdir --ignore-fail-on-non-empty auto - fi - - exit 0 - ;; - - # config/common - --apt) - LH_APT="${2}" - shift 2 - ;; - - --apt-ftp-proxy) - LH_APT_FTP_PROXY="${2}" - shift 2 - ;; - - --apt-http-proxy) - LH_APT_HTTP_PROXY="${2}" - shift 2 - ;; - - --apt-pdiffs) - LH_APT_PDIFFS="${2}" - shift 2 - ;; - --apt-options) - APT_OPTIONS="${2}" - shift 2 - ;; - - --aptitude-options) - LH_APTITUDE_OPTIONS="${2}" - shift 2 - ;; - - --apt-pipeline) - LH_APT_PIPELINE="${2}" - shift 2 - ;; - - --apt-recommends) - LH_APT_RECOMMENDS="${2}" - shift 2 - ;; - - --apt-secure) - LH_APT_SECURE="${2}" - shift 2 - ;; - - --bootstrap) - LH_BOOTSTRAP="${2}" - shift 2 - ;; - - --cache) - LH_CACHE="${2}" - shift 2 - ;; - - --cache-indices) - LH_CACHE_INDICES="${2}" - shift 2 - ;; - - --cache-packages) - LH_CACHE_PACKAGES="${2}" - shift 2 - ;; - - --cache-stages) - LH_CACHE_STAGES="${2}" - shift 2 - ;; - - --debconf-frontend) - LH_DEBCONF_FRONTEND="${2}" - shift 2 - ;; - - --debconf-nowarnings) - LH_DEBCONF_NOWARNINGS="${2}" - shift 2 - ;; - - --debconf-priority) - LH_DEBCONF_PRIORITY="${2}" - shift 2 - ;; - - --initramfs) - LH_INITRAMFS="${2}" - shift 2 - ;; - - --fdisk) - LH_FDISK="${2}" - shift 2 - ;; - - --losetup) - LH_LOSETUP="${2}" - shift 2 - ;; - - --mode) - LH_MODE="${2}" - shift 2 - ;; - - --root-command) - LH_ROOT_COMMAND="${2}" - shift 2 - ;; - - --use-fakeroot) - LH_USE_FAKEROOT="${2}" - shift 2 - ;; - - --tasksel) - LH_TASKSEL="${2}" - shift 2 - ;; - - --includes) - LH_INCLUDES="${2}" - shift 2 - ;; - - --templates) - LH_TEMPLATES="${2}" - shift 2 - ;; - - -v|--version) - Version - shift - ;; - - # config/bootstrap - -a|--architecture) - LH_ARCHITECTURE="${2}" - shift 2 - ;; - - --bootstrap-config) - LH_BOOTSTRAP_CONFIG="${2}" - shift 2 - ;; - - -f|--bootstrap-flavour) - LH_BOOTSTRAP_FLAVOUR="${2}" - shift 2 - ;; - - --bootstrap-keyring) - LH_BOOTSTRAP_KEYRING="${2}" - shift 2 - ;; - - -d|--distribution) - LH_DISTRIBUTION="${2}" - BACKPORTS="false" - shift 2 - - case "${LH_DISTRIBUTION}" in - lenny-backports) - LH_DISTRIBUTION="lenny" - BACKPORTS="true" - ;; - esac - ;; - - -m|--mirror-bootstrap) - LH_MIRROR_BOOTSTRAP="${2}" - shift 2 - ;; - - --mirror-chroot) - LH_MIRROR_CHROOT="${2}" - shift 2 - ;; - - --mirror-chroot-security) - LH_MIRROR_CHROOT_SECURITY="${2}" - shift 2 - ;; - - --mirror-binary) - LH_MIRROR_BINARY="${2}" - shift 2 - ;; - - --mirror-binary-security) - LH_MIRROR_BINARY_SECURITY="${2}" - shift 2 - ;; - - --archive-areas) - LH_ARCHIVE_AREAS="${2}" - shift 2 - ;; - - # config/chroot - --chroot-filesystem) - LH_CHROOT_FILESYSTEM="${2}" - shift 2 - ;; - - --union-filesystem) - LH_UNION_FILESYSTEM="${2}" - shift 2 - ;; - - --virtual-root-size) - LH_VIRTUAL_ROOT_SIZE="${2}" - shift 2 - ;; - - --exposed-root) - LH_EXPOSED_ROOT="${2}" - shift 2 - ;; - - --gzip-options) - GZIP_OPTIONS="${2}" - shift 2 - ;; - - --hooks) - LH_HOOKS="${2}" - shift 2 - ;; - - --interactive) - LH_INTERACTIVE="${2}" - shift 2 - ;; - - --keyring-packages) - LH_KEYRING_PACKAGES="${2}" - shift 2 - ;; - - -l|--language) - LH_LANGUAGE="${2}" - shift 2 - ;; - - -k|--linux-flavours) - LH_LINUX_FLAVOURS="${2}" - shift 2 - ;; - - --linux-packages) - LH_LINUX_PACKAGES="${2}" - shift 2 - ;; - - --packages) - LH_PACKAGES="${2}" - shift 2 - ;; - - -p|--packages-lists) - LH_PACKAGES_LISTS="${2}" - shift 2 - ;; - - --tasks) - LH_TASKS="${2}" - shift 2 - ;; - - --security) - LH_SECURITY="${2}" - shift 2 - ;; - - --symlinks) - LH_SYMLINKS="${2}" - shift 2 - ;; - - --sysvinit) - LH_SYSVINIT="${2}" - shift 2 - ;; - - # config/binary - --binary-filesystem) - LH_BINARY_FILESYSTEM="${2}" - shift 2 - ;; - - -b|--binary-images) - LH_BINARY_IMAGES="${2}" - shift 2 - ;; - - --binary-indices) - LH_BINARY_INDICES="${2}" - shift 2 - ;; - - --bootappend-live) - LH_BOOTAPPEND_LIVE="${2}" - shift 2 - ;; - - --bootappend-install) - LH_BOOTAPPEND_INSTALL="${2}" - shift 2 - ;; - - --bootloader) - LH_BOOTLOADER="${2}" - shift 2 - ;; - - --checksums) - LH_CHECKSUMS="${2}" - shift 2 - ;; - - --chroot-build) - LH_CHROOT_BUILD="${2}" - shift 2 - ;; - - --debian-installer) - LH_DEBIAN_INSTALLER="${2}" - shift 2 - ;; - - --debian-installer-distribution) - LH_DEBIAN_INSTALLER_DISTRIBUTION="${2}" - shift 2 - ;; - - --debian-installer-preseedfile) - LH_DEBIAN_INSTALLER_PRESEEDFILE="${2}" - shift 2 - ;; - - --debian-installer-gui) - LH_DEBIAN_INSTALLER_GUI="${2}" - shift 2 - ;; - - -e|--encryption) - LH_ENCRYPTION="${2}" - shift 2 - ;; - - --grub-splash) - LH_GRUB_SPLASH="${2}" - shift 2 - ;; - - --hostname) - LH_HOSTNAME="${2}" - shift 2 - ;; - - --iso-application) - LH_ISO_APPLICATION="${2}" - shift 2 - ;; - - --iso-preparer) - LH_ISO_PREPARER="${2}" - shift 2 - ;; - - --iso-publisher) - LH_ISO_PUBLISHER="${2}" - shift 2 - ;; - - --iso-volume) - LH_ISO_VOLUME="${2}" - shift 2 - ;; - - --jffs2-eraseblock) - LH_JFFS2_ERASEBLOCK="${2}" - shift 2 - ;; - - --memtest) - LH_MEMTEST="${2}" - shift 2 - ;; - - --net-root-filesystem) - LH_NET_ROOT_FILESYSTEM="${2}" - shift 2 - ;; - - --net-root-mountoptions) - LH_NET_ROOT_MOUNTOPTIONS="${2}" - shift 2 - ;; - - --net-root-path) - LH_NET_ROOT_PATH="${2}" - shift 2 - ;; - - --net-root-server) - LH_NET_ROOT_SERVER="${2}" - shift 2 - ;; - - --net-cow-filesystem) - LH_NET_COW_FILESYSTEM="${2}" - shift 2 - ;; - - --net-cow-mountoptions) - LH_NET_COW_MOUNTOPTIONS="${2}" - shift 2 - ;; - - --net-cow-path) - LH_NET_COW_PATH="${2}" - shift 2 - ;; - - --net-cow-server) - LH_NET_COW_SERVER="${2}" - shift 2 - ;; - - --net-tarball) - LH_NET_TARBALL="${2}" - shift 2 - ;; - - --syslinux-splash) - LH_SYSLINUX_SPLASH="${2}" - shift 2 - ;; - - --syslinux-timeout) - LH_SYSLINUX_TIMEOUT="${2}" - shift 2 - ;; - - --syslinux-menu) - LH_SYSLINUX_MENU="${2}" - shift 2 - ;; - - --username) - LH_USERNAME="${2}" - shift 2 - ;; - - --win32-loader) - LH_WIN32_LOADER="${2}" - shift 2 - ;; - - # config/source - --source) - LH_SOURCE="${2}" - shift 2 - ;; - - -s|--source-images) - LH_SOURCE_IMAGES="${2}" - shift 2 - ;; - - # other - --breakpoints) - _BREAKPOINTS="true" - shift - ;; - - -c|--conffile) - _CONFFILE="${2}" - shift 2 - ;; - - --color) - _COLOR="true" - shift - ;; - - --debug) - _DEBUG="true" - shift - ;; - - --force) - _FORCE="true" - shift - ;; - - -h|--help) - Help - shift - ;; - - --ignore-system-defaults) - shift - ;; - - --quiet) - _QUIET="true" - shift - ;; - - -u|--usage) - Usage - shift - ;; - - --verbose) - _VERBOSE="true" - shift - ;; - - -v|--version) - Version - shift - ;; - - --) - shift - break - ;; - - *) - Echo_error "internal error %s" "${0}" - exit 1 - ;; - esac - done -} - -# Reading system configuration -if [ -f "${SYSTEM_LH_CONFFILE}" ] && ! In_list "--ignore-system-defaults" "${@}" -then - Echo_message "Considering defaults defined in %s" "${SYSTEM_LH_CONFFILE}" - Read_conffiles "${SYSTEM_LH_CONFFILE}" -fi - -# Reading existing configuration -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source - -Local_arguments "${@}" - -if [ -n "${_CONFFILE}" ] -then - Read_conffiles "${_CONFFILE}" -fi - -# Setting defaults -Set_defaults - -# Checking defaults -Check_defaults - -if [ ! -e config ] -then - Echo_message "Creating config tree" -else - Echo_message "Updating config tree" -fi - -# Creating bootstrap configuration -mkdir -p config -mkdir -p config/includes -mkdir -p config/templates - -# Creating live-helper configuration -cat > config/common << EOF -# config/common - common options for live-helper(7) - -# LH_CONFIG_VERSION: internal version of the configuration file format -LH_CONFIG_VERSION="${CONFIG_VERSION}" - -# \$LH_APT: set package manager -# (Default: ${LH_APT}) -LH_APT="${LH_APT}" - -# \$LH_APT_FTP_PROXY: set apt/aptitude ftp proxy -# (Default: autodetected or empty) -LH_APT_FTP_PROXY="${LH_APT_FTP_PROXY}" - -# \$LH_APT_HTTP_PROXY: set apt/aptitude http proxy -# (Default: autodetected or empty) -LH_APT_HTTP_PROXY="${LH_APT_HTTP_PROXY}" - -# \$LH_APT_PDIFFS: set apt/aptitude pdiff indices -# (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}" - -# \$LH_APT_SECURE: set apt/aptitude security -# (Default: ${LH_APT_SECURE}) -LH_APT_SECURE="${LH_APT_SECURE}" - -# \$LH_BOOTSTRAP: set bootstrap program -# (Default: ${LH_BOOTSTRAP}) -LH_BOOTSTRAP="${LH_BOOTSTRAP}" - -# \$LH_CACHE: control cache -# (Default: ${LH_CACHE}) -LH_CACHE="${LH_CACHE}" - -# \$LH_CACHE_INDICES: control if downloaded package indices should be cached -# (Default: ${LH_CACHE_INDICES}) -LH_CACHE_INDICES="${LH_CACHE_INDICES}" - -# \$LH_CACHE_PACKAGES: control if downloaded packages files should be cached -# (Default: ${LH_CACHE_PACKAGES}) -LH_CACHE_PACKAGES="${LH_CACHE_PACKAGES}" - -# \$LH_CACHE_STAGES: control if completed stages should be cached -# (Default: ${LH_CACHE_STAGES}) -LH_CACHE_STAGES="${LH_CACHE_STAGES}" - -# \$LH_DEBCONF_FRONTEND: set debconf(1) frontend to use -# (Default: ${LH_DEBCONF_FRONTEND}) -LH_DEBCONF_FRONTEND="${LH_DEBCONF_FRONTEND}" - -# \$LH_DEBCONF_NOWARNINGS: set debconf(1) warnings -# (Default: ${LH_DEBCONF_NOWARNINGS}) -LH_DEBCONF_NOWARNINGS="${LH_DEBCONF_NOWARNINGS}" - -# \$LH_DEBCONF_PRIORITY: set debconf(1) priority to use -# (Default: ${LH_DEBCONF_PRIORITY}) -LH_DEBCONF_PRIORITY="${LH_DEBCONF_PRIORITY}" - -# \$LH_INITRAMFS: set initramfs hook -# (Default: ${LH_INITRAMFS}) -LH_INITRAMFS="${LH_INITRAMFS}" - -# \$LH_FDISK: set fdisk program -# (Default: autodetected) -LH_FDISK="${LH_FDISK}" - -# \$LH_LOSETUP: set losetup program -# (Default: autodetected) -LH_LOSETUP="${LH_LOSETUP}" - -# \$LH_MODE: set distribution mode -# (Default: ${LH_MODE}) -LH_MODE="${LH_MODE}" - -# \$LH_ROOT_COMMAND: use sudo or equivalent -# (Default: empty) -#LH_ROOT_COMMAND="sudo" - -# \$LH_USE_FAKEROOT: use fakeroot/fakechroot -# (Default: ${LH_USE_FAKEROOT}) -LH_USE_FAKEROOT="${LH_USE_FAKEROOT}" - -# \$LH_TASKSEL: set tasksel program -# (Default: ${LH_TASKSEL}) -LH_TASKSEL="${LH_TASKSEL}" - -# \$LH_INCLUDES: set includes -# (Default: ${LH_INCLUDES}) -LH_INCLUDES="${LH_INCLUDES}" - -# \$LH_TEMPLATES: set templates -# (Default: ${LH_TEMPLATES}) -LH_TEMPLATES="${LH_TEMPLATES}" - -# Live-helper options - -# \$_BREAKPOINTS: enable breakpoints -# (Default: ${_BREAKPOINTS}) -#_BREAKPOINTS="${_BREAKPOINTS}" - -# \$_DEBUG: enable debug -# (Default: ${_DEBUG}) -#_DEBUG="${_DEBUG}" - -# \$_COLOR: enable color -# (Default: ${_COLOR}) -#_COLOR="${_COLOR}" - -# \$_FORCE: enable force -# (Default: ${_FORCE}) -#_FORCE="${_FORCE}" - -# \$_QUIET: enable quiet -# (Default: ${_QUIET}) -_QUIET="${_QUIET}" - -# \$_VERBOSE: enable verbose -# (Default: ${_VERBOSE}) -#_VERBOSE="${_VERBOSE}" - -# Internal stuff (FIXME) -APT_OPTIONS="${APT_OPTIONS}" -APTITUDE_OPTIONS="${APTITUDE_OPTIONS}" -GZIP_OPTIONS="${GZIP_OPTIONS}" -EOF - -# Creating lh_bootstrap_* configuration -cat > config/bootstrap << EOF -# config/bootstrap - options for live-helper(7), bootstrap stage - -# \$LH_ARCHITECTURE: select chroot architecture -# (Default: autodetected) -LH_ARCHITECTURE="${LH_ARCHITECTURE}" - -# \$LH_BOOTSTRAP_CONFIG: set distribution config directory -# (Default: empty) -LH_BOOTSTRAP_CONFIG="${LH_BOOTSTRAP_CONFIG}" - -# \$LH_BOOTSTRAP_INCLUDE: include packages on base -# (Default: empty) -LH_BOOTSTRAP_INCLUDE="${LH_BOOTSTRAP_INCLUDE}" - -# \$LH_BOOTSTRAP_EXCLUDE: exclude packages on base -# (Default: empty) -LH_BOOTSTRAP_EXCLUDE="${LH_BOOTSTRAP_EXCLUDE}" - -# \$LH_BOOTSTRAP_FLAVOUR: select flavour to use -# (Default: empty) -LH_BOOTSTRAP_FLAVOUR="${LH_BOOTSTRAP_FLAVOUR}" - -# \$LH_BOOTSTRAP_KEYRING: set distribution keyring -# (Default: empty) -LH_BOOTSTRAP_KEYRING="${LH_BOOTSTRAP_KEYRING}" - -# \$LH_DISTRIBUTION: select distribution to use -# (Default: ${LH_DISTRIBUTION}) -LH_DISTRIBUTION="${LH_DISTRIBUTION}" - -# \$LH_MIRROR_BOOTSTRAP: set mirror to bootstrap from -# (Default: ${LH_MIRROR_BOOTSTRAP}) -LH_MIRROR_BOOTSTRAP="${LH_MIRROR_BOOTSTRAP}" - -# \$LH_MIRROR_CHROOT: set mirror to fetch packages from -# (Default: ${LH_MIRROR_CHROOT}) -LH_MIRROR_CHROOT="${LH_MIRROR_CHROOT}" - -# \$LH_MIRROR_CHROOT_SECURITY: set security mirror to fetch packages from -# (Default: ${LH_MIRROR_CHROOT_SECURITY}) -LH_MIRROR_CHROOT_SECURITY="${LH_MIRROR_CHROOT_SECURITY}" - -# \$LH_MIRROR_BINARY: set mirror which ends up in the image -# (Default: ${LH_MIRROR_BINARY}) -LH_MIRROR_BINARY="${LH_MIRROR_BINARY}" - -# \$LH_MIRROR_BINARY_SECURITY: set security mirror which ends up in the image -# (Default: ${LH_MIRROR_BINARY_SECURITY}) -LH_MIRROR_BINARY_SECURITY="${LH_MIRROR_BINARY_SECURITY}" - -# \$LH_ARCHIVE_AREAS: select archive areas to use -# (Default: ${LH_ARCHIVE_AREAS}) -LH_ARCHIVE_AREAS="${LH_ARCHIVE_AREAS}" -EOF - -# Creating lh_chroot_* configuration -mkdir -p config/chroot_apt -mkdir -p config/chroot_local-hooks -mkdir -p config/chroot_local-includes -mkdir -p config/chroot_local-patches -mkdir -p config/chroot_local-packages -mkdir -p config/chroot_local-packageslists -mkdir -p config/chroot_local-preseed -mkdir -p config/chroot_sources - -cat > config/chroot << EOF -# config/chroot - options for live-helper(7), chroot stage - -# \$LH_CHROOT_FILESYSTEM: set chroot filesystem -# (Default: ${LH_CHROOT_FILESYSTEM}) -LH_CHROOT_FILESYSTEM="${LH_CHROOT_FILESYSTEM}" - -# \$LH_UNION_FILESYSTEM: set union filesystem -# (Default: ${LH_UNION_FILESYSTEM}) -LH_UNION_FILESYSTEM="${LH_UNION_FILESYSTEM}" - -# \$LH_VIRTUAL_ROOT_SIZE: set virtual-hdd filesystem size -# (Default: ${LH_VIRTUAL_ROOT_SIZE}) -LH_VIRTUAL_ROOT_SIZE="${LH_VIRTUAL_ROOT_SIZE}" - -# \$LH_EXPOSED_ROOT: expose root as read only -# (Default: ${LH_EXPOSED_ROOT}) -LH_EXPOSED_ROOT="${LH_EXPOSED_ROOT}" - -# \$LH_HOOKS: set hook commands -# (Default: empty) -LH_HOOKS="${LH_HOOKS}" - -# \$LH_INTERACTIVE: set interactive build -# (Default: ${LH_INTERACTIVE}) -LH_INTERACTIVE="${LH_INTERACTIVE}" - -# \$LH_KEYRING_PACKAGES: set keyring packages -# (Default: empty) -LH_KEYRING_PACKAGES="${LH_KEYRING_PACKAGES}" - -# \$LH_LANGUAGE: set language to use -# (Default: empty) -LH_LANGUAGE="${LH_LANGUAGE}" - -# \$LH_LINUX_FLAVOURS: set kernel flavour to use -# (Default: autodetected) -LH_LINUX_FLAVOURS="${LH_LINUX_FLAVOURS}" - -# \$LH_LINUX_PACKAGES: set kernel packages to use -# (Default: autodetected) -LH_LINUX_PACKAGES="${LH_LINUX_PACKAGES}" - -# \$LH_PACKAGES: set packages to install -# (Default: empty) -LH_PACKAGES="${LH_PACKAGES}" - -# \$LH_PACKAGES_LISTS: set package list to install -# (Default: ${LH_PACKAGES_LISTS}) -LH_PACKAGES_LISTS="${LH_PACKAGES_LISTS}" - -# \$LH_TASKS: set tasks to install -# (Default: empty) -LH_TASKS="${LH_TASKS}" - -# \$LH_SECURITY: enable security updates -# (Default: ${LH_SECURITY}) -LH_SECURITY="${LH_SECURITY}" - -# \$LH_SYMLINKS: enable symlink convertion -# (Default: ${LH_SYMLINKS}) -LH_SYMLINKS="${LH_SYMLINKS}" - -# \$LH_SYSVINIT: enable sysvinit -# (Default: ${LH_SYSVINIT}) -LH_SYSVINIT="${LH_SYSVINIT}" -EOF - -# Creating lh_binary_* configuration -mkdir -p config/binary_debian-installer -mkdir -p config/binary_debian-installer-includes -mkdir -p config/binary_grub -mkdir -p config/binary_local-debs -mkdir -p config/binary_local-hooks -mkdir -p config/binary_local-includes -mkdir -p config/binary_local-packageslists -mkdir -p config/binary_local-udebs -mkdir -p config/binary_rootfs -mkdir -p config/binary_syslinux - -cat > config/binary << EOF -# config/binary - options for live-helper(7), binary stage - -# \$LH_BINARY_FILESYSTEM: set image filesystem -# (Default: ${LH_BINARY_FILESYSTEM}) -LH_BINARY_FILESYSTEM="${LH_BINARY_FILESYSTEM}" - -# \$LH_BINARY_IMAGES: set image type -# (Default: ${LH_BINARY_IMAGES}) -LH_BINARY_IMAGES="${LH_BINARY_IMAGES}" - -# \$LH_BINARY_INDICES: set apt/aptitude generic indices -# (Default: ${LH_BINARY_INDICES}) -LH_BINARY_INDICES="${LH_BINARY_INDICES}" - -# \$LH_BOOTAPPEND_LIVE: set boot parameters -# (Default: empty) -LH_BOOTAPPEND_LIVE="${LH_BOOTAPPEND_LIVE}" - -# \$LH_BOOTAPPEND_INSTALL: set boot parameters -# (Default: empty) -LH_BOOTAPPEND_INSTALL="${LH_BOOTAPPEND_INSTALL}" - -# \$LH_BOOTLOADER: set bootloader -# (Default: ${LH_BOOTLOADER}) -LH_BOOTLOADER="${LH_BOOTLOADER}" - -# \$LH_CHECKSUMS: set checksums -# (Default: ${LH_CHECKSUMS}) -LH_CHECKSUMS="${LH_CHECKSUMS}" - -# \${LH_CHROOT_BUILD: control if we build binary images chrooted -# (Default: ${LH_CHROOT_BUILD}) -# DO NEVER, *NEVER*, *N*E*V*E*R* SET THIS OPTION to false. -LH_CHROOT_BUILD="${LH_CHROOT_BUILD}" - -# \$LH_DEBIAN_INSTALLER: set debian-installer -# (Default: ${LH_DEBIAN_INSTALLER}) -LH_DEBIAN_INSTALLER="${LH_DEBIAN_INSTALLER}" - -# \$LH_DEBIAN_INSTALLER_DISTRIBUTION: set debian-installer suite -# (Default: empty) -LH_DEBIAN_INSTALLER_DISTRIBUTION="${LH_DEBIAN_INSTALLER_DISTRIBUTION}" - -# \$LH_DEBIAN_INSTALLER_PRESEEDFILE: set debian-installer preseed filename/url -# (Default: ${LH_DEBIAN_INSTALLER_PRESEEDFILE}) -LH_DEBIAN_INSTALLER_PRESEEDFILE="${LH_DEBIAN_INSTALLER_PRESEEDFILE}" - -# \$LH_DEBIAN_INSTALLER_GUI: toggle use of GUI debian-installer -# (Default: ${LH_DEBIAN_INSTALLER_GUI}) -LH_DEBIAN_INSTALLER_GUI="${LH_DEBIAN_INSTALLER_GUI}" - -# \$LH_ENCRYPTION: set encryption -# (Default: ${LH_ENCRYPTION}) -LH_ENCRYPTION="${LH_ENCRYPTION}" - -# \$LH_GRUB_SPLASH: set custom grub splash -# (Default: empty) -LH_GRUB_SPLASH="${LH_GRUB_SPLASH}" - -# \$LH_HOSTNAME: set hostname -# (Default: ${LH_HOSTNAME}) -LH_HOSTNAME="${LH_HOSTNAME}" - -# \$LH_ISO_APPLICATION: set iso author -# (Default: ${LH_ISO_APPLICATION}) -LH_ISO_APPLICATION="${LH_ISO_APPLICATION}" - -# \$LH_ISO_PREPARER: set iso preparer -# (Default: ${LH_ISO_PREPARER}) -LH_ISO_PREPARER="${LH_ISO_PREPARER}" - -# \$LH_ISO_PUBLISHER: set iso publisher -# (Default: ${LH_ISO_PUBLISHER}) -LH_ISO_PUBLISHER="${LH_ISO_PUBLISHER}" - -# \$LH_ISO_VOLUME: set iso volume (max 32 chars) -# (Default: ${LH_ISO_VOLUME}) -LH_ISO_VOLUME="${LH_ISO_VOLUME}" - -# \$LH_JFFS2_ERASEBLOCK: set jffs2 eraseblock size -# (Default: unset) -LH_JFFS2_ERASEBLOCK="" - -# \$LH_MEMTEST: set memtest -# (Default: ${LH_MEMTEST}) -LH_MEMTEST="${LH_MEMTEST}" - -# \$LH_WIN32_LOADER: set win32-loader -# (Default: ${LH_WIN32_LOADER}) -LH_WIN32_LOADER="${LH_WIN32_LOADER}" - -# \$LH_NET_ROOT_FILESYSTEM: set netboot filesystem -# (Default: ${LH_NET_ROOT_FILESYSTEM}) -LH_NET_ROOT_FILESYSTEM="${LH_NET_ROOT_FILESYSTEM}" - -# \$LH_NET_ROOT_MOUNTOPTIONS: set nfsopts -# (Default: empty) -LH_NET_ROOT_MOUNTOPTIONS="${LH_NET_ROOT_MOUNTOPTIONS}" - -# \$LH_NET_ROOT_PATH: set netboot server directory -# (Default: ${LH_NET_ROOT_PATH}) -LH_NET_ROOT_PATH="${LH_NET_ROOT_PATH}" - -# \$LH_NET_ROOT_SERVER: set netboot server address -# (Default: ${LH_NET_ROOT_SERVER}) -LH_NET_ROOT_SERVER="${LH_NET_ROOT_SERVER}" - -# \$LH_NET_COW_FILESYSTEM: set net client cow filesystem -# (Default: ${LH_NET_COW_FILESYSTEM}) -LH_NET_COW_FILESYSTEM="${LH_NET_COW_FILESYSTEM}" - -# \$LH_NET_COW_MOUNTOPTIONS: set cow mount options -# (Default: empty) -LH_NET_COW_MOUNTOPTIONS="${LH_NET_COW_MOUNTOPTIONS}" - -# \$LH_NET_COW_PATH: set cow directory -# (Default: ${LH_NET_COW_PATH}) -LH_NET_COW_PATH="${LH_NET_COW_PATH}" - -# \$LH_NET_COW_SERVER: set cow server -# (Default: ${LH_NET_COW_SERVER}) -LH_NET_COW_SERVER="${LH_NET_COW_SERVER}" - -# \$LH_NET_TARBALL: set net tarball -# (Default: ${LH_NET_TARBALL}) -LH_NET_TARBALL="${LH_NET_TARBALL}" - -# \$LH_SYSLINUX_SPLASH: set custom syslinux splash -# (Default: empty) -LH_SYSLINUX_SPLASH="${LH_SYSLINUX_SPLASH}" - -# \$LH_SYSLINUX_TIMEOUT: set custom syslinux timeout in seconds -# (Default: 0) -LH_SYSLINUX_TIMEOUT="${LH_SYSLINUX_TIMEOUT}" - -# \$LH_SYSLINUX_CFG: set custom syslinux configuration file -# (Default: empty) -LH_SYSLINUX_CFG="${LH_SYSLINUX_CFG}" - -# \$LH_SYSLINUX_MENU: set syslinux menu -# (Default: ${LH_SYSLINUX_MENU}) -LH_SYSLINUX_MENU="${LH_SYSLINUX_MENU}" - -# \$LH_SYSLINUX_MENU_LIVE_ENTRY: set text to be used on the menu for live entries -# (Default: ${LH_SYSLINUX_MENU_LIVE_ENTRY}) -LH_SYSLINUX_MENU_LIVE_ENTRY="${LH_SYSLINUX_MENU_LIVE_ENTRY}" - -# \$LH_SYSLINUX_MENU_LIVE_FAILSAFE_ENTRY: set text to be used on the menu for live entries (failsafe ones) -# (Default: ${LH_SYSLINUX_MENU_LIVE_FAILSAFE_ENTRY}) -LH_SYSLINUX_MENU_LIVE_FAILSAFE_ENTRY="${LH_SYSLINUX_MENU_LIVE_FAILSAFE_ENTRY}" - -# \$LH_SYSLINUX_MENU_MEMTEST_ENTRY: set text to be used on the menu for memtest entry -# (Default: ${LH_SYSLINUX_MENU_MEMTEST_ENTRY}) -LH_SYSLINUX_MENU_MEMTEST_ENTRY="${LH_SYSLINUX_MENU_MEMTEST_ENTRY}" - -# \$LH_USERNAME: set username -# (Default: ${LH_USERNAME}) -LH_USERNAME="${LH_USERNAME}" -EOF - -# Creating lh_source_* configuration -cat > config/source << EOF -# config/source - options for live-helper(7), source stage - -# \$LH_SOURCE: set source option -# (Default: ${LH_SOURCE}) -LH_SOURCE="${LH_SOURCE}" - -# \$LH_SOURCE_IMAGES: set image type -# (Default: ${LH_SOURCE_IMAGES}) -LH_SOURCE_IMAGES="${LH_SOURCE_IMAGES}" -EOF - -mkdir -p auto/functions - -if [ "${CONFIG}" = "clone" ] # FIXME -then - # Read package selection - echo $(dpkg --get-selections | awk '{ print $1 }') > config/chroot_local-packageslists/local-system - LH_PACKAGES_LISTS="${LH_PACKAGES_LISTS} local-system" - - # Read debconf questions - if [ ! -f /usr/bin/debconf-get-selections ] - then - Echo_warning "Please install 'debconf-utils' in order to use this feature." - else - debconf-get-selections | grep -v deinstall | cut -f1 > config/chroot_local-preseed/local-system - fi -fi - -if [ "${BACKPORTS}" = "true" ] -then - # Adding sources.list entry - -cat > config/chroot_sources/${LH_DISTRIBUTION}-backports.chroot << EOF -# Backports Maintainers -deb http://backports.debian-maintainers.org/ ${LH_DISTRIBUTION}/backports main contrib non-free -deb-src http://backports.debian-maintainers.org/ ${LH_DISTRIBUTION}/backports main contrib non-free -EOF - - cp config/chroot_sources/${LH_DISTRIBUTION}-backports.chroot config/chroot_sources/${LH_DISTRIBUTION}-backports.binary - - # Adding apt preferences - if ! grep -qs "^Pin: release o=backports.debian-maintainerns.org" config/chroot_apt/preferences - then - -cat >> config/chroot_apt/preferences << EOF -Package: * -Pin: release o=backports.debian-maintainerns.org -Pin-Priority: 999 -EOF - - fi - - # Addding archive signing key - wget -q http://backports.debian-maintainers.org/project/openpgp/archive-key.asc -O config/chroot_sources/${LH_DISTRIBUTION}-backports.chroot.gpg - cp config/chroot_sources/${LH_DISTRIBUTION}-backports.chroot.gpg config/chroot_sources/${LH_DISTRIBUTION}-backports.binary.gpg -fi - -# Creating stage file -Create_stagefile .stage/config diff --git a/helpers/lh_local b/helpers/lh_local deleted file mode 100755 index 16e228e8a..000000000 --- a/helpers/lh_local +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# lh_local(1) - use a local live-helper version -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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. - -LH_BASE="${PWD}/live-helper" -PATH="${LH_BASE}/helpers:${PATH}" - -export LH_BASE PATH - -if [ ! -z "${1}" ] -then - exec lh "${@}" -fi diff --git a/helpers/lh_source b/helpers/lh_source deleted file mode 100755 index 8d11c443b..000000000 --- a/helpers/lh_source +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh - -# lh_source(1) - build source images -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build source images')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -Require_stagefile .stage/chroot_install-packages - -# Setup cleanup function -Setup_cleanup - -# Enabling network in chroot -lh chroot_hosts install ${*} -lh chroot_resolv install ${*} -lh chroot_hostname install ${*} -lh chroot_sources install ${*} - -# Preparing images -lh source_debian-live ${*} -lh source_debian ${*} -lh source_disk ${*} -lh source_md5sum ${*} - -# Building images -lh source_iso ${*} -lh source_net ${*} -lh source_tar ${*} -lh source_usb-hdd ${*} -lh source_virtual-hdd ${*} - -# Deconfiguring chroot -rm -f .stage/chroot_sources -lh chroot_hostname remove ${*} -lh chroot_resolv remove ${*} -lh chroot_hosts remove ${*} diff --git a/helpers/lh_source_debian b/helpers/lh_source_debian deleted file mode 100755 index 266894852..000000000 --- a/helpers/lh_source_debian +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/sh - -# lh_source_debian(1) - download sources -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'debian sources')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_SOURCE}" != "true" ] -then - exit 0 -fi - -Echo_message "Begin downloading sources..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/source_debian - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Remove old sources -if [ -d source/debian ] -then - rm -rf source/debian -fi - -# Download sources -Chroot chroot "dpkg --get-selections" | awk '{ print $1 }' > source-selection.txt - -cat >> source-selection.txt << EOF -${LH_BOOTLOADER} -live-helper -${LH_INITRAMFS} -dosfstools -genisoimage -parted -squashfs-tools -genext2fs -mtd-tools -EOF - -case "${LH_ARCHITECTURE}" in - amd64|i386) - -cat >> source-selection.txt << EOF -mtools -syslinux -grub -EOF - - if [ "${LH_MEMTEST}" != "false" ] && [ "${LH_MEMTEST}" != "none" ] - then - echo "${LH_MEMTEST}" >> source-selection.txt - fi - ;; - - powerpc) - echo "yaboot" >> source-selection.txt - ;; - - sparc) - -cat >> source-selection.txt << EOF -silo -sparc-utils -EOF - - ;; -esac - -if [ -n "${LH_TASKS}" ] -then - echo "${LH_TASKSEL}" >> source-selection.txt -fi - -MISSING="" - -grep . source-selection.txt | \ -while read PACKAGE -do - if ! Chroot chroot "apt-get ${APT_OPTIONS} --download-only source ${PACKAGE}" - then - MISSING="${MISSING} ${PACKAGE}" - fi -done - -if [ -n "${MISSING}" ] -then - cat > source/missing-source.txt << EOF -This file contains the list of binary packages that are installed on this live -system that do not have a corresponding source package. - -EOF - - for PACKAGE in ${MISSING} - do - Chroot chroot "dpkg -l ${PACKAGE}" | tail -n1 >> source/missing-source.txt - done -fi - -rm -f source-selection.txt - -# Sort sources -for DSC in chroot/*.dsc -do - SOURCE="$(sed -n 's|^Source: ||p' ${DSC} 2>/dev/null || :)" - # The sed may fail if multiple dsc files exist for same source, as the - # first one to match will have already been moved. - [ -n "$SOURCE" ] || continue - - case "${SOURCE}" in - lib?*) - LETTER="$(echo ${SOURCE} | sed 's|\(....\).*|\1|')" - ;; - - *) - LETTER="$(echo ${SOURCE} | sed 's|\(.\).*|\1|')" - ;; - esac - - # Install directory - mkdir -p source/debian/"${LETTER}"/"${SOURCE}" - - # Move files - mv chroot/"${SOURCE}"_* source/debian/"${LETTER}"/"${SOURCE}" -done - -# Creating stage file -Create_stagefile .stage/source_debian diff --git a/helpers/lh_source_debian-live b/helpers/lh_source_debian-live deleted file mode 100755 index 10ba58050..000000000 --- a/helpers/lh_source_debian-live +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/sh - -# lh_source_debian-live(1) - copy debian-live config into source -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'copy debian-live config into source')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_SOURCE}" != "true" ] -then - exit 0 -fi - -Echo_message "Begin copying live-helper configuration..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/source_debian-live - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Remove old sources -if [ -d source/debian-live ] -then - rm -rf source/debian-live -fi - -# Copy system configuration -mkdir -p source/debian-live -cp -a config source/debian-live - -if Find_files auto/* -then - cp -a auto source/debian-live -fi - -# Create tarball -cd source - -SUFFIX="$(date +%Y%m%d.%s)" - -tar cf debian-live-config_${SUFFIX}.tar debian-live -gzip ${GZIP_OPTIONS} debian-live-config_${SUFFIX}.tar - -cd "${OLDPWD}" - -rm -rf source/debian-live/config -mv source/debian-live-config_${SUFFIX}.tar.gz source/debian-live - -# Creating stage file -Create_stagefile .stage/source_debian-live diff --git a/helpers/lh_source_disk b/helpers/lh_source_disk deleted file mode 100755 index a765bb47a..000000000 --- a/helpers/lh_source_disk +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh - -# lh_source_disk (1) - install disk information into source -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'install disk information into source')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_SOURCE_IMAGES}" != "iso" ] -then - exit 0 -fi - -Echo_message "Begin installing disk information..." - -# Requiring stage file -Require_stagefile .stage/config .stage/bootstrap - -# Checking stage file -Check_stagefile .stage/source_disk - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -mkdir -p source/.disk - -TITLE="Debian GNU/Linux" -DISTRIBUTION="$(echo ${LH_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')" -DISTRIBUTION="${DISTRIBUTION}$(echo ${LH_DISTRIBUTION} | cut -b 2-)" -eval VERSION="$`echo RELEASE_${LH_DISTRIBUTION}`" - -case "${LH_MODE}" in - debian) - STRING="Official Snapshot ${ARCHITECTURE}" - TRACE="project/trace/ftp-master.debian.org" - ;; - - debian-release) - STRING="Official ${ARCHITECTURE}" - TRACE="project/trace/ftp-master.debian.org" - ;; - - ubuntu) - TITLE="Ubuntu GNU/Linux" - STRING="Build ${ARCHITECTURE}" - TRACE="" - ;; - - *) - STRING="Snapshot ${ARCHITECTURE}" - TRACE="" - ;; -esac - -if [ -n "${TRACE}" ] -then - echo "$(wget -q ${LH_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \ - > source/.disk/archive_trace -fi - -case "${LH_DEBIAN_INSTALLER}" in - cdrom) - echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/CD Source $(date +%Y%m%d-%H:%M)" > source/.disk/info - ;; - - true|netinst) - echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/NETINST Source $(date +%Y%m%d-%H:%M)" > source/.disk/info - ;; - - live) - echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/INSTALL Source $(date +%Y%m%d-%H:%M)" > source/.disk/info - ;; - - businesscard) - echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/BC Source $(date +%Y%m%d-%H:%M)" > source/.disk/info - ;; - - false) - echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE Source $(date +%Y%m%d-%H:%M)" > source/.disk/info - ;; -esac - -# Creating stage file -Create_stagefile .stage/source_disk diff --git a/helpers/lh_source_iso b/helpers/lh_source_iso deleted file mode 100755 index 0ef1bcbec..000000000 --- a/helpers/lh_source_iso +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/sh - -# lh_source_iso(1) - build iso source image -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build iso source image')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_SOURCE}" != "true" ] -then - exit 0 -fi - -if ! In_list iso "${LH_SOURCE_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building source iso image..." - -# Requiring stage file -Require_stagefile .stage/config .stage/source_debian - -# Checking stage file -Check_stagefile .stage/source_iso - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Checking depends -Check_package chroot/usr/bin/genisoimage genisoimage - -# Installing depends -Install_package - -# Remove old iso image -if [ -f source.iso ] -then - rm -f source.iso -fi - -if [ "${_QUIET}" = "true" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -quiet" -fi - -if [ "${_VERBOSE}" = "true" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v" -fi - -if [ -n "${LH_ISO_APPLICATION}" ] && [ "${LH_ISO_APPLICATION}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LH_ISO_APPLICATION}\"" -fi - -if [ -n "${LH_ISO_PREPARER}" ] && [ "${LH_ISO_PREPARER}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LH_ISO_PREPARER}\"" -fi - -if [ -n "${LH_ISO_PUBLISHER}" ] && [ "${LH_ISO_PUBLISHER}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LH_ISO_PUBLISHER}\"" -fi - -if [ -n "${LH_ISO_VOLUME}" ] && [ "${LH_ISO_VOLUME}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LH_ISO_VOLUME}\"" -fi - -# Moving image -mv source chroot - -cat >> chroot/source.sh << EOF -genisoimage ${GENISOIMAGE_OPTIONS} -o source.iso -r -J -l -cache-inodes source -EOF - -Chroot chroot "sh source.sh" - -# Move image -mv chroot/source chroot/source.iso ./ -rm -f chroot/source.sh - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .stage/source_iso diff --git a/helpers/lh_source_md5sum b/helpers/lh_source_md5sum deleted file mode 100755 index 0034bfd91..000000000 --- a/helpers/lh_source_md5sum +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh - -# lh_source_md5sum(1) - create source md5sums -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'create source md5sums')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_SOURCE}" != "true" ] -then - exit 0 -fi - -if [ "${LH_CHECKSUMS}" != "true" ] -then - exit 0 -fi - -Echo_message "Begin creating source md5sum.txt..." - -# Requiring stage file -Require_stagefile .stage/config .stage/source_debian - -# Checking stage file -Check_stagefile .stage/source_md5sum - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Remove old md5sums -if [ -f source/md5sum.txt ] -then - rm -f source/md5sum.txt -fi - -# Calculating md5sums -cd source -find . -type f -print0 | sort -z | xargs -0 md5sum > ../md5sum.txt - -cat > md5sum.txt << EOF -This file contains the list of md5 checksums of all files on this medium. - -You can verify them automatically with the 'integrity-check' boot parameter, -or, manually with: 'md5sum -c md5sum.txt'. - - -EOF - -cat ../md5sum.txt >> md5sum.txt -rm -f ../md5sum.txt - -# File list -find . | sed -e 's|^.||g' | grep "^/" | sort > ../source.list - -cd "${OLDPWD}" - -# Creating stage file -Create_stagefile .stage/source_md5sum diff --git a/helpers/lh_source_net b/helpers/lh_source_net deleted file mode 100755 index 1c1b946b9..000000000 --- a/helpers/lh_source_net +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh - -# lh_source_net(1) - build source net image -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build source net image')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_SOURCE}" != "true" ] -then - exit 0 -fi - -if ! In_list net "${LH_SOURCE_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building source netboot image..." - -# Requiring stage file -Require_stagefile .stage/config .stage/source_debian - -# Checking stage file -Check_stagefile .stage/source_net - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Remove old source -if [ -f source-net.tar.gz ] -then - rm -f source-net.tar.gz -fi - -# Create tarball -tar cf source-net.tar source -gzip ${GZIP_OPTIONS} source-net.tar - -# Creating stage file -Create_stagefile .stage/source_net diff --git a/helpers/lh_source_tar b/helpers/lh_source_tar deleted file mode 100755 index 4923b710a..000000000 --- a/helpers/lh_source_tar +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - -# lh_source_tar(1) - build source tarball -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build source tarball')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_SOURCE}" != "true" ] -then - exit 0 -fi - -if ! In_list tar "${LH_SOURCE_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building source tarball..." -Echo_message "This may take a while." - -# Requiring stage file -Require_stagefile .stage/config .stage/source_debian - -# Checking stage file -Check_stagefile .stage/source_tar - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Remove old source -if [ -f source.tar.gz ] -then - rm -f source.tar.gz -fi - -# Create tarball -tar cf source.tar source -gzip ${GZIP_OPTIONS} source.tar - -# Creating stage file -Create_stagefile .stage/source_tar diff --git a/helpers/lh_source_usb-hdd b/helpers/lh_source_usb-hdd deleted file mode 100755 index e8cd8caeb..000000000 --- a/helpers/lh_source_usb-hdd +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/sh - -# lh_source_usb-hdd(1) - build source usb-hdd image -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build source image')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_SOURCE}" != "true" ] -then - exit 0 -fi - -if ! In_list usb-hdd "${LH_SOURCE_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building source usb-hdd image..." - -# Requiring stage file -Require_stagefile .stage/config .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="$(Calculate_partition_size ${DU_DIM} ${LH_BINARY_FILESYSTEM})" -dd if=/dev/zero of=source.img bs=1024k count=0 seek=${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 - -case "${LH_BINARY_FILESYSTEM}" in - ext2|ext3) - PARTITION_TYPE="ext2" - ;; - - fat16|fat32) - PARTITION_TYPE="${LH_BINARY_FILESYSTEM}" - ;; - - *) - Echo_error "Unsupported binary filesystem %s" "${LH_BINARY_FILESYSTEM}" - exit 1 - ;; -esac - -Echo_warning "!!! The following error/warning messages can be ignored !!!" -Losetup $FREELO source.img 0 -Chroot chroot "parted -s ${FREELO} mklabel msdos" || true -Chroot chroot "parted -s ${FREELO} mkpart primary ${PARTITION_TYPE} 0.0 100%" || true -Chroot chroot "parted -s ${FREELO} set 1 lba off" || true -sleep 1 -${LH_LOSETUP} -d ${FREELO} - -Losetup $FREELO source.img 1 - -case "${LH_BINARY_FILESYSTEM}" in - ext2|ext3) - MKFS="${LH_BINARY_FILESYSTEM}" - MKFS_OPTIONS="-L DEBIAN_LIVE -m 0" - ;; - - fat16) - MKFS="vfat" - MKFS_OPTIONS="-F 16 -n DEBIAN_LIVE" - ;; - - fat32) - MKFS="vfat" - MKFS_OPTIONS="-F 32 -n DEBIAN_LIVE" - ;; -esac - -Chroot chroot "mkfs.${MKFS} ${MKFS_OPTIONS} ${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 -sleep 1 -${LH_LOSETUP} -d ${FREELO} -Echo_warning "!!! The above error/warning messages can be ignored !!!" - -if [ -n "${MAKEDEV}" ] -then - rm -rf 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_source_virtual-hdd b/helpers/lh_source_virtual-hdd deleted file mode 100755 index ac186dc11..000000000 --- a/helpers/lh_source_virtual-hdd +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/sh - -# lh_source_virtual-hdd(1) - build source virtual-hdd image -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build source image')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -if [ "${LH_SOURCE}" != "true" ] -then - exit 0 -fi - -if ! In_list virtual-hdd "${LH_SOURCE_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building source virtual-hdd image..." - -# Requiring stage file -Require_stagefile .stage/config .stage/source_debian - -# Checking stage file -Check_stagefile .stage/source_virtual-hdd - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ "${LH_CHROOT_BUILD}" = "true" ] -then - case "${LH_BINARY_FILESYSTEM}" in - ext2|ext3) - Check_package chroot/sbin/mkfs.ext2 e2fsprogs - ;; - esac -fi - -# Installing depends -Install_package - -# Remove old source -if [ -f source-virtual.img ] -then - rm -f source-virtual.img -fi - -# Everything which comes here needs to be cleaned up, -DU_DIM="$(du -ms source | cut -f1)" -REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LH_BINARY_FILESYSTEM})" -dd if=/dev/zero of=source-virtual.img bs=1024k count=0 seek=${REAL_DIM} - -if [ "${LH_CHROOT_BUILD}" = "true" ] -then - mv source-virtual.img chroot - - case "${LH_BINARY_FILESYSTEM}" in - ext2) - Chroot chroot "mkfs.ext2 -F -m 0 source-virtual.img" - ;; - - ext3) - Chroot chroot "mkfs.ext3 -F source-virtual.img" - ;; - esac - - mv chroot/source-virtual.img ./ -else - case "${LH_BINARY_FILESYSTEM}" in - ext2) - mkfs.ext2 -F -m 0 source-virtual.img - ;; - - ext3) - mkfs.ext3 -F -m 0 source-virtual.img - ;; - esac -fi - -mkdir -p source.tmp -${LH_ROOT_COMMAND} mount -o loop source-virtual.img source.tmp -cp -r source/* source.tmp - -${LH_ROOT_COMMAND} umount source.tmp -rmdir source.tmp - -# Saving cache -Save_cache cache/packages_binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .stage/source_virtual-hdd diff --git a/helpers/lh_testroot b/helpers/lh_testroot deleted file mode 100755 index c4a427678..000000000 --- a/helpers/lh_testroot +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# lh_testroot(1) - ensure that a system is built as root -# Copyright (C) 2006-2009 Daniel Baumann -# -# 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:-/usr/share/live-helper}"/live-helper.sh - -# Setting static variables -DESCRIPTION="$(Echo 'ensure that a system is built as root')" -HELP="" -USAGE="${PROGRAM} [--force]" - -Arguments "${@}" - -# Reading configuration files -Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source -Set_defaults - -# Checking user account -if [ "$(${LH_ROOT_COMMAND} id -u)" -ne "0" ] -then - Echo_error "need root privileges" - exit 1 -fi diff --git a/helpers/local b/helpers/local new file mode 100755 index 000000000..16e228e8a --- /dev/null +++ b/helpers/local @@ -0,0 +1,18 @@ +#!/bin/sh + +# lh_local(1) - use a local live-helper version +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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. + +LH_BASE="${PWD}/live-helper" +PATH="${LH_BASE}/helpers:${PATH}" + +export LH_BASE PATH + +if [ ! -z "${1}" ] +then + exec lh "${@}" +fi diff --git a/helpers/source b/helpers/source new file mode 100755 index 000000000..8d11c443b --- /dev/null +++ b/helpers/source @@ -0,0 +1,54 @@ +#!/bin/sh + +# lh_source(1) - build source images +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build source images')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +Require_stagefile .stage/chroot_install-packages + +# Setup cleanup function +Setup_cleanup + +# Enabling network in chroot +lh chroot_hosts install ${*} +lh chroot_resolv install ${*} +lh chroot_hostname install ${*} +lh chroot_sources install ${*} + +# Preparing images +lh source_debian-live ${*} +lh source_debian ${*} +lh source_disk ${*} +lh source_md5sum ${*} + +# Building images +lh source_iso ${*} +lh source_net ${*} +lh source_tar ${*} +lh source_usb-hdd ${*} +lh source_virtual-hdd ${*} + +# Deconfiguring chroot +rm -f .stage/chroot_sources +lh chroot_hostname remove ${*} +lh chroot_resolv remove ${*} +lh chroot_hosts remove ${*} diff --git a/helpers/source_debian b/helpers/source_debian new file mode 100755 index 000000000..266894852 --- /dev/null +++ b/helpers/source_debian @@ -0,0 +1,153 @@ +#!/bin/sh + +# lh_source_debian(1) - download sources +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'debian sources')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_SOURCE}" != "true" ] +then + exit 0 +fi + +Echo_message "Begin downloading sources..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/source_debian + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Remove old sources +if [ -d source/debian ] +then + rm -rf source/debian +fi + +# Download sources +Chroot chroot "dpkg --get-selections" | awk '{ print $1 }' > source-selection.txt + +cat >> source-selection.txt << EOF +${LH_BOOTLOADER} +live-helper +${LH_INITRAMFS} +dosfstools +genisoimage +parted +squashfs-tools +genext2fs +mtd-tools +EOF + +case "${LH_ARCHITECTURE}" in + amd64|i386) + +cat >> source-selection.txt << EOF +mtools +syslinux +grub +EOF + + if [ "${LH_MEMTEST}" != "false" ] && [ "${LH_MEMTEST}" != "none" ] + then + echo "${LH_MEMTEST}" >> source-selection.txt + fi + ;; + + powerpc) + echo "yaboot" >> source-selection.txt + ;; + + sparc) + +cat >> source-selection.txt << EOF +silo +sparc-utils +EOF + + ;; +esac + +if [ -n "${LH_TASKS}" ] +then + echo "${LH_TASKSEL}" >> source-selection.txt +fi + +MISSING="" + +grep . source-selection.txt | \ +while read PACKAGE +do + if ! Chroot chroot "apt-get ${APT_OPTIONS} --download-only source ${PACKAGE}" + then + MISSING="${MISSING} ${PACKAGE}" + fi +done + +if [ -n "${MISSING}" ] +then + cat > source/missing-source.txt << EOF +This file contains the list of binary packages that are installed on this live +system that do not have a corresponding source package. + +EOF + + for PACKAGE in ${MISSING} + do + Chroot chroot "dpkg -l ${PACKAGE}" | tail -n1 >> source/missing-source.txt + done +fi + +rm -f source-selection.txt + +# Sort sources +for DSC in chroot/*.dsc +do + SOURCE="$(sed -n 's|^Source: ||p' ${DSC} 2>/dev/null || :)" + # The sed may fail if multiple dsc files exist for same source, as the + # first one to match will have already been moved. + [ -n "$SOURCE" ] || continue + + case "${SOURCE}" in + lib?*) + LETTER="$(echo ${SOURCE} | sed 's|\(....\).*|\1|')" + ;; + + *) + LETTER="$(echo ${SOURCE} | sed 's|\(.\).*|\1|')" + ;; + esac + + # Install directory + mkdir -p source/debian/"${LETTER}"/"${SOURCE}" + + # Move files + mv chroot/"${SOURCE}"_* source/debian/"${LETTER}"/"${SOURCE}" +done + +# Creating stage file +Create_stagefile .stage/source_debian diff --git a/helpers/source_debian-live b/helpers/source_debian-live new file mode 100755 index 000000000..10ba58050 --- /dev/null +++ b/helpers/source_debian-live @@ -0,0 +1,74 @@ +#!/bin/sh + +# lh_source_debian-live(1) - copy debian-live config into source +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'copy debian-live config into source')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_SOURCE}" != "true" ] +then + exit 0 +fi + +Echo_message "Begin copying live-helper configuration..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/source_debian-live + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Remove old sources +if [ -d source/debian-live ] +then + rm -rf source/debian-live +fi + +# Copy system configuration +mkdir -p source/debian-live +cp -a config source/debian-live + +if Find_files auto/* +then + cp -a auto source/debian-live +fi + +# Create tarball +cd source + +SUFFIX="$(date +%Y%m%d.%s)" + +tar cf debian-live-config_${SUFFIX}.tar debian-live +gzip ${GZIP_OPTIONS} debian-live-config_${SUFFIX}.tar + +cd "${OLDPWD}" + +rm -rf source/debian-live/config +mv source/debian-live-config_${SUFFIX}.tar.gz source/debian-live + +# Creating stage file +Create_stagefile .stage/source_debian-live diff --git a/helpers/source_disk b/helpers/source_disk new file mode 100755 index 000000000..a765bb47a --- /dev/null +++ b/helpers/source_disk @@ -0,0 +1,104 @@ +#!/bin/sh + +# lh_source_disk (1) - install disk information into source +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'install disk information into source')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_SOURCE_IMAGES}" != "iso" ] +then + exit 0 +fi + +Echo_message "Begin installing disk information..." + +# Requiring stage file +Require_stagefile .stage/config .stage/bootstrap + +# Checking stage file +Check_stagefile .stage/source_disk + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +mkdir -p source/.disk + +TITLE="Debian GNU/Linux" +DISTRIBUTION="$(echo ${LH_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')" +DISTRIBUTION="${DISTRIBUTION}$(echo ${LH_DISTRIBUTION} | cut -b 2-)" +eval VERSION="$`echo RELEASE_${LH_DISTRIBUTION}`" + +case "${LH_MODE}" in + debian) + STRING="Official Snapshot ${ARCHITECTURE}" + TRACE="project/trace/ftp-master.debian.org" + ;; + + debian-release) + STRING="Official ${ARCHITECTURE}" + TRACE="project/trace/ftp-master.debian.org" + ;; + + ubuntu) + TITLE="Ubuntu GNU/Linux" + STRING="Build ${ARCHITECTURE}" + TRACE="" + ;; + + *) + STRING="Snapshot ${ARCHITECTURE}" + TRACE="" + ;; +esac + +if [ -n "${TRACE}" ] +then + echo "$(wget -q ${LH_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \ + > source/.disk/archive_trace +fi + +case "${LH_DEBIAN_INSTALLER}" in + cdrom) + echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/CD Source $(date +%Y%m%d-%H:%M)" > source/.disk/info + ;; + + true|netinst) + echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/NETINST Source $(date +%Y%m%d-%H:%M)" > source/.disk/info + ;; + + live) + echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/INSTALL Source $(date +%Y%m%d-%H:%M)" > source/.disk/info + ;; + + businesscard) + echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/BC Source $(date +%Y%m%d-%H:%M)" > source/.disk/info + ;; + + false) + echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE Source $(date +%Y%m%d-%H:%M)" > source/.disk/info + ;; +esac + +# Creating stage file +Create_stagefile .stage/source_disk diff --git a/helpers/source_iso b/helpers/source_iso new file mode 100755 index 000000000..0ef1bcbec --- /dev/null +++ b/helpers/source_iso @@ -0,0 +1,109 @@ +#!/bin/sh + +# lh_source_iso(1) - build iso source image +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build iso source image')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_SOURCE}" != "true" ] +then + exit 0 +fi + +if ! In_list iso "${LH_SOURCE_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building source iso image..." + +# Requiring stage file +Require_stagefile .stage/config .stage/source_debian + +# Checking stage file +Check_stagefile .stage/source_iso + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Checking depends +Check_package chroot/usr/bin/genisoimage genisoimage + +# Installing depends +Install_package + +# Remove old iso image +if [ -f source.iso ] +then + rm -f source.iso +fi + +if [ "${_QUIET}" = "true" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -quiet" +fi + +if [ "${_VERBOSE}" = "true" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v" +fi + +if [ -n "${LH_ISO_APPLICATION}" ] && [ "${LH_ISO_APPLICATION}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LH_ISO_APPLICATION}\"" +fi + +if [ -n "${LH_ISO_PREPARER}" ] && [ "${LH_ISO_PREPARER}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LH_ISO_PREPARER}\"" +fi + +if [ -n "${LH_ISO_PUBLISHER}" ] && [ "${LH_ISO_PUBLISHER}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LH_ISO_PUBLISHER}\"" +fi + +if [ -n "${LH_ISO_VOLUME}" ] && [ "${LH_ISO_VOLUME}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LH_ISO_VOLUME}\"" +fi + +# Moving image +mv source chroot + +cat >> chroot/source.sh << EOF +genisoimage ${GENISOIMAGE_OPTIONS} -o source.iso -r -J -l -cache-inodes source +EOF + +Chroot chroot "sh source.sh" + +# Move image +mv chroot/source chroot/source.iso ./ +rm -f chroot/source.sh + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/source_iso diff --git a/helpers/source_md5sum b/helpers/source_md5sum new file mode 100755 index 000000000..0034bfd91 --- /dev/null +++ b/helpers/source_md5sum @@ -0,0 +1,78 @@ +#!/bin/sh + +# lh_source_md5sum(1) - create source md5sums +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'create source md5sums')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_SOURCE}" != "true" ] +then + exit 0 +fi + +if [ "${LH_CHECKSUMS}" != "true" ] +then + exit 0 +fi + +Echo_message "Begin creating source md5sum.txt..." + +# Requiring stage file +Require_stagefile .stage/config .stage/source_debian + +# Checking stage file +Check_stagefile .stage/source_md5sum + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Remove old md5sums +if [ -f source/md5sum.txt ] +then + rm -f source/md5sum.txt +fi + +# Calculating md5sums +cd source +find . -type f -print0 | sort -z | xargs -0 md5sum > ../md5sum.txt + +cat > md5sum.txt << EOF +This file contains the list of md5 checksums of all files on this medium. + +You can verify them automatically with the 'integrity-check' boot parameter, +or, manually with: 'md5sum -c md5sum.txt'. + + +EOF + +cat ../md5sum.txt >> md5sum.txt +rm -f ../md5sum.txt + +# File list +find . | sed -e 's|^.||g' | grep "^/" | sort > ../source.list + +cd "${OLDPWD}" + +# Creating stage file +Create_stagefile .stage/source_md5sum diff --git a/helpers/source_net b/helpers/source_net new file mode 100755 index 000000000..1c1b946b9 --- /dev/null +++ b/helpers/source_net @@ -0,0 +1,61 @@ +#!/bin/sh + +# lh_source_net(1) - build source net image +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build source net image')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_SOURCE}" != "true" ] +then + exit 0 +fi + +if ! In_list net "${LH_SOURCE_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building source netboot image..." + +# Requiring stage file +Require_stagefile .stage/config .stage/source_debian + +# Checking stage file +Check_stagefile .stage/source_net + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Remove old source +if [ -f source-net.tar.gz ] +then + rm -f source-net.tar.gz +fi + +# Create tarball +tar cf source-net.tar source +gzip ${GZIP_OPTIONS} source-net.tar + +# Creating stage file +Create_stagefile .stage/source_net diff --git a/helpers/source_tar b/helpers/source_tar new file mode 100755 index 000000000..4923b710a --- /dev/null +++ b/helpers/source_tar @@ -0,0 +1,62 @@ +#!/bin/sh + +# lh_source_tar(1) - build source tarball +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build source tarball')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_SOURCE}" != "true" ] +then + exit 0 +fi + +if ! In_list tar "${LH_SOURCE_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building source tarball..." +Echo_message "This may take a while." + +# Requiring stage file +Require_stagefile .stage/config .stage/source_debian + +# Checking stage file +Check_stagefile .stage/source_tar + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Remove old source +if [ -f source.tar.gz ] +then + rm -f source.tar.gz +fi + +# Create tarball +tar cf source.tar source +gzip ${GZIP_OPTIONS} source.tar + +# Creating stage file +Create_stagefile .stage/source_tar diff --git a/helpers/source_usb-hdd b/helpers/source_usb-hdd new file mode 100755 index 000000000..e8cd8caeb --- /dev/null +++ b/helpers/source_usb-hdd @@ -0,0 +1,139 @@ +#!/bin/sh + +# lh_source_usb-hdd(1) - build source usb-hdd image +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build source image')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_SOURCE}" != "true" ] +then + exit 0 +fi + +if ! In_list usb-hdd "${LH_SOURCE_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building source usb-hdd image..." + +# Requiring stage file +Require_stagefile .stage/config .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="$(Calculate_partition_size ${DU_DIM} ${LH_BINARY_FILESYSTEM})" +dd if=/dev/zero of=source.img bs=1024k count=0 seek=${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 + +case "${LH_BINARY_FILESYSTEM}" in + ext2|ext3) + PARTITION_TYPE="ext2" + ;; + + fat16|fat32) + PARTITION_TYPE="${LH_BINARY_FILESYSTEM}" + ;; + + *) + Echo_error "Unsupported binary filesystem %s" "${LH_BINARY_FILESYSTEM}" + exit 1 + ;; +esac + +Echo_warning "!!! The following error/warning messages can be ignored !!!" +Losetup $FREELO source.img 0 +Chroot chroot "parted -s ${FREELO} mklabel msdos" || true +Chroot chroot "parted -s ${FREELO} mkpart primary ${PARTITION_TYPE} 0.0 100%" || true +Chroot chroot "parted -s ${FREELO} set 1 lba off" || true +sleep 1 +${LH_LOSETUP} -d ${FREELO} + +Losetup $FREELO source.img 1 + +case "${LH_BINARY_FILESYSTEM}" in + ext2|ext3) + MKFS="${LH_BINARY_FILESYSTEM}" + MKFS_OPTIONS="-L DEBIAN_LIVE -m 0" + ;; + + fat16) + MKFS="vfat" + MKFS_OPTIONS="-F 16 -n DEBIAN_LIVE" + ;; + + fat32) + MKFS="vfat" + MKFS_OPTIONS="-F 32 -n DEBIAN_LIVE" + ;; +esac + +Chroot chroot "mkfs.${MKFS} ${MKFS_OPTIONS} ${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 +sleep 1 +${LH_LOSETUP} -d ${FREELO} +Echo_warning "!!! The above error/warning messages can be ignored !!!" + +if [ -n "${MAKEDEV}" ] +then + rm -rf 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/source_virtual-hdd b/helpers/source_virtual-hdd new file mode 100755 index 000000000..ac186dc11 --- /dev/null +++ b/helpers/source_virtual-hdd @@ -0,0 +1,114 @@ +#!/bin/sh + +# lh_source_virtual-hdd(1) - build source virtual-hdd image +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build source image')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +if [ "${LH_SOURCE}" != "true" ] +then + exit 0 +fi + +if ! In_list virtual-hdd "${LH_SOURCE_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building source virtual-hdd image..." + +# Requiring stage file +Require_stagefile .stage/config .stage/source_debian + +# Checking stage file +Check_stagefile .stage/source_virtual-hdd + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ "${LH_CHROOT_BUILD}" = "true" ] +then + case "${LH_BINARY_FILESYSTEM}" in + ext2|ext3) + Check_package chroot/sbin/mkfs.ext2 e2fsprogs + ;; + esac +fi + +# Installing depends +Install_package + +# Remove old source +if [ -f source-virtual.img ] +then + rm -f source-virtual.img +fi + +# Everything which comes here needs to be cleaned up, +DU_DIM="$(du -ms source | cut -f1)" +REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LH_BINARY_FILESYSTEM})" +dd if=/dev/zero of=source-virtual.img bs=1024k count=0 seek=${REAL_DIM} + +if [ "${LH_CHROOT_BUILD}" = "true" ] +then + mv source-virtual.img chroot + + case "${LH_BINARY_FILESYSTEM}" in + ext2) + Chroot chroot "mkfs.ext2 -F -m 0 source-virtual.img" + ;; + + ext3) + Chroot chroot "mkfs.ext3 -F source-virtual.img" + ;; + esac + + mv chroot/source-virtual.img ./ +else + case "${LH_BINARY_FILESYSTEM}" in + ext2) + mkfs.ext2 -F -m 0 source-virtual.img + ;; + + ext3) + mkfs.ext3 -F -m 0 source-virtual.img + ;; + esac +fi + +mkdir -p source.tmp +${LH_ROOT_COMMAND} mount -o loop source-virtual.img source.tmp +cp -r source/* source.tmp + +${LH_ROOT_COMMAND} umount source.tmp +rmdir source.tmp + +# Saving cache +Save_cache cache/packages_binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .stage/source_virtual-hdd diff --git a/helpers/testroot b/helpers/testroot new file mode 100755 index 000000000..c4a427678 --- /dev/null +++ b/helpers/testroot @@ -0,0 +1,31 @@ +#!/bin/sh + +# lh_testroot(1) - ensure that a system is built as root +# Copyright (C) 2006-2009 Daniel Baumann +# +# 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:-/usr/share/live-helper}"/live-helper.sh + +# Setting static variables +DESCRIPTION="$(Echo 'ensure that a system is built as root')" +HELP="" +USAGE="${PROGRAM} [--force]" + +Arguments "${@}" + +# Reading configuration files +Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source +Set_defaults + +# Checking user account +if [ "$(${LH_ROOT_COMMAND} id -u)" -ne "0" ] +then + Echo_error "need root privileges" + exit 1 +fi -- cgit v1.2.3