From a0a5bbfd1c9b6fc58d1b102ee56fb7d3b8b7bfcf Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 27 Aug 2012 15:59:56 +0200 Subject: Dropping lb prefix from live-build scripts, not needed anymore. Previously, we needed to keep the lb_* prefix as the scripts could also be executed standalone. Since the lb wrapper is mandatory since squeeze, we can drop this now. --- scripts/build/binary | 110 +++ scripts/build/binary_checksums | 86 ++ scripts/build/binary_chroot | 125 +++ scripts/build/binary_debian-installer | 870 +++++++++++++++++ scripts/build/binary_disk | 203 ++++ scripts/build/binary_grub | 309 ++++++ scripts/build/binary_grub2 | 279 ++++++ scripts/build/binary_hdd | 314 +++++++ scripts/build/binary_hooks | 78 ++ scripts/build/binary_includes | 57 ++ scripts/build/binary_iso | 235 +++++ scripts/build/binary_linux-image | 92 ++ scripts/build/binary_manifest | 71 ++ scripts/build/binary_memtest | 124 +++ scripts/build/binary_netboot | 183 ++++ scripts/build/binary_package-lists | 144 +++ scripts/build/binary_rootfs | 508 ++++++++++ scripts/build/binary_silo | 239 +++++ scripts/build/binary_syslinux | 366 ++++++++ scripts/build/binary_tar | 73 ++ scripts/build/binary_virtual-hdd | 111 +++ scripts/build/binary_win32-loader | 103 ++ scripts/build/binary_yaboot | 284 ++++++ scripts/build/binary_zsync | 125 +++ scripts/build/bootstrap | 49 + scripts/build/bootstrap_cache | 96 ++ scripts/build/bootstrap_cdebootstrap | 139 +++ scripts/build/bootstrap_copy | 56 ++ scripts/build/bootstrap_debootstrap | 158 ++++ scripts/build/build | 77 ++ scripts/build/chroot | 92 ++ scripts/build/chroot_apt | 335 +++++++ scripts/build/chroot_archives | 901 ++++++++++++++++++ scripts/build/chroot_cache | 92 ++ scripts/build/chroot_debianchroot | 81 ++ scripts/build/chroot_devpts | 86 ++ scripts/build/chroot_dpkg | 122 +++ scripts/build/chroot_hacks | 309 ++++++ scripts/build/chroot_hooks | 115 +++ scripts/build/chroot_hostname | 95 ++ scripts/build/chroot_hosts | 98 ++ scripts/build/chroot_includes | 50 + scripts/build/chroot_install-packages | 70 ++ scripts/build/chroot_interactive | 62 ++ scripts/build/chroot_linux-image | 123 +++ scripts/build/chroot_live-packages | 80 ++ scripts/build/chroot_package-lists | 91 ++ scripts/build/chroot_preseed | 72 ++ scripts/build/chroot_proc | 97 ++ scripts/build/chroot_resolv | 100 ++ scripts/build/chroot_selinuxfs | 97 ++ scripts/build/chroot_sysfs | 91 ++ scripts/build/chroot_sysv-rc | 87 ++ scripts/build/chroot_tmpfs | 80 ++ scripts/build/chroot_upstart | 87 ++ scripts/build/clean | 161 ++++ scripts/build/config | 1494 ++++++++++++++++++++++++++++++ scripts/build/lb_binary | 110 --- scripts/build/lb_binary_checksums | 86 -- scripts/build/lb_binary_chroot | 125 --- scripts/build/lb_binary_debian-installer | 870 ----------------- scripts/build/lb_binary_disk | 203 ---- scripts/build/lb_binary_grub | 309 ------ scripts/build/lb_binary_grub2 | 279 ------ scripts/build/lb_binary_hdd | 314 ------- scripts/build/lb_binary_hooks | 78 -- scripts/build/lb_binary_includes | 57 -- scripts/build/lb_binary_iso | 235 ----- scripts/build/lb_binary_linux-image | 92 -- scripts/build/lb_binary_manifest | 71 -- scripts/build/lb_binary_memtest | 124 --- scripts/build/lb_binary_netboot | 183 ---- scripts/build/lb_binary_package-lists | 144 --- scripts/build/lb_binary_rootfs | 508 ---------- scripts/build/lb_binary_silo | 239 ----- scripts/build/lb_binary_syslinux | 366 -------- scripts/build/lb_binary_tar | 73 -- scripts/build/lb_binary_virtual-hdd | 111 --- scripts/build/lb_binary_win32-loader | 103 -- scripts/build/lb_binary_yaboot | 284 ------ scripts/build/lb_binary_zsync | 125 --- scripts/build/lb_bootstrap | 49 - scripts/build/lb_bootstrap_cache | 96 -- scripts/build/lb_bootstrap_cdebootstrap | 139 --- scripts/build/lb_bootstrap_copy | 56 -- scripts/build/lb_bootstrap_debootstrap | 158 ---- scripts/build/lb_build | 77 -- scripts/build/lb_chroot | 92 -- scripts/build/lb_chroot_apt | 335 ------- scripts/build/lb_chroot_archives | 901 ------------------ scripts/build/lb_chroot_cache | 92 -- scripts/build/lb_chroot_debianchroot | 81 -- scripts/build/lb_chroot_devpts | 86 -- scripts/build/lb_chroot_dpkg | 122 --- scripts/build/lb_chroot_hacks | 309 ------ scripts/build/lb_chroot_hooks | 115 --- scripts/build/lb_chroot_hostname | 95 -- scripts/build/lb_chroot_hosts | 98 -- scripts/build/lb_chroot_includes | 50 - scripts/build/lb_chroot_install-packages | 70 -- scripts/build/lb_chroot_interactive | 62 -- scripts/build/lb_chroot_linux-image | 123 --- scripts/build/lb_chroot_live-packages | 80 -- scripts/build/lb_chroot_package-lists | 91 -- scripts/build/lb_chroot_preseed | 72 -- scripts/build/lb_chroot_proc | 97 -- scripts/build/lb_chroot_resolv | 100 -- scripts/build/lb_chroot_selinuxfs | 97 -- scripts/build/lb_chroot_sysfs | 91 -- scripts/build/lb_chroot_sysv-rc | 87 -- scripts/build/lb_chroot_tmpfs | 80 -- scripts/build/lb_chroot_upstart | 87 -- scripts/build/lb_clean | 161 ---- scripts/build/lb_config | 1494 ------------------------------ scripts/build/lb_source | 66 -- scripts/build/lb_source_checksums | 91 -- scripts/build/lb_source_debian | 169 ---- scripts/build/lb_source_debian-live | 62 -- scripts/build/lb_source_disk | 129 --- scripts/build/lb_source_hdd | 151 --- scripts/build/lb_source_iso | 114 --- scripts/build/lb_source_tar | 85 -- scripts/build/lb_source_virtual-hdd | 106 --- scripts/build/lb_testroot | 32 - scripts/build/source | 66 ++ scripts/build/source_checksums | 91 ++ scripts/build/source_debian | 169 ++++ scripts/build/source_debian-live | 62 ++ scripts/build/source_disk | 129 +++ scripts/build/source_hdd | 151 +++ scripts/build/source_iso | 114 +++ scripts/build/source_tar | 85 ++ scripts/build/source_virtual-hdd | 106 +++ scripts/build/testroot | 32 + 134 files changed, 11837 insertions(+), 11837 deletions(-) create mode 100755 scripts/build/binary create mode 100755 scripts/build/binary_checksums create mode 100755 scripts/build/binary_chroot create mode 100755 scripts/build/binary_debian-installer create mode 100755 scripts/build/binary_disk create mode 100755 scripts/build/binary_grub create mode 100755 scripts/build/binary_grub2 create mode 100755 scripts/build/binary_hdd create mode 100755 scripts/build/binary_hooks create mode 100755 scripts/build/binary_includes create mode 100755 scripts/build/binary_iso create mode 100755 scripts/build/binary_linux-image create mode 100755 scripts/build/binary_manifest create mode 100755 scripts/build/binary_memtest create mode 100755 scripts/build/binary_netboot create mode 100755 scripts/build/binary_package-lists create mode 100755 scripts/build/binary_rootfs create mode 100755 scripts/build/binary_silo create mode 100755 scripts/build/binary_syslinux create mode 100755 scripts/build/binary_tar create mode 100755 scripts/build/binary_virtual-hdd create mode 100755 scripts/build/binary_win32-loader create mode 100755 scripts/build/binary_yaboot create mode 100755 scripts/build/binary_zsync create mode 100755 scripts/build/bootstrap create mode 100755 scripts/build/bootstrap_cache create mode 100755 scripts/build/bootstrap_cdebootstrap create mode 100755 scripts/build/bootstrap_copy create mode 100755 scripts/build/bootstrap_debootstrap create mode 100755 scripts/build/build create mode 100755 scripts/build/chroot create mode 100755 scripts/build/chroot_apt create mode 100755 scripts/build/chroot_archives create mode 100755 scripts/build/chroot_cache create mode 100755 scripts/build/chroot_debianchroot create mode 100755 scripts/build/chroot_devpts create mode 100755 scripts/build/chroot_dpkg create mode 100755 scripts/build/chroot_hacks create mode 100755 scripts/build/chroot_hooks create mode 100755 scripts/build/chroot_hostname create mode 100755 scripts/build/chroot_hosts create mode 100755 scripts/build/chroot_includes create mode 100755 scripts/build/chroot_install-packages create mode 100755 scripts/build/chroot_interactive create mode 100755 scripts/build/chroot_linux-image create mode 100755 scripts/build/chroot_live-packages create mode 100755 scripts/build/chroot_package-lists create mode 100755 scripts/build/chroot_preseed create mode 100755 scripts/build/chroot_proc create mode 100755 scripts/build/chroot_resolv create mode 100755 scripts/build/chroot_selinuxfs create mode 100755 scripts/build/chroot_sysfs create mode 100755 scripts/build/chroot_sysv-rc create mode 100755 scripts/build/chroot_tmpfs create mode 100755 scripts/build/chroot_upstart create mode 100755 scripts/build/clean create mode 100755 scripts/build/config delete mode 100755 scripts/build/lb_binary delete mode 100755 scripts/build/lb_binary_checksums delete mode 100755 scripts/build/lb_binary_chroot delete mode 100755 scripts/build/lb_binary_debian-installer delete mode 100755 scripts/build/lb_binary_disk delete mode 100755 scripts/build/lb_binary_grub delete mode 100755 scripts/build/lb_binary_grub2 delete mode 100755 scripts/build/lb_binary_hdd delete mode 100755 scripts/build/lb_binary_hooks delete mode 100755 scripts/build/lb_binary_includes delete mode 100755 scripts/build/lb_binary_iso delete mode 100755 scripts/build/lb_binary_linux-image delete mode 100755 scripts/build/lb_binary_manifest delete mode 100755 scripts/build/lb_binary_memtest delete mode 100755 scripts/build/lb_binary_netboot delete mode 100755 scripts/build/lb_binary_package-lists delete mode 100755 scripts/build/lb_binary_rootfs delete mode 100755 scripts/build/lb_binary_silo delete mode 100755 scripts/build/lb_binary_syslinux delete mode 100755 scripts/build/lb_binary_tar delete mode 100755 scripts/build/lb_binary_virtual-hdd delete mode 100755 scripts/build/lb_binary_win32-loader delete mode 100755 scripts/build/lb_binary_yaboot delete mode 100755 scripts/build/lb_binary_zsync delete mode 100755 scripts/build/lb_bootstrap delete mode 100755 scripts/build/lb_bootstrap_cache delete mode 100755 scripts/build/lb_bootstrap_cdebootstrap delete mode 100755 scripts/build/lb_bootstrap_copy delete mode 100755 scripts/build/lb_bootstrap_debootstrap delete mode 100755 scripts/build/lb_build delete mode 100755 scripts/build/lb_chroot delete mode 100755 scripts/build/lb_chroot_apt delete mode 100755 scripts/build/lb_chroot_archives delete mode 100755 scripts/build/lb_chroot_cache delete mode 100755 scripts/build/lb_chroot_debianchroot delete mode 100755 scripts/build/lb_chroot_devpts delete mode 100755 scripts/build/lb_chroot_dpkg delete mode 100755 scripts/build/lb_chroot_hacks delete mode 100755 scripts/build/lb_chroot_hooks delete mode 100755 scripts/build/lb_chroot_hostname delete mode 100755 scripts/build/lb_chroot_hosts delete mode 100755 scripts/build/lb_chroot_includes delete mode 100755 scripts/build/lb_chroot_install-packages delete mode 100755 scripts/build/lb_chroot_interactive delete mode 100755 scripts/build/lb_chroot_linux-image delete mode 100755 scripts/build/lb_chroot_live-packages delete mode 100755 scripts/build/lb_chroot_package-lists delete mode 100755 scripts/build/lb_chroot_preseed delete mode 100755 scripts/build/lb_chroot_proc delete mode 100755 scripts/build/lb_chroot_resolv delete mode 100755 scripts/build/lb_chroot_selinuxfs delete mode 100755 scripts/build/lb_chroot_sysfs delete mode 100755 scripts/build/lb_chroot_sysv-rc delete mode 100755 scripts/build/lb_chroot_tmpfs delete mode 100755 scripts/build/lb_chroot_upstart delete mode 100755 scripts/build/lb_clean delete mode 100755 scripts/build/lb_config delete mode 100755 scripts/build/lb_source delete mode 100755 scripts/build/lb_source_checksums delete mode 100755 scripts/build/lb_source_debian delete mode 100755 scripts/build/lb_source_debian-live delete mode 100755 scripts/build/lb_source_disk delete mode 100755 scripts/build/lb_source_hdd delete mode 100755 scripts/build/lb_source_iso delete mode 100755 scripts/build/lb_source_tar delete mode 100755 scripts/build/lb_source_virtual-hdd delete mode 100755 scripts/build/lb_testroot create mode 100755 scripts/build/source create mode 100755 scripts/build/source_checksums create mode 100755 scripts/build/source_debian create mode 100755 scripts/build/source_debian-live create mode 100755 scripts/build/source_disk create mode 100755 scripts/build/source_hdd create mode 100755 scripts/build/source_iso create mode 100755 scripts/build/source_tar create mode 100755 scripts/build/source_virtual-hdd create mode 100755 scripts/build/testroot (limited to 'scripts') diff --git a/scripts/build/binary b/scripts/build/binary new file mode 100755 index 000000000..4fbbc096d --- /dev/null +++ b/scripts/build/binary @@ -0,0 +1,110 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Automatically populating config tree +if [ -x auto/config ] && [ ! -e .build/config ] +then + Echo_message "Automatically populating config tree." + lb config +fi + +# 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 +lb binary_chroot ${@} + +if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] +then + # Configuring chroot + lb chroot_devpts install ${@} + lb chroot_proc install ${@} + lb chroot_selinuxfs install ${@} + lb chroot_sysfs install ${@} + lb chroot_hosts install ${@} + lb chroot_resolv install ${@} + lb chroot_hostname install ${@} + lb chroot_sysv-rc install ${@} + lb chroot_upstart install ${@} + lb chroot_apt install-binary ${@} + lb chroot_archives chroot install ${@} +fi + +# Building root filesystem +lb binary_rootfs ${@} +lb binary_manifest ${@} + +# Prepare images +lb binary_package-lists ${@} +lb binary_linux-image ${@} +lb binary_debian-installer ${@} +lb binary_memtest ${@} +lb binary_grub ${@} +lb binary_grub2 ${@} +lb binary_syslinux ${@} +lb binary_yaboot ${@} +lb binary_silo ${@} +lb binary_disk ${@} +lb binary_win32-loader ${@} +lb binary_includes ${@} +lb binary_hooks ${@} +lb binary_checksums ${@} + +if [ "${LB_BUILD_WITH_CHROOT}" != "true" ] +then + lb chroot_devpts install ${@} + lb chroot_proc install ${@} + lb chroot_selinuxfs install ${@} + lb chroot_sysfs install ${@} +fi + +# Building images +lb binary_iso ${@} +lb binary_netboot ${@} +lb binary_tar ${@} +lb binary_hdd ${@} +lb binary_virtual-hdd ${@} + +lb binary_zsync ${@} + +if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] +then + # Deconfiguring chroot + rm -f .build/chroot_archives + lb chroot_apt remove ${@} + lb chroot_hostname remove ${@} + lb chroot_resolv remove ${@} + lb chroot_hosts remove ${@} + lb chroot_upstart remove ${@} + lb chroot_sysv-rc remove ${@} + lb chroot_dpkg remove ${@} + lb chroot_debianchroot remove ${@} +fi + +lb chroot_sysfs remove ${@} +lb chroot_selinuxfs remove ${@} +lb chroot_proc remove ${@} +lb chroot_devpts remove ${@} diff --git a/scripts/build/binary_checksums b/scripts/build/binary_checksums new file mode 100755 index 000000000..e6ece1457 --- /dev/null +++ b/scripts/build/binary_checksums @@ -0,0 +1,86 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'create binary checksums')" +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 [ "${LB_CHECKSUMS}" = "none" ] || [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_checksums + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +for CHECKSUM in ${LB_CHECKSUMS} +do + CHECKSUMS="$(echo ${CHECKSUM} | tr [a-z] [A-Z])SUMS" + + Echo_message "Begin creating binary ${CHECKSUMS}..." + + # Remove old checksums + if [ -f binary/${CHECKSUMS} ] + then + rm -f binary/${CHECKSUMS} + fi + + # Calculating checksums + cd binary + find . -type f \ + \! -path './isolinux/isolinux.bin' \ + \! -path './boot/boot.bin' \ + \! -path './boot/grub/stage2_eltorito' \ + \! -path './*SUMS' \ + -print0 | sort -z | xargs -0 ${CHECKSUM}sum > ../${CHECKSUMS} + +cat > ${CHECKSUMS} << EOF +This file contains the list of ${CHECKSUM} checksums of all files on this medium. + +You can verify them automatically with the 'integrity-check' boot parameter, +or, manually with: '${CHECKSUM}sum -c ${CHECKSUMS}'. + + +EOF + + cat ../${CHECKSUMS} >> ${CHECKSUMS} + rm -f ../${CHECKSUMS} + + cd "${OLDPWD}" +done + +# File list +cd binary +find . | sed -e 's|^.||g' | grep "^/" | sort > ../binary.contents +cd "${OLDPWD}" + +# Creating stage file +Create_stagefile .build/binary_checksums diff --git a/scripts/build/binary_chroot b/scripts/build/binary_chroot new file mode 100755 index 000000000..4d4500e55 --- /dev/null +++ b/scripts/build/binary_chroot @@ -0,0 +1,125 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/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 [ "${LB_USE_FAKEROOT}" != "true" ] + then + ${LB_ROOT_COMMAND} umount chroot/proc + else + rm -rf chroot/proc + mkdir -p chroot/proc + fi +fi + +if [ -d chroot/sys/kernel ] +then + if [ "${LB_USE_FAKEROOT}" != "true" ] + then + ${LB_ROOT_COMMAND} umount chroot/sys + else + rm -rf chroot/sys + mkdir -p chroot/sys + fi +fi + +# Copying /dev if using fakeroot +if [ "${LB_USE_FAKEROOT}" = "true" ] +then + rm -rf chroot/dev + find /dev | cpio -dmpu chroot +fi + +if [ "${LB_BUILD_WITH_CHROOT}" = "false" ] +then + exit 0 +fi + +if [ "${LB_CACHE}" = "true" ] && Find_files cache/binary_rootfs/filesystem* +then + exit 0 +fi + +Echo_message "This may take a while." + +# Removing old chroot +${LB_ROOT_COMMAND} rm -rf chroot/chroot +${LB_ROOT_COMMAND} rm -rf chroot.tmp + +# Copying new chroot +if [ -d cache/bootstrap ] && [ "${LB_CHROOT_FILESYSTEM}" != "none" ] +then + ${LB_ROOT_COMMAND} mv chroot chroot.tmp + ${LB_ROOT_COMMAND} cp -a cache/bootstrap chroot + ${LB_ROOT_COMMAND} touch chroot/chroot.cache +else + ${LB_ROOT_COMMAND} cp -a chroot chroot.tmp +fi + +${LB_ROOT_COMMAND} mv chroot.tmp chroot/chroot + +# Handling chroot excludes +if [ -f config/binary_rootfs/excludes ] && [ "${LB_CHROOT_FILESYSTEM}" != "squashfs" ] +then + case "${LB_BUILD_WITH_CHROOT}" in + true) + cp config/binary_rootfs/excludes chroot/chroot/excludes + # Not using Chroot() here because we want explicitly /bin/bash (for the time being) + chroot chroot/chroot /usr/bin/env -i xargs --arg-file=/excludes -I FILE bash -c 'rm -rf FILE' + rm -f chroot/chroot/excludes + ;; + + false) + cp config/binary_rootfs/excludes chroot/excludes + # Not using Chroot() here because we want explicitly /bin/bash (for the time being) + chroot chroot /usr/bin/env -i xargs --arg-file=/excludes -I FILE bash -c 'rm -rf FILE' + rm -f chroot/excludes + ;; + esac +fi + +if [ -n "${LB_ROOT_COMMAND}" ] +then + ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot +fi + +# Creating stage file +Create_stagefile .build/binary_chroot diff --git a/scripts/build/binary_debian-installer b/scripts/build/binary_debian-installer new file mode 100755 index 000000000..a6ed88b6e --- /dev/null +++ b/scripts/build/binary_debian-installer @@ -0,0 +1,870 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_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 "${LB_DEBIAN_INSTALLER}" in + true|cdrom|netinst|netboot|businesscard|live) + ;; + + false) + exit 0 + ;; + + *) + Echo_error "debian-installer flavour %s not supported." "${LB_DEBIAN_INSTALLER}" + exit 1 + ;; +esac + +Echo_message "Begin installing debian-installer..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/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 "${LB_BINARY_IMAGES}" in + netboot) + DESTDIR="tftpboot/debian-install/${LB_ARCHITECTURES}" + ;; + + hdd*|tar) + DESTDIR="binary/install" + ;; + + *) + DESTDIR="binary/install" + ;; +esac + +# Set d-i image type +case "${LB_DEBIAN_INSTALLER}" in + businesscard|netboot|netinst) + DI_IMAGE_TYPE="netboot" + ;; + *) + case "${LB_BINARY_IMAGES}" in + netboot) + DI_IMAGE_TYPE="netboot" + ;; + + *) + DI_IMAGE_TYPE="cdrom" + ;; + esac + ;; +esac + +# Set architecture-specific variables +case "${LB_ARCHITECTURES}" in + armel) + DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" + case "${DI_IMAGE_TYPE}" in + cdrom) + DI_REMOTE_BASE="${DEFAULT_FLAVOUR}/cdrom" + ;; + + netboot) + DI_REMOTE_BASE="${DEFAULT_FLAVOUR}/netboot" + ;; + esac + + DI_REMOTE_KERNEL="vmlinuz" + DI_REMOTE_BASE_GTK="${DI_REMOTE_BASE}/gtk" + ;; + + powerpc) + case "${DI_IMAGE_TYPE}" in + cdrom) + DI_REMOTE_BASE="${LB_ARCHITECTURES}/cdrom" + ;; + + netboot) + DI_REMOTE_BASE="${LB_ARCHITECTURES}/netboot" + ;; + esac + + DI_REMOTE_KERNEL="vmlinux" + DI_REMOTE_BASE_GTK="${DI_REMOTE_BASE}/gtk" + ;; + + sparc) + DEFAULT_FLAVOUR="$(echo ${LB_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/${LB_ARCHITECTURES}" + DI_REMOTE_BASE_GTK="netboot/gtk/debian-installer/${LB_ARCHITECTURES}" + DI_REMOTE_KERNEL="linux" + ;; + + cdrom) + DI_REMOTE_BASE="cdrom" + DI_REMOTE_BASE_GTK="cdrom/gtk" + DI_REMOTE_KERNEL="vmlinuz" + ;; + esac + ;; +esac + +Check_multiarchitectures + +Install_file() { + local FILE + FILE="${1}" + + local ARCHIVE_AREA + ARCHIVE_AREA="$(dpkg -I ${FILE} | awk '/^.*Section: / { print $2 }')" + + if echo "${ARCHIVE_AREA}" | grep -qs '/' + then + ARCHIVE_AREA="$(echo ${ARCHIVE_AREA} | awk -F/ '{ print $1 }')" + else + ARCHIVE_AREA="main" + fi + + local TARGET + TARGET="${2}/${ARCHIVE_AREA}" + + 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. +_LB_CACHE_DIR="$(pwd)/cache/binary_debian-installer" + +Download_file () { + local _LB_TARGET + _LB_TARGET="${1}" + + local _LB_URL + _LB_URL="${2}" + + _LB_CACHE_FILE="${_LB_CACHE_DIR}/$(echo "${_LB_URL}" | sed 's|/|_|g')" + + if [ ! -f "${_LB_CACHE_FILE}" ] + then + mkdir -p ${_LB_CACHE_DIR} + if ! wget ${WGET_OPTIONS} -O "${_LB_CACHE_FILE}" "${_LB_URL}" + then + rm -f "${_LB_CACHE_FILE}" + + Echo_error "Could not download file: %s" "${_LB_URL}" + exit 1 + fi + fi + + if [ "$(stat --printf %d "${_LB_CACHE_DIR}")" = "$(stat --printf %d ./)" ] + then + CP_OPTIONS="-l" + fi + + cp -f ${CP_OPTIONS} -- "${_LB_CACHE_FILE}" "${_LB_TARGET}" +} + +VMLINUZ_DI="vmlinuz" +INITRD_DI="initrd.gz" +DESTDIR_DI="${DESTDIR}" + +VMLINUZ_GI="gtk/vmlinuz" +INITRD_GI="gtk/initrd.gz" +DESTDIR_GI="${DESTDIR}/gtk" + +case "${LB_DERIVATIVE}" in + false) + if [ "${LB_DEBIAN_INSTALLER_DISTRIBUTION}" = "daily" ] + then + # FIXME: variable name should be decupled from derivatves + LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="sid" + + # Debian Installer daily builds + URL="http://d-i.debian.org/daily-images/${LB_ARCHITECTURES}/daily/" + else + URL="${LB_MIRROR_DEBIAN_INSTALLER}/dists/${LB_DEBIAN_INSTALLER_DISTRIBUTION}/main/installer-${LB_ARCHITECTURES}/current/images/" + fi + ;; + + true) + if [ "${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}" = "daily" ] + then + LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="sid" + + # Debian Installer daily builds + URL="http://d-i.debian.org/daily-images/${LB_ARCHITECTURES}/daily/" + else + URL="${LB_PARENT_MIRROR_DEBIAN_INSTALLER}/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/main/installer-${LB_ARCHITECTURES}/current/images/" + fi + + if [ "${LB_MODE}" = "progress" ] + then + # FIXME: normal derivatives probably don't rebuild d-i, + # but progress does. + URL="${LB_MIRROR_DEBIAN_INSTALLER}/dists/${LB_DEBIAN_INSTALLER_DISTRIBUTION}/main/installer-${LB_ARCHITECTURES}/current/images/" + fi + ;; +esac + +mkdir -p "${DESTDIR_DI}" + +if [ "${LB_ARCHITECTURES}" = "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 + ${LB_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}" + + ${LB_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 [ "${LB_DEBIAN_INSTALLER_GUI}" = "true" ] + then + case "${LB_ARCHITECTURES}" in + amd64|i386) + DOWNLOAD_GTK_INSTALLER=1 + ;; + + powerpc) + if [ "${LB_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 + + mv chroot/var/lib/dpkg/status chroot/var/lib/dpkg/status.tmp + touch chroot/var/lib/dpkg/status + + case "${LB_ARCHITECTURES}" in + amd64) + DI_REQ_PACKAGES="lilo grub grub-pc" + + case "${LB_MODE}" in + ubuntu|kubuntu) + DI_PACKAGES="${DI_REQ_PACKAGES} linux-generic" + ;; + + *) + DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-amd64" + ;; + esac + ;; + + i386) + DI_REQ_PACKAGES="elilo lilo grub grub-pc" + + case "${LB_MODE}" in + ubuntu|kubuntu) + DI_PACKAGES="${DI_REQ_PACKAGES} linux-generic" + ;; + + *) + DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-486 linux-image-2.6-686" + ;; + esac + ;; + + sparc) + DI_REQ_PACKAGES="silo" + case "${LB_MODE}" in + ubuntu|kubuntu) + DI_PACKAGES="${DI_REQ_PACKAGES} linux-sparc64" + ;; + + *) + DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-sparc64 linux-image-2.6-sparc64-smp" + ;; + esac + ;; + + powerpc) + DI_REQ_PACKAGES="yaboot" + case "${LB_MODE}" in + ubuntu|kubuntu) + DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-powerpc linux-image-powerpc64-smp" + ;; + + *) + DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-powerpc linux-image-2.6-powerpc64 linux-image-2.6-powerpc-smp" + ;; + esac + ;; + esac + + DI_PACKAGES="${DI_PACKAGES} busybox cryptsetup mdadm lvm2" + + case "${LB_MODE}" in + debian) + DI_REQ_PACKAGES="${DI_REQ_PACKAGES} console-setup keyboard-configuration kbd" + DI_PACKAGES="${DI_PACKAGES} console-setup keyboard-configuration kbd" + ;; + esac + + # Include firmware packages + if [ "${LB_FIRMWARE_BINARY}" = "true" ] + then + # Assumption: firmware packages install files into /lib/firmware + + # Get all firmware packages names + mkdir -p cache/contents.binary + wget ${WGET_OPTIONS} ${LB_PARENT_MIRROR_CHROOT}/dists/${LB_PARENT_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz -O - | gunzip -c > cache/contents.binary/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES} + + FIRMWARE_PACKAGES="" + FIRMWARE_PACKAGES="$(awk '/^lib\/firmware/ { print $2 }' cache/contents.binary/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)" + + if [ "${LB_DERIVATIVE}" = "true" ] + then + wget {WGET_OPTIONS} ${LB_MIRROR_CHROOT}/dists/${LB_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz -O - | gunzip -c > cache/contents.binary/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES} + + FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.binary/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)" + fi + + # Filter out contrib packages if contrib is not enabled + if ! echo ${LB_ARCHIVE_AREAS} | grep -qs contrib + then + _FIRMWARE_PACKAGES="" + + for _PACKAGE in ${FIRMWARE_PACKAGES} + do + _FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | sed -e 's|^contrib/.*$||')" + done + + FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES}" + fi + + # Filter out non-free packages if non-free is not enabled + if ! echo ${LB_ARCHIVE_AREAS} | grep -qs non-free + then + _FIRMWARE_PACKAGES="" + + for _PACKAGE in ${FIRMWARE_PACKAGES} + do + _FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | sed -e 's|^non-free/.*$||')" + done + + FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES}" + + else + # Manually add firmware-linux/non-free meta package + FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} firmware-linux" + fi + + # Drop section and keep package names only + for _PACKAGE in ${FIRMWARE_PACKAGES} + do + DI_FIRMWARE_PACKAGES="${DI_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | awk -F/ '{ print $NF }')" + done + fi + + # Set apt command prefix + _LB_APT_COMMAND="apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb -o APT::Install-Recommends=false --download-only" + + if [ "${LB_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 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 ${_LB_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 ${_LB_APT_COMMAND} install ${DI_PACKAGES} ${DI_FIRMWARE_PACKAGES} ${DI_REQ_PACKAGES} + else + # Download .debs of the required packages + Chroot chroot ${_LB_APT_COMMAND} install ${DI_PACKAGES} ${DI_FIRMWARE_PACKAGES} + + # Revert dpkg status file + mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status + fi + + mv chroot/binary.deb ./ + + for _ARCHIVE_AREA in $(echo ${LB_PARENT_ARCHIVE_AREAS} ${LB_ARCHIVE_AREAS}) + do + mkdir -p binary/pool/${_ARCHIVE_AREA} + done + + if Find_files binary.deb/archives/*.deb + then + for FILE in binary.deb/archives/*.deb + do + Install_file "${FILE}" "binary/pool" + done + fi + + if [ "${LB_DEBIAN_INSTALLER}" != "live" ] + then + # Including base debian packages + if ls cache/packages.bootstrap/*.deb > /dev/null 2>&1 + then + for FILE in cache/packages.bootstrap/*.deb + do + Install_file "${FILE}" "binary/pool" + done + else + Echo_error "Could not find packages in cache/packages.bootstrap." + Echo_error "You selected values of LB_CACHE, LB_CACHE_PACKAGES, LB_CACHE_STAGES and LB_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/packages.binary/*_"${LB_ARCHITECTURES}".deb || Find_files config/packages/*_"${LB_ARCHITECTURES}".deb + then + for FILE in config/packages.binary/*_"${LB_ARCHITECTURES}".deb config/packages/*_"${LB_ARCHITECTURES}".deb + do + if [ -e "${FILE}" ] + then + Install_file "${FILE}" "binary/pool" + fi + done + fi + + if Find_files config/packages.binary/*_all.deb || Find_files config/packages/*_all.deb + then + for FILE in config/packages.binary/*_all.deb config/packages/*_all.deb + do + if [ -e "${FILE}" ] + then + Install_file "${FILE}" "binary/pool" + fi + done + fi + + # Generating deb indices + for _ARCHIVE_AREA in $(cd binary/pool && ls) + do + mkdir -p binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES} + + mv binary chroot/root + echo "cd /root/binary && apt-ftparchive packages pool/${_ARCHIVE_AREA} > dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES}/Packages" > chroot/binary.sh + Chroot chroot "sh binary.sh" + rm -f chroot/binary.sh + mv chroot/root/binary ./ + + gzip -9 -c binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES}/Packages > binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES}/Packages.gz + + # Fetching release + Download_file binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES}/Release "${LB_PARENT_MIRROR_CHROOT}"/dists/"${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}"/${_ARCHIVE_AREA}/binary-"${LB_ARCHITECTURES}"/Release + done + + # Symlink firmware packages to /firmware + if [ -n "${DI_FIRMWARE_PACKAGES}" ] + then + mkdir -p binary/firmware + cd binary/firmware + + for _PACKAGE in ${DI_FIRMWARE_PACKAGES} + do + for _FILE in $(find ../pool -name "${_PACKAGE}_*.deb") + do + ln -s ${_FILE} ./ + done + done + + cd "${OLDPWD}" + fi + + # Udeb handling + mkdir binary.udeb + cd binary.udeb + + # Downloading udeb indices + Download_file Packages.gz "${LB_PARENT_MIRROR_CHROOT}"/dists/"${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LB_ARCHITECTURES}"/Packages.gz + gunzip -c Packages.gz > Packages + + if [ "${LB_DERIVATIVE}" = "true" ] + then + Download_file Packages.derivative.gz "${LB_MIRROR_CHROOT}"/dists/"${LB_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LB_ARCHITECTURES}"/Packages.gz + gunzip -c Packages.derivative.gz > Packages.derivative + fi + + # Sorting udebs + if [ "${LB_DERIVATIVE}" = true ] + then + UDEBS="$(awk '/Filename: / { print $2 }' Packages.derivative)" + fi + + UDEBS="${UDEBS} $(awk '/Filename: / { print $2 }' Packages)" + + # Downloading udebs packages + Echo_message "Downloading udebs..." + + if [ "${LB_DERIVATIVE}" = "true" ] + then + Echo_message "Building in derivative mode in debian+ layout.. a lot of 404 errors are ok here." + fi + + for UDEB in ${UDEBS} + do + if [ -f ../cache/packages.binary_debian-installer.udeb/"$(basename ${UDEB})" ] + then + # Copying cached udebs + cp ../cache/packages.binary_debian-installer.udeb/"$(basename ${UDEB})" ./ + else + # Downloading udebs + if ! ls "$(basename ${UDEB} | awk -F_ '{ print $1 }')"_* > /dev/null 2>&1 + then + wget ${WGET_OPTIONS} "${LB_MIRROR_CHROOT}"/${UDEB} || wget ${WGET_OPTIONS} "${LB_PARENT_MIRROR_CHROOT}"/${UDEB} + fi + fi + done + + # Caching udebs + rm -rf ../cache/packages.binary_debian-installer.udeb + mkdir -p ../cache/packages.binary_debian-installer.udeb + cp *.udeb ../cache/packages.binary_debian-installer.udeb + + # Including local udebs + if Find_files ../config/packages.binary/*_"${LB_ARCHITECTURES}".udeb || Find_files ../config/packages/*_"${LB_ARCHITECTURES}".udeb + then + for FILE in ../config/packages.binary/*_"${LB_ARCHITECTURES}".udeb ../config/packages/*_"${LB_ARCHITECTURES}".udeb + do + if [ -e "${FILE}" ] + then + Install_file "${FILE}" "pool" + + # Prefer local udebs over downloaded udebs + rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb + fi + done + fi + + if Find_files ../config/packages.binary/*_all.udeb || Find_files ../config/packages/*_all.udeb + then + for FILE in ../config/packages.binary/*_all.udeb ../config/packages/*_all.udeb + do + if [ -e "${FILE}" ] + then + Install_file "${FILE}" "pool" + + # Prefer local udebs over downloaded udebs + rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb + fi + done + fi + + # Excluding udebs + for LOCATION in "${LIVE_BUILD}/data/debian-cd" /usr/share/live/build/data/debian-cd + do + if [ -e "${LOCATION}" ] + then + grep -v "^#" "${LOCATION}/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/udeb_exclude" > exclude || true + grep -v "^#" "${LOCATION}/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/exclude-udebs" >> exclude || true + grep -v "^#" "${LOCATION}/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/exclude-udebs-${LB_ARCHITECTURES}" >> exclude || true + + continue + fi + done + + # 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 [ "${LB_DEBIAN_INSTALLER}" = "live" ] && [ "${EXCLUDE}" = "live-installer" ] + then + continue + fi + + rm -f ${EXCLUDE}_*.udeb + done < exclude + + # 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/"${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LB_ARCHITECTURES}" + cd "${OLDPWD}" + + mv binary.udeb chroot/root + echo "cd /root/binary.udeb && apt-ftparchive packages pool/main > dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LB_ARCHITECTURES}/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/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LB_ARCHITECTURES}/Packages > dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LB_ARCHITECTURES}/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 + + eval _VERSION="$`echo RELEASE_${LB_PARENT_DISTRIBUTION}`" + + case "${LB_PARENT_DISTRIBUTION}" in + sid) + _SUITE="unstable" + ;; + + *) + _SUITE="${LB_PARENT_DISTRIBUTION}" + ;; + esac + +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="${_SUITE}" \ + -o APT::FTPArchive::Release::Version="${_VERSION}" \ + -o APT::FTPArchive::Release::Codename="${LB_PARENT_DISTRIBUTION}" \ + -o APT::FTPArchive::Release::Date="$(date -R)" \ + -o APT::FTPArchive::Release::Architectures="${LB_ARCHITECTURES}" \ + -o APT::FTPArchive::Release::Components="${LB_PARENT_ARCHIVE_AREAS}" \ + -o APT::FTPArchive::Release::Description="Last updated: $(date -R)" \ + release dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION} > dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/Release +EOF + + Chroot chroot "sh binary.sh" + rm -f chroot/binary.sh + mv chroot/root/binary ./ + + DISTRIBUTIONS="stable testing unstable" + + if [ "${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}" != "${LB_PARENT_DISTRIBUTION}" ] + then + DISTRIBUTIONS="${DISTRIBUTIONS} ${LB_PARENT_DISTRIBUTION}" + fi + + case "${LB_BINARY_IMAGES}" in + hdd) + case "${LB_BINARY_FILESYSTEM}" in + fat*|ntfs) + # Creating dist directories + for DISTRIBUTION in ${DISTRIBUTIONS} + do + cp -a binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION} binary/dists/${DISTRIBUTION} + done + ;; + esac + ;; + + *) + # Creating dist symlinks + for DISTRIBUTION in ${DISTRIBUTIONS} + do + ln -s ${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION} binary/dists/${DISTRIBUTION} + done + + ln -s . binary/debian + ;; + esac + + # 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/includes.binary_debian-installer if exists and not empty +if [ -d config/includes.binary_debian-installer ] && [ -n "$(ls -A config/includes.binary_debian-installer)" ] +then + Repack_initrd "${DESTDIR}"/"${INITRD_DI}" config/includes.binary_debian-installer + + if [ -e "${DESTDIR}"/"${INITRD_GI}" ] + then + Repack_initrd "${DESTDIR}"/"${INITRD_GI}" config/includes.binary_debian-installer + fi +fi + +# Saving cache +Save_cache cache/packages.binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .build/binary_debian-installer diff --git a/scripts/build/binary_disk b/scripts/build/binary_disk new file mode 100755 index 000000000..e8e5c0ddc --- /dev/null +++ b/scripts/build/binary_disk @@ -0,0 +1,203 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 "${LB_BINARY_IMAGES}" in + iso*|hdd*) + ;; + *) + exit 0 + ;; +esac + +Echo_message "Begin installing disk information..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_disk + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +mkdir -p binary/.disk + +ARCHITECTURE="$(echo ${LB_ARCHITECTURES} | sed -e 's| |/|g')" +DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')" +DISTRIBUTION="${DISTRIBUTION}$(echo ${LB_DISTRIBUTION} | cut -b 2-)" +eval VERSION="$`echo RELEASE_${LB_DISTRIBUTION}`" + +case "${LB_MODE}" in + debian) + TITLE="Debian GNU/Linux" + STRING="Official Snapshot ${ARCHITECTURE}" + TRACE="project/trace/ftp-master.debian.org" + ;; + + ubuntu) + TITLE="Ubuntu" + STRING="Build ${ARCHITECTURE}" + TRACE="" + ;; + + kubuntu) + TITLE="Kubuntu" + STRING="Build ${ARCHITECTURE}" + TRACE="" + ;; + + progress) + TITLE="Progress Linux" + STRING="${VERSION} (${DISTRIBUTION}) - ${ARCHITECTURE}" + TRACE="project/trace/archive-master.progress-linux.org" + ;; + + *) + TITLE="Debian GNU/Linux" + STRING="Snapshot ${ARCHITECTURE}" + TRACE="" + ;; +esac + +if [ -n "${TRACE}" ] +then + echo "$(wget -q ${LB_PARENT_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \ + > binary/.disk/archive_trace +fi + +case "${LB_INITRAMFS}" in + casper) + for INITRD in binary/casper/initrd.img* + do + mkdir -p binary/uuid + cd binary/uuid + + case "${LB_INITRAMFS_COMPRESSION}" in + gzip) + zcat "../../${INITRD}" | cpio --quiet -id conf/uuid.conf + ;; + + bzip2) + bzcat "../../${INITRD}" | cpio --quiet -id conf/uuid.conf + ;; + + lzma) + lzcat -S "" "../../${INITRD}" | cpio --quiet -id conf/uuid.conf + ;; + esac + + if [ -e conf/uuid.conf ] + then + mv conf/uuid.conf "../.disk/casper-uuid${INITRD#binary/casper/initrd.img}" + else + Echo_warning "Failed to find casper uuid.conf in '${INITRD}'" + fi + + cd ${OLDPWD} + rm -rf binary/uuid + done + ;; +esac + +case "${LB_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 + + for LOCATION in "${LIVE_BUILD}/data/debian-cd" /usr/share/live/build/data/debian-cd + do + if [ -e "${LOCATION}" ] + then + cp "${LOCATION}/${LB_PARENT_DISTRIBUTION}/${LB_ARCHITECTURES}_udeb_include" binary/.disk/udeb_include + + continue + fi + done + ;; + + true|netinst|live) + echo "main" > binary/.disk/base_components + + touch binary/.disk/base_installable + + if [ "${LB_DEBIAN_INSTALLER}" = "live" ] + then + echo "live" > binary/.disk/cd_type + echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/INSTALL Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info + else + echo "not_complete" > binary/.disk/cd_type + echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/NETINST Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info + fi + + for LOCATION in "${LIVE_BUILD}/data/debian-cd" /usr/share/live/build/data/debian-cd + do + if [ -e "${LOCATION}" ] + then + cp "${LOCATION}/${LB_PARENT_DISTRIBUTION}/${LB_ARCHITECTURES}_netinst_udeb_include" binary/.disk/udeb_include + + continue + fi + done + + if [ "${LB_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 + + for LOCATION in "${LIVE_BUILD}/data/debian-cd" /usr/share/live/build/data/debian-cd + do + if [ -e "${LOCATION}" ] + then + cp "${LOCATION}/${LB_PARENT_DISTRIBUTION}/${LB_ARCHITECTURES}_businesscard_udeb_include" binary/.disk/udeb_include + + continue + fi + done + ;; + + false) + echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info + ;; +esac + +# Creating stage file +Create_stagefile .build/binary_disk diff --git a/scripts/build/binary_grub b/scripts/build/binary_grub new file mode 100755 index 000000000..1dd1201e7 --- /dev/null +++ b/scripts/build/binary_grub @@ -0,0 +1,309 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTLOADER}" != "grub" ] +then + exit 0 +fi + +Echo_message "Begin installing grub..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_grub + +# Checking grub templates +Check_templates grub + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Check architecture +Check_architectures amd64 i386 +Check_crossarchitectures + +# Checking depends +Check_package chroot/usr/sbin/grub grub-legacy + +# 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} ${INITFS:+boot=${INITFS} }config LB_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} ${LB_BOOTAPPEND_INSTALL}" + LINUX_INSTALL="${LINUX_INSTALL}\ninitrd\t\t/${INITRD}" + done +} + +case "${LB_INITRAMFS}" in + casper) + INITFS="casper" + ;; + + live-boot) + INITFS="live" + ;; + + *) + INITFS="" + ;; +esac + +# Setting destination directory +case "${LB_BINARY_IMAGES}" in + iso*|tar) + case "${LB_INITRAMFS}" in + casper) + DESTDIR_LIVE="binary/casper" + ;; + + live-boot) + DESTDIR_LIVE="binary/live" + ;; + + *) + DESTDIR_LIVE="binary/boot" + ;; + esac + + DESTDIR_INSTALL="binary/install" + ;; + + hdd*|netboot) + Echo_warning "Bootloader in this image type not yet supported by live-build." + Echo_warning "This would produce a not bootable image, aborting (FIXME)." + exit 1 + ;; +esac + +Check_multiarchitectures + +# Creating directory +mkdir -p "${DESTDIR_LIVE}" + +# Setting boot parameters +if [ "${LB_UNION_FILESYSTEM}" != "aufs" ] +then + LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} union=${LB_UNION_FILESYSTEM}" +fi + +if [ -n "${LB_NET_COW_PATH}" ] +then + Echo_error "Net cow not yet supported on grub" + exit 1 +fi + +if [ "${LB_EXPOSED_ROOT}" != "false" ] +then + LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} exposedroot" +fi + +LB_BOOTAPPEND_LIVE="$(echo ${LB_BOOTAPPEND_LIVE} | sed -e 's| ||')" + +# Assembling kernel configuration + +# Default entries +DEFAULT_FLAVOUR="$(echo ${LB_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}" + +if [ "${LB_BOOTAPPEND_FAILSAFE}" != "none" ] +then + Grub_live_entry "live (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" "${LB_BOOTAPPEND_FAILSAFE}" +fi + +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}" "${LB_BOOTAPPEND_FAILSAFE}" +done + +LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" + +# Assembling debian-installer configuration +if [ "${LB_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/${VMLINUZ_DI}" ] && [ -f "binary/${INITRD_DI}" ] + then + Grub_install_entry "Text" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" + fi + + if [ -f "binary/${VMLINUZ_GI}" ] && [ -f "binary/${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${LB_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 ${LB_BINARY_IMAGES} in + iso*) + FILES="chroot/usr/lib/grub/*/stage2_eltorito" + ;; + + hdd*|tar) + FILES="chroot/usr/lib/grub/*/stage1 chroot/usr/lib/grub/*/e2fs_stage1_5 chroot/usr/lib/grub/*/stage2" + ;; +esac + +if [ "${LB_BUILD_WITH_CHROOT}" = "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 + LB_GRUB_SPLASH="config/binary_grub/splash.xpm.gz" +elif [ -f config/binary_grub/splash.xpm ] +then + LB_GRUB_SPLASH="config/binary_grub/splash.xpm" +fi + +if [ -n "${LB_GRUB_SPLASH}" ] +then + if [ "${LB_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 "${LB_GRUB_SPLASH}" binary/boot/grub + sed -i -e "s|splashimage.*|splashimage /boot/grub/$(basename ${LB_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|LB_BOOTAPPEND_INSTALL|${LB_BOOTAPPEND_INSTALL}|" -e "s|LB_BOOTAPPEND_LIVE|${LB_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 .build/binary_grub diff --git a/scripts/build/binary_grub2 b/scripts/build/binary_grub2 new file mode 100755 index 000000000..738f28006 --- /dev/null +++ b/scripts/build/binary_grub2 @@ -0,0 +1,279 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTLOADER}" != "grub2" ] +then + exit 0 +fi + +Echo_message "Begin installing grub2..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_grub + +# Checking grub2 templates +Check_templates grub2 + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Check architecture +Check_architectures amd64 i386 +Check_crossarchitectures + +# 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} ${INITFS:+boot=${INITFS} }config LB_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} LB_BOOTAPPEND_INSTALL" + LINUX_INSTALL="${LINUX_INSTALL}\ninitrd\t\t/${INITRD}" + LINUX_INSTALL="${LINUX_INSTALL}\n}" +} + +case "${LB_INITRAMFS}" in + casper) + INITFS="casper" + ;; + + live-boot) + INITFS="live" + ;; + + *) + INITFS="" + ;; +esac + +# Setting destination directory +case "${LB_BINARY_IMAGES}" in + iso*|tar) + case "${LB_INITRAMFS}" in + casper) + DESTDIR_LIVE="binary/casper" + ;; + + live-boot) + DESTDIR_LIVE="binary/live" + ;; + + *) + DESTDIR_LIVE="binary/live" + ;; + esac + + DESTDIR_INSTALL="binary/install" + ;; + + hdd*|netboot) + Echo_warning "Bootloader in this image type not yet supported by live-build." + Echo_warning "This would produce a not bootable image, aborting (FIXME)." + exit 1 + ;; +esac + +Check_multiarchitectures + +# Creating directory +mkdir -p "${DESTDIR_LIVE}" + +# Setting boot parameters +if [ "${LB_UNION_FILESYSTEM}" != "aufs" ] +then + LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} union=${LB_UNION_FILESYSTEM}" +fi + +if [ -n "${LB_NET_COW_PATH}" ] +then + Echo_error "Net cow not yet supported on grub" + exit 1 +fi + +if [ "${LB_EXPOSED_ROOT}" != "false" ] +then + LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} exposedroot" +fi + +LB_BOOTAPPEND_LIVE="$(echo ${LB_BOOTAPPEND_LIVE} | sed -e 's| ||')" + +# Assembling kernel configuration + +# Default entries +DEFAULT_FLAVOUR="$(echo ${LB_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}" + +if [ "${LB_BOOTAPPEND_FAILSAFE}" != "none" ] +then + Grub_live_entry "live (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" "${LB_BOOTAPPEND_FAILSAFE}" +fi + +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}" "${LB_BOOTAPPEND_FAILSAFE}" +done + +LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" + +# Assembling debian-installer configuration +if [ "${LB_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\"${LB_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 ${LB_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" + ;; + + hdd*|tar) + FILES="chroot/usr/lib/grub/i386-pc/*" + ;; +esac + +if [ "${LB_BUILD_WITH_CHROOT}" = "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 + LB_GRUB_SPLASH="config/binary_grub/splash.tga" +fi + +if [ -n "${LB_GRUB_SPLASH}" ] +then + if [ "${LB_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 "${LB_GRUB_SPLASH}" binary/boot/grub + sed -i -e "s|background_image .*.tga|background_image \$\(root\)/boot/grub/$(basename ${LB_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|LB_BOOTAPPEND_INSTALL|${LB_BOOTAPPEND_INSTALL}|" -e "s|LB_BOOTAPPEND_LIVE|${LB_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 .build/binary_grub diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd new file mode 100755 index 000000000..4dd515fee --- /dev/null +++ b/scripts/build/binary_hdd @@ -0,0 +1,314 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 hdd "${LB_BINARY_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building binary hdd image..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap .build/chroot_proc + +# Checking stage file +Check_stagefile .build/binary_hdd + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Checking depends +case "${LB_BINARY_FILESYSTEM}" in + fat*) + Check_package chroot/sbin/mkdosfs dosfstools + ;; + + ntfs) + case "${LB_PARENT_DISTRIBUTION}" in + squeeze) + Check_package chroot/sbin/mkfs.ntfs ntfsprogs + ;; + + *) + Check_package chroot/sbin/mkfs.nfts ntfs-3g + ;; + esac + ;; +esac + +Check_package chroot/usr/share/doc/mtools mtools +Check_package chroot/sbin/parted parted + +if [ "${LB_ARCHITECTURES}" = "sparc" ] +then + case "${LB_BINARY_FILESYSTEM}" in + ext2|ext3|ext4) + Check_package chroot/sbin/mkfs.${LB_BINARY_FILESYSTEM} e2fsprogs + ;; + + *) + Echo_error "Sparc only supports booting from ext2, ext3, ext4 or ufs." + exit 1 + ;; + esac +fi + +case "${LB_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 [ "${LB_BINARY_FILESYSTEM}" = "fat16" ] && [ -n "$(find binary -size +1999M)" ] +then + Echo_warning "FAT16 doesn't support files larger than 2GB, automatically enforcing FAT32." + + LB_BINARY_FILESYSTEM="fat32" + export LB_BINARY_FILESYSTEM +fi + +# Enforce fat32 if we have images in total bigger than 2GB +if [ "${LB_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" + + LB_BINARY_FILESYSTEM="fat32" + export LB_BINARY_FILESYSTEM +fi + +# Enforce ntfs if we find individual files bigger than 4GB +if [ "${LB_BINARY_FILESYSTEM}" = "fat32" ] && [ -n "$(find binary -size +3999M)" ] +then + Echo_warning "FAT32 doesn't support files larger than 4GB, automatically enforcing NTFS." + + LB_BINARY_FILESYSTEM="ntfs" + export LB_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} ${LB_BINARY_FILESYSTEM})" +dd if=/dev/zero of=chroot/binary.img bs=1024k count=0 seek=${REAL_DIM} +FREELO="$(${LB_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 "${LB_ARCHITECTURES}" in + sparc) + PARTITION_TABLE_TYPE="sun" + ;; + *) + PARTITION_TABLE_TYPE="msdos" + ;; +esac + +case "${LB_BINARY_FILESYSTEM}" in + ext2|ext3|ext4) + PARTITION_TYPE="ext2" + ;; + + fat16|fat32) + PARTITION_TYPE="${LB_BINARY_FILESYSTEM}" + ;; + + ntfs) + PARTITION_TYPE="NTFS" + ;; + + *) + Echo_error "Unsupported binary filesystem %s" "${LB_BINARY_FILESYSTEM}" + exit 1 + ;; +esac + +case "${LB_BUILD_WITH_CHROOT}" 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 [ "${LB_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 [ "${LB_BOOTLOADER}" = "syslinux" ] + then + dd if=/usr/lib/syslinux/mbr.bin of=${FREELO} bs=440 count=1 + fi + ;; +esac + +Lodetach ${FREELO} + +FREELO="$(${LB_LOSETUP} -f)" +Losetup $FREELO chroot/binary.img 1 + +case "${LB_BINARY_FILESYSTEM}" in + ext2|ext3|ext4) + MKFS="${LB_BINARY_FILESYSTEM}" + MKFS_OPTIONS="-L ${LB_HDD_LABEL} -m 0" + ;; + + fat16) + MKFS="vfat" + MKFS_OPTIONS="-F 16 -n ${LB_HDD_LABEL}" + ;; + + fat32) + MKFS="vfat" + MKFS_OPTIONS="-F 32 -n ${LB_HDD_LABEL}" + ;; + + ntfs) + MKFS="ntfs" + MKFS_OPTIONS="-L ${LB_HDD_LABEL}" + ;; +esac + +case "${LB_BUILD_WITH_CHROOT}" in + true) + Chroot chroot "mkfs.${MKFS} ${MKFS_OPTIONS} ${FREELO}" + ;; + + false) + mkfs.${MKFS} ${MKFS_OPTIONS} ${FREELO} + ;; +esac + +case "${LB_BINARY_FILESYSTEM}" in + fat*) + CP_OPTIONS="-L" + ;; +esac + +mkdir -p chroot/binary.tmp +${LB_ROOT_COMMAND} mount ${FREELO} chroot/binary.tmp +cp -r -T ${CP_OPTIONS} binary/ chroot/binary.tmp + +FIXME() +{ +if [ "${LB_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')" + hdddev="$(echo $rootpartition | sed -e 's|,[[:digit:]]||')" + echo "Root partition is $rootpartition, device is: $hdddev" + + echo "WAITING..." && read WAIT + +#cat > chroot/grub.sh << EOF +#grub --batch << EOM +#root $rootpartition +#setup $hdddev +#EOM +#EOF + +#Chroot chroot "sh grub.sh" + + rm -f chroot/grub.sh +fi +} + +${LB_ROOT_COMMAND} umount chroot/binary.tmp +rmdir chroot/binary.tmp + +if [ "${LB_BOOTLOADER}" = "syslinux" ] +then + case "${LB_BUILD_WITH_CHROOT}" in + true) + Chroot chroot "syslinux ${FREELO}" + ;; + + false) + syslinux ${FREELO} + ;; + esac +fi + +Lodetach ${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 .build/binary_hdd diff --git a/scripts/build/binary_hooks b/scripts/build/binary_hooks new file mode 100755 index 000000000..cd1270be5 --- /dev/null +++ b/scripts/build/binary_hooks @@ -0,0 +1,78 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'execute 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 hooks..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_hooks + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +## Processing distribution hooks + +# Running hooks +for _HOOK in ${LB_BINARY_HOOKS} +do + for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks + do + for FILE in "${LOCATION}"/???-"${_HOOK}".binary + do + if [ -e "${FILE}" ] + then + cd binary + ./"${FILE}" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;} + cd "${OLDPWD}" + fi + done + done +done + +## Processing local hooks + +if Find_files config/hooks/*.binary +then + for HOOK in config/hooks/*.binary + 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 .build/binary_hooks +fi diff --git a/scripts/build/binary_includes b/scripts/build/binary_includes new file mode 100755 index 000000000..f1f345a95 --- /dev/null +++ b/scripts/build/binary_includes @@ -0,0 +1,57 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 includes..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/includes.binary + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if Find_files config/includes.binary/ +then + # Copying includes + cd config/includes.binary + find . | cpio -dmpu --no-preserve-owner "${OLDPWD}"/binary + cd "${OLDPWD}" + + # Removing symlinks + case "${LB_BINARY_IMAGES}" in + hdd*) + find binary -type l | xargs rm -f + ;; + esac + + # Creating stage file + Create_stagefile .build/binary_includes +fi diff --git a/scripts/build/binary_iso b/scripts/build/binary_iso new file mode 100755 index 000000000..c25674bbb --- /dev/null +++ b/scripts/build/binary_iso @@ -0,0 +1,235 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 + +case "${LB_BINARY_IMAGES}" in + iso) + IMAGE="binary.iso" + ;; + + iso-hybrid) + IMAGE="binary.hybrid.iso" + ;; + + *) + exit 0 + ;; +esac + +Echo_message "Begin building binary iso image..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_iso + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Checking depends +Check_package chroot/usr/bin/genisoimage genisoimage + +if [ "${LB_BINARY_IMAGES}" = "iso-hybrid" ] +then + Check_package chroot/usr/bin/isohybrid syslinux +fi + +# Restoring cache +Restore_cache cache/packages.binary + +# Installing depends +Install_package + +# Remove old iso image +if [ -f ${IMAGE} ] +then + rm -f ${IMAGE} +fi + +# Handle genisoimage generic options +GENISOIMAGE_OPTIONS="-J -l -cache-inodes -allow-multidot" + +# Handle genisoimage live-build specific options +if [ "${_QUIET}" = "true" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -quiet" +fi + +if [ "${_VERBOSE}" = "true" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v" +fi + +if [ -n "${LB_ISO_APPLICATION}" ] && [ "${LB_ISO_APPLICATION}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LB_ISO_APPLICATION}\"" +fi + +if [ -n "${LB_ISO_PREPARER}" ] && [ "${LB_ISO_PREPARER}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LB_ISO_PREPARER}\"" +fi + +if [ -n "${LB_ISO_PUBLISHER}" ] && [ "${LB_ISO_PUBLISHER}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LB_ISO_PUBLISHER}\"" +fi + +if [ -n "${LB_ISO_VOLUME}" ] && [ "${LB_ISO_VOLUME}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LB_ISO_VOLUME}\"" +fi + +# Handle genisoimage architecture specific options +case "${LB_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" + case "${LB_MODE}" in + progress) + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b boot/boot.bin -c boot/boot.cat" + GENISOIMAGE_EXCLUDE="boot/boot.bin" + ;; + + *) + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b isolinux/isolinux.bin -c isolinux/boot.cat" + GENISOIMAGE_EXCLUDE="isolinux/isolinux.bin" + ;; + esac + ;; + + 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-build." + Echo_warning "This will produce a most likely not bootable image (Continuing in 5 seconds)." + sleep 5 + ;; +esac + +#if [ "${LB_DEBIAN_INSTALLER}" != "live" ] +#then +# GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m ${GENISOIMAGE_EXCLUDE}" +#fi + +if [ "${LB_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} -O i386-pc 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 ${IMAGE} binary +EOF + +if [ "${LB_BINARY_IMAGES}" = "iso-hybrid" ] +then + +cat >> binary.sh << EOF + +isohybrid ${ISOHYBRID_OPTIONS} ${IMAGE} +EOF + +fi + +case "${LB_BUILD_WITH_CHROOT}" in + true) + # Moving image + mv binary.sh chroot + mv binary chroot + + Chroot chroot "sh binary.sh" + + # Move image + mv chroot/binary chroot/${IMAGE} ./ + 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 .build/binary_iso diff --git a/scripts/build/binary_linux-image b/scripts/build/binary_linux-image new file mode 100755 index 000000000..94afac8f9 --- /dev/null +++ b/scripts/build/binary_linux-image @@ -0,0 +1,92 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ] || [ "${LB_LINUX_PACKAGES}" = "none" ] +then + exit 0 +fi + +Echo_message "Begin install linux-image..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_linux-image + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +case "${LB_INITRAMFS}" in + casper) + DESTDIR="binary/casper" + ;; + + live-boot) + DESTDIR="binary/live" + ;; + + *) + DESTDIR="binary/boot" + ;; +esac + +case "${LB_ARCHITECTURES}" in + powerpc) + LINUX="vmlinux" + ;; + + *) + LINUX="vmlinuz" + ;; +esac + +Check_multiarchitectures + +# Creating directory +mkdir -p "${DESTDIR}" + +# Installing linux-image +if [ "${LB_LINUX_PACKAGES}" != "none" ] +then + cp chroot/boot/"${LINUX}"-* "${DESTDIR}" + cp chroot/boot/initrd.img-* "${DESTDIR}" +fi + +case "${LB_INITRAMFS}" in + live-boot) + if [ -e chroot/usr/share/doc/live-boot/parameters.txt ] + then + cp chroot/usr/share/doc/live-boot/parameters.txt "${DESTDIR}"/parameters + fi + ;; +esac + +# Creating stage file +Create_stagefile .build/binary_linux-image diff --git a/scripts/build/binary_manifest b/scripts/build/binary_manifest new file mode 100755 index 000000000..b62a43754 --- /dev/null +++ b/scripts/build/binary_manifest @@ -0,0 +1,71 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + +Echo_message "Begin creating manifest..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_manifest + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +case "${LB_INITRAMFS}" in + casper) + INITFS="casper" + SUFFIX="manifest" + ;; + + live-boot) + INITFS="live" + SUFFIX="packages" + ;; + + *) + INITFS="boot" + SUFFIX="packages" + ;; +esac + +# Add filesystem.packages +cp chroot.packages.live "binary/${INITFS}/filesystem.${SUFFIX}" +echo "$(diff chroot.packages.live chroot.packages.install | awk '/^< / { print $2 }')" \ + > "binary/${INITFS}/filesystem.${SUFFIX}-remove" + +cp chroot.packages.live binary.packages + +# Creating stage file +Create_stagefile .build/binary_manifest diff --git a/scripts/build/binary_memtest b/scripts/build/binary_memtest new file mode 100755 index 000000000..d96c778d2 --- /dev/null +++ b/scripts/build/binary_memtest @@ -0,0 +1,124 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ] || [ "${LB_MEMTEST}" = "false" ] || [ "${LB_MEMTEST}" = "none" ] +then + exit 0 +fi + +Echo_message "Begin installing memtest..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_memtest + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ "${LB_ARCHITECTURES}" != "amd64" ] && [ "${LB_ARCHITECTURES}" != "i386" ] +then + Echo_warning "skipping binary_memtest, foreign architecture." + exit 0 +fi + +if [ "${LB_BUILD_WITH_CHROOT}" = "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 "${LB_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 "${LB_INITRAMFS}" in + casper) + DESTDIR="binary/casper" + ;; + + live-boot) + DESTDIR="binary/live" + ;; + + *) + DESTDIR="binary/boot" + ;; +esac + +Check_multiarchitectures + +# Creating directory +mkdir -p "${DESTDIR}" + +# Installing memtest +case "${LB_BUILD_WITH_CHROOT}" in + true) + cp chroot/boot/${LB_MEMTEST}.bin "${DESTDIR}"/memtest + ;; + + false) + cp /boot/${LB_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 .build/binary_memtest diff --git a/scripts/build/binary_netboot b/scripts/build/binary_netboot new file mode 100755 index 000000000..08cc9d308 --- /dev/null +++ b/scripts/build/binary_netboot @@ -0,0 +1,183 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 netboot "${LB_BINARY_IMAGES}" +then + exit 0 +fi + +if [ "${LB_NET_TARBALL}" = "false" ] +then + exit 0 +fi + +Echo_message "Begin building binary netboot image..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_netboot + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ "${LB_ARCHITECTURES}" = "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 "${LB_INITRAMFS}" in + casper) + ORIGDIR="binary/casper" + ;; + + live-boot) + ORIGDIR="binary/live" + ;; + + *) + ORIGDIR="binary/boot" + ;; + esac + + # Find defaults + DEFAULT_FLAVOUR="$(echo ${LB_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.netboot.tar binary.netboot.tar.gz binary.netboot.tar.bz2 binary.netboot.tar.xz binary.netboot.tar.xz + +# Creating image file +ROOT_DIR=$(basename ${LB_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 + +# Moving kernel and initrd image arround +mkdir tftpboot/live +mv */live/vmlinuz* */live/initrd* tftpboot/live + +tar cf ../binary.netboot.tar * + +case "${LB_COMPRESSION}" in + bzip2) + bzip2 ${BZIP2_OPTIONS} ../binary.netboot.tar + ;; + + gzip) + gzip ${GZIP_OPTIONS} ../binary.netboot.tar + ;; + + lzip) + lzip ${LZIP_OPTIONS} ../binary.netboot.tar + ;; + + xz) + xz ${XZ_OPTIONS} ../binary.netboot.tar + ;; + + none) + ;; +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 .build/binary_netboot diff --git a/scripts/build/binary_package-lists b/scripts/build/binary_package-lists new file mode 100755 index 000000000..86716785d --- /dev/null +++ b/scripts/build/binary_package-lists @@ -0,0 +1,144 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 package lists..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_package-lists + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if ls config/package-lists/*.list > /dev/null 2>&1 || \ + ls config/package-lists/*.list.binary > /dev/null 2>&1 +then + # Restoring cache + Restore_cache cache/packages.chroot + + # Check depends + Check_package chroot/usr/bin/apt-ftparchive apt-utils + Check_package chroot/usr/bin/grep-aptavail dctrl-tools + + # Installing depends + Install_package + + if [ -e "${LIVE_BUILD}/share/bin/Packages" ] + then + cp "${LIVE_BUILD}/share/bin/Packages" chroot/bin + else + cp /usr/share/live/build/bin/Packages chroot/bin + fi + + 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 LIST in config/package-lists/*.list \ + config/package-lists/*.list.binary + do + if [ -e "${LIST}" ] + then + # Generate package list + Expand_packagelist "${LIST}" "config/package-lists" > chroot/root/"$(basename ${LIST})" + + # Downloading additional packages + Chroot chroot "xargs --arg-file=/root/$(basename ${LIST}) apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb --download-only install" + + # Remove package list + rm chroot/root/"$(basename ${LIST})" + fi + done + + for FILE in chroot/binary.deb/archives/*.deb + do + SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')" + SECTION="$(dpkg -f ${FILE} Section | 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 + + if echo "${SECTION}" | grep -qs contrib + then + SECTION="contrib" + elif echo "${SECTION}" | grep -qs non-free + then + SECTION="non-free" + else + SECTION="main" + fi + + # Install directory + mkdir -p binary/pool/${SECTION}/"${LETTER}"/"${SOURCE}" + + # Move files + mv "${FILE}" binary/pool/${SECTION}/"${LETTER}"/"${SOURCE}" + done + + cd binary + + for SECTION in pool/* + do + SECTION="$(basename ${SECTION})" + + mkdir -p dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES} + apt-ftparchive packages pool/${SECTION} > dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages + gzip -9 -c dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages > dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages.gz + done + + cd "${OLDPWD}" + + rm -f chroot/bin/Packages + + 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 .build/binary_package-lists +fi diff --git a/scripts/build/binary_rootfs b/scripts/build/binary_rootfs new file mode 100755 index 000000000..6704b524a --- /dev/null +++ b/scripts/build/binary_rootfs @@ -0,0 +1,508 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap .build/binary_chroot + +# Checking stage file +Check_stagefile .build/binary_rootfs + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +case "${LB_ARCHITECTURES}" in + amd64|i386) + LINUX="vmlinuz" + ;; + + powerpc) + LINUX="vmlinux" + ;; +esac + +case "${LB_INITRAMFS}" in + casper) + INITFS="casper" + ;; + + live-boot) + INITFS="live" + ;; + + *) + INITFS="boot" + ;; +esac + +# Creating directory +mkdir -p binary/${INITFS} + +for STAGE in ${LB_CACHE_STAGES} +do + if [ "${STAGE}" = "rootfs" ] && [ -d cache/binary_rootfs ] + then + # Removing old chroot + rm -rf binary/"${INITFS}"/filesystem.* + + # Restoring old cache + mkdir -p binary/"${INITFS}" + ${LB_ROOT_COMMAND} cp -a cache/binary_rootfs/filesystem.* binary/"${INITFS}" + + if [ -n "${LB_ROOT_COMMAND}" ] + then + ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) binary + fi + + # Creating stage file + Create_stagefile .build/binary_rootfs + exit 0 + fi +done + +case "${LB_CHROOT_FILESYSTEM}" in + ext2|ext3|ext4) + # Checking depends + Check_package chroot/sbin/mkfs.${LB_CHROOT_FILESYSTEM} e2fsprogs + + # Restoring cache + Restore_cache cache/packages.binary + + # Installing depends + Install_package + + # Remove old image + if [ -f binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} ] + then + rm -f binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} + fi + + case "${LB_BUILD_WITH_CHROOT}" in + true) + DU_DIM="$(du -ms chroot/chroot | cut -f1)" + INODES="$(find chroot/chroot | wc -l)" + ;; + + false) + DU_DIM="$(du -ms chroot | cut -f1)" + INODES="$(find chroot | wc -l)" + ;; + esac + + REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LB_CHROOT_FILESYSTEM})" + REAL_INODES="$(Calculate_partition_size ${INODES} ${LB_CHROOT_FILESYSTEM})" + + case "${LB_BUILD_WITH_CHROOT}" in + true) + dd if=/dev/zero of=chroot/filesystem.${LB_CHROOT_FILESYSTEM} bs=1024k count=0 seek=${REAL_DIM} + + if ! Chroot chroot "test -s /etc/mtab" + then + Chroot chroot "ln -s /proc/mounts/mtab /etc/mtab" + FAKE_MTAB="true" + fi + + Chroot chroot "mkfs.${LB_CHROOT_FILESYSTEM} -F -b 1024 -N ${REAL_INODES} -m 0 filesystem.${LB_CHROOT_FILESYSTEM}" + + mkdir -p filesystem.tmp + ${LB_ROOT_COMMAND} mount -o loop chroot/filesystem.${LB_CHROOT_FILESYSTEM} filesystem.tmp + cp -a chroot/chroot/* filesystem.tmp + + if [ "${FAKE_MTAB}" = "true" ] + then + Chroot chroot "rm -f /etc/mtab" + fi + + ${LB_ROOT_COMMAND} umount filesystem.tmp + rmdir filesystem.tmp + + # Move image + mv chroot/filesystem.${LB_CHROOT_FILESYSTEM} binary/${INITFS} + + case "${LB_MODE}" in + ubuntu|kubuntu) + du -B 1 -s chroot/chroot | cut -f1 > binary/${INITFS}/filesystem.size + ;; + esac + + if [ -e chroot/chroot.cache ] + then + rm -f .lock + mv chroot/chroot chroot.tmp + + lb chroot_archives binary remove ${@} + lb chroot_apt remove ${@} + lb chroot_hostname remove ${@} + lb chroot_resolv remove ${@} + lb chroot_hosts remove ${@} + lb chroot_sysv-rc remove ${@} + lb chroot_upstart remove ${@} + lb chroot_dpkg remove ${@} + lb chroot_debianchroot remove ${@} + lb chroot_sysfs remove ${@} + lb chroot_selinuxfs remove ${@} + lb chroot_proc remove ${@} + lb chroot_devpts remove ${@} + + rm -rf chroot + mv chroot.tmp chroot + + lb chroot_devpts install ${@} + lb chroot_proc install ${@} + lb chroot_selinuxfs install ${@} + lb chroot_sysfs install ${@} + lb chroot_debianchroot install ${@} + lb chroot_dpkg install ${@} + lb chroot_sysv-rc install ${@} + lb chroot_upstart install ${@} + lb chroot_hosts install ${@} + lb chroot_resolv install ${@} + lb chroot_hostname install ${@} + lb chroot_apt install ${@} + lb chroot_archives binary install ${@} + + touch .lock + else + rm -rf chroot/chroot + + # Removing depends + Remove_package + fi + ;; + + false) + dd if=/dev/zero of=binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} bs=1024k count=0 seek=${REAL_DIM} + mkfs.${LB_CHROOT_FILESYSTEM} -F -b 1024 -N ${REAL_INODES} -m 0 binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} + + mkdir -p filesystem.tmp + ${LB_ROOT_COMMAND} mount -o loop binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} filesystem.tmp + cp -a chroot/* filesystem.tmp + + ${LB_ROOT_COMMAND} umount filesystem.tmp + rmdir filesystem.tmp + ;; + esac + + # Saving cache + Save_cache cache/packages.binary + ;; + + 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 "${LB_JFFS2_ERASEBLOCK}" ] + then + JFFS2_OPTIONS="--eraseblock=${LB_JFFS2_ERASEBLOCK}" + fi + + case "${LB_BUILD_WITH_CHROOT}" 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 + + lb chroot_archives binary remove ${@} + lb chroot_apt remove ${@} + lb chroot_hostname remove ${@} + lb chroot_resolv remove ${@} + lb chroot_hosts remove ${@} + lb chroot_sysv-rc remove ${@} + lb chroot_upstart remove ${@} + lb chroot_dpkg remove ${@} + lb chroot_debianchroot remove ${@} + lb chroot_sysfs remove ${@} + lb chroot_selinuxfs remove ${@} + lb chroot_proc remove ${@} + lb chroot_devpts remove ${@} + + rm -rf chroot + mv chroot.tmp chroot + + lb chroot_devpts install ${@} + lb chroot_proc install ${@} + lb chroot_selinuxfs install ${@} + lb chroot_sysfs install ${@} + lb chroot_debianchroot install ${@} + lb chroot_dpkg install ${@} + lb chroot_sysv-rc install ${@} + lb chroot_upstart install ${@} + lb chroot_hosts install ${@} + lb chroot_resolv install ${@} + lb chroot_hostname install ${@} + lb chroot_apt install ${@} + lb chroot_archives binary install ${@} + + touch .lock + else + rm -rf chroot/chroot + + # Removing depends + Remove_package + fi + ;; + + false) + mkfs.jffs2 ${JFFS2_OPTIONS} --root=chroot --output binary/${INITFS}/filesystem.jffs2 + ;; + esac + + # Saving cache + Save_cache cache/packages.binary + ;; + + plain) + if [ -d binary/${INITFS}/filesystem.dir ] + then + rm -rf binary/${INITFS}/filesystem.dir + fi + + case "${LB_BUILD_WITH_CHROOT}" 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" + + case "${LB_BUILD_WITH_CHROOT}" in + true) + cp config/binary_rootfs/squashfs.sort chroot + ;; + + false) + cp config/binary_rootfs/squashfs.sort . + ;; + esac + fi + + case "${LB_PARENT_DISTRIBUTION}" in + squeeze) + + ;; + + *) + # FIXME: artax-backports too, once d-i has catched up + MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -comp xz" + ;; + esac + + case "${LB_BUILD_WITH_CHROOT}" in + true) + if [ -e config/binary_rootfs/excludes ] + then + cp config/binary_rootfs/excludes chroot/excludes + + MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -wildcards -ef /excludes" + fi + + # Create image + Chroot chroot "mksquashfs chroot filesystem.squashfs ${MKSQUASHFS_OPTIONS}" + + rm -f chroot/chroot/excludes + + case "${LB_MODE}" in + ubuntu|kubuntu) + du -B 1 -s chroot/chroot | cut -f1 > binary/${INITFS}/filesystem.size + ;; + esac + + # Move image + ${LB_ROOT_COMMAND} mv chroot/filesystem.squashfs binary/${INITFS} + ${LB_ROOT_COMMAND} rm -f chroot/squashfs.sort + + if [ -e chroot/chroot.cache ] + then + rm -f .lock + mv chroot/chroot chroot.tmp + + lb chroot_archives binary remove ${@} + lb chroot_apt remove ${@} + lb chroot_hostname remove ${@} + lb chroot_resolv remove ${@} + lb chroot_hosts remove ${@} + lb chroot_sysv-rc remove ${@} + lb chroot_upstart remove ${@} + lb chroot_dpkg remove ${@} + lb chroot_debianchroot remove ${@} + lb chroot_sysfs remove ${@} + lb chroot_selinuxfs remove ${@} + lb chroot_proc remove ${@} + lb chroot_devpts remove ${@} + + rm -rf chroot + mv chroot.tmp chroot + + lb chroot_devpts install ${@} + lb chroot_proc install ${@} + lb chroot_selinuxfs install ${@} + lb chroot_sysfs install ${@} + lb chroot_debianchroot install ${@} + lb chroot_dpkg install ${@} + lb chroot_sysv-rc install ${@} + lb chroot_upstart install ${@} + lb chroot_hosts install ${@} + lb chroot_resolv install ${@} + lb chroot_hostname install ${@} + lb chroot_apt install ${@} + lb chroot_archives binary install ${@} + + touch .lock + else + rm -rf chroot/chroot + + # Removing depends + Remove_package + fi + + ${LB_ROOT_COMMAND} chmod 0644 binary/${INITFS}/filesystem.squashfs + ;; + + false) + if [ -e config/binary_rootfs/excludes ] + then + MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -wildcards -ef config/binary_rootfs/excludes" + fi + + mksquashfs chroot binary/${INITFS}/filesystem.squashfs ${MKSQUASHFS_OPTIONS} + + case "${LB_MODE}" in + ubuntu|kubuntu) + du -B 1 -s chroot | cut -f1 > binary/${INITFS}/filesystem.size + ;; + esac + ;; + esac + + if [ -n "${LB_ROOT_COMMAND}" ] + then + ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) binary/${INITFS} + fi + + # Saving cache + Save_cache cache/packages.binary + ;; + + none) + if [ -d binary ] + then + rm -rf binary + fi + + case "${LB_BUILD_WITH_CHROOT}" in + true) + mv chroot/chroot binary + ;; + + false) + Echo_message "This may take a while." + cp -a chroot binary + ;; + esac + ;; + +esac + +for STAGE in ${LB_CACHE_STAGES} +do + if [ "${STAGE}" = "rootfs" ] + then + rm -rf cache/binary_rootfs + + mkdir -p cache/binary_rootfs + + if [ "${LB_CHROOT_FILESYSTEM}" != "none" ] + then + ${LB_ROOT_COMMAND} cp -a binary/"${INITFS}"/filesystem.* cache/binary_rootfs + fi + + if [ -n "${LB_ROOT_COMMAND}" ] + then + ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/binary_rootfs + fi + fi +done + +# Creating stage file +Create_stagefile .build/binary_rootfs diff --git a/scripts/build/binary_silo b/scripts/build/binary_silo new file mode 100755 index 000000000..b1ec175e4 --- /dev/null +++ b/scripts/build/binary_silo @@ -0,0 +1,239 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTLOADER}" != "silo" ] +then + exit 0 +fi + +# Check image type +case "${LB_BINARY_IMAGES}" in + iso*|hdd*|tar) + ;; + + netboot) + # silo not required for sparc netbooting + exit 0 + ;; +esac + +Echo_message "Begin installing silo..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_silo + +# Checking silo templates +Check_templates silo + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Check architecture +Check_architectures 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=\"${INITFS:+boot=${INITFS} }config LB_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=\"LB_BOOTAPPEND_LIVE ${APPEND} LB_BOOTAPPEND_INSTALL\"\n" +} + +# Setting destination directories +DESTDIR_INSTALL="binary/install" +case "${LB_INITRAMFS}" in + casper) + INITFS="casper" + DESTDIR_LIVE="binary/casper" + ;; + + live-boot) + INITFS="live" + DESTDIR_LIVE="binary/live" + ;; + + *) + INITFS="" + DESTDIR_LIVE="binary/boot" + ;; +esac + +# Creating directory +mkdir -p "${DESTDIR_LIVE}" + +# Setting boot parameters +if [ "${LB_UNION_FILESYSTEM}" != "aufs" ] +then + LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} union=${LB_UNION_FILESYSTEM}" +fi + +if [ -n "${LB_NET_COW_PATH}" ] +then + Echo_error "Net cow not supported on silo" + exit 1 +fi + +if [ "${LB_EXPOSED_ROOT}" != "false" ] +then + LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} exposedroot" +fi + +LB_BOOTAPPEND_LIVE="$(echo ${LB_BOOTAPPEND_LIVE} | sed -e 's| ||')" + +# Assembling kernel configuration + +# Default entries +DEFAULT_FLAVOUR="$(echo ${LB_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}" + +if [ "${LB_BOOTAPPEND_FAILSAFE}" != "none" ] +then + Silo_live_entry "live-failsafe" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" "${LB_BOOTAPPEND_FAILSAFE}" +fi + +if [ "$(echo ${LB_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}" "${LB_BOOTAPPEND_FAILSAFE}" + done +fi + +LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" + +# Assembling debian-installer configuration +if [ "${LB_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 "${LB_BINARY_IMAGES}" in + iso*|hdd*) + # Copying silo + mkdir -p binary/boot + + case "${LB_BUILD_WITH_CHROOT}" in + true) + cp chroot/boot/second.b binary/boot + ;; + + false) + cp /boot/second.b binary/boot + ;; + esac + + cp -r "${TEMPLATES}"/* binary/boot + + if [ "${LB_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|LB_BOOTAPPEND_INSTALL|${LB_BOOTAPPEND_INSTALL}|" \ + -e "s|LB_BOOTAPPEND_LIVE|${LB_BOOTAPPEND_LIVE}|" \ + binary/boot/silo.conf + sed -i -e "s|LB_DATE|$(date +%Y%m%d)|" \ + -e "s|LB_VERSION|${VERSION}|" \ + -e "s|LB_DISTRIBUTION|${LB_DISTRIBUTION}|" \ + binary/boot/debian.txt + ;; +esac + +# Saving cache +Save_cache cache/packages.binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .build/binary_silo diff --git a/scripts/build/binary_syslinux b/scripts/build/binary_syslinux new file mode 100755 index 000000000..cf9c4a2c6 --- /dev/null +++ b/scripts/build/binary_syslinux @@ -0,0 +1,366 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTLOADER}" != "syslinux" ] +then + exit 0 +fi + +Echo_message "Begin installing syslinux..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_syslinux + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Check architecture +Check_architectures amd64 i386 +Check_crossarchitectures + +# Assembling image specifics +case "${LB_BINARY_IMAGES}" in + iso*) + _BOOTLOADER="isolinux" + + case "${LB_MODE}" in + progress) + _TARGET="binary/boot" + ;; + + *) + _TARGET="binary/isolinux" + ;; + esac + ;; + + netboot) + _BOOTLOADER="pxelinux" + _TARGET="tftpboot" + ;; + + hdd*|*) + _BOOTLOADER="syslinux" + + case "${LB_MODE}" in + progress) + _TARGET="binary/boot" + ;; + + *) + _TARGET="binary/syslinux" + ;; + esac + ;; +esac + +# Checking depends +case "${LB_BUILD_WITH_CHROOT}" in + true) + Check_package chroot/usr/bin/syslinux syslinux + Check_package chroot/usr/lib/syslinux syslinux-common + + case "${LB_SYSLINUX_THEME}" in + live-build) + Check_package chroot/usr/bin/rsvg librsvg2-bin + ;; + + *) + Check_package chroot/usr/share/syslinux/themes/${LB_SYSLINUX_THEME} syslinux-themes-${LB_SYSLINUX_THEME} + + case "${LB_MODE}" in + ubuntu) + Check_package chroot/usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz gfxboot-theme-ubuntu + ;; + esac + ;; + esac + ;; + + false) + if [ ! -e /usr/bin/syslinux ] + then + # syslinux + Echo_error "/usr/bin/syslinux - no such file." + exit 1 + fi + + if [ ! -e /usr/lib/syslinux ] + then + # syslinux-common + Echo_error "/usr/lib/syslinux - no such directory" + exit 1 + fi + + case "${LB_SYSLINUX_THEME}" in + live-build) + if [ ! -e /usr/bin/rsvg ] + then + # librsvg2-bin + Echo_error "/usr/bin/rsvg - no such file" + exit 1 + fi + ;; + + *) + if [ ! -e /usr/share/syslinux/themes/${LB_SYSLINUX_THEME} ] + then + # syslinux-theme + Echo_error "/usr/share/syslinux/themes/${LB_SYSLINUX_THEME} - no such directory." + exit 1 + fi + ;; + esac + ;; +esac + +# Restoring cache +Restore_cache cache/packages.binary + +# Installing depends +Install_package + +# FIXME: cleanup, unify, and extend themes for ${_BOOTLOADER}-live and ${_BOOTLOADER}-installer +if [ "${LB_SYSLINUX_THEME}" = "live-build" ] +then + if [ -e "config/bootloaders/${_BOOTLOADER}" ] + then + # Internal local copy + _SOURCE="config/bootloaders/${_BOOTLOADER}" + else + # Internal system copy + if [ -n "${LIVE_BUILD}" ] + then + _SOURCE="${LIVE_BUILD}/share/bootloaders/${_BOOTLOADER}" + else + _SOURCE="/usr/share/live/build/bootloaders/${_BOOTLOADER}" + fi + fi +else + # External copy from chroot or system + _SOURCE="/usr/share/syslinux/themes/${LB_SYSLINUX_THEME}/${_BOOTLOADER}-live" +fi + +# Copying files +case "${LB_BUILD_WITH_CHROOT}" in + true) + mkdir -p $(dirname ${_TARGET}) + + # Copy in two steps since the theme can have absolute symlinks and would therefore not be dereferenced correctly + if [ "${LB_SYSLINUX_THEME}" = "live-build" ] + then + cp -a ${_SOURCE} chroot/root + Chroot chroot cp -aL /root/$(basename ${_SOURCE}) /root/$(basename ${_SOURCE}).tmp + rm -rf chroot/$(basename ${_SOURCE}) + else + Chroot chroot cp -aL ${_SOURCE} /root/$(basename ${_SOURCE}).tmp + fi + + case "${LB_MODE}" in + ubuntu) + Chroot chroot "tar xfz /usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz -C /root/$(basename ${_SOURCE}).tmp" + ;; + esac + + mv chroot/root/$(basename ${_SOURCE}).tmp ${_TARGET} + ;; + + false) + mkdir -p ${_TARGET} + + cp -aL ${_SOURCE}/* ${_TARGET} + + case "${LB_MODE}" in + ubuntu) + tar xfz /usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz -C ${_TARGET} + ;; + esac + ;; +esac + +# Configuring files +if [ -e "${_TARGET}/live.cfg.in" ] +then + # This is all rather suboptimal.. needs prettifying at some point + _FLAVOURS="$(echo ${LB_LINUX_FLAVOURS} | wc -w)" + + case "${_FLAVOURS}" in + 1) + mv binary/live/vmlinuz-* binary/live/vmlinuz + mv binary/live/initrd.img-* binary/live/initrd.img + + sed -e "s|@FLAVOUR@|${LB_LINUX_FLAVOURS}|g" \ + -e "s|@KERNEL@|/live/vmlinuz|g" \ + -e "s|@INITRD@|/live/initrd.img|g" \ + -e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \ + -e "s|@LB_BOOTAPPEND_FAILSAFE@|${LB_BOOTAPPEND_FAILSAFE}|g" \ + "${_TARGET}/live.cfg.in" >> "${_TARGET}/live.cfg" + + rm -f "${_TARGET}/live.cfg.in" + ;; + + *) + _NUMBER="0" + + for _FLAVOUR in ${LB_LINUX_FLAVOURS} + do + _NUMBER="$((${_NUMBER} + 1))" + + mv binary/live/vmlinuz-*-${_FLAVOUR} binary/live/vmlinuz${_NUMBER} + mv binary/live/initrd.img-*-${_FLAVOUR} binary/live/initrd${_NUMBER}.img + + sed -e "s|@FLAVOUR@|${_FLAVOUR}|g" \ + -e "s|@KERNEL@|/live/vmlinuz${_NUMBER}|g" \ + -e "s|@INITRD@|/live/initrd${_NUMBER}.img|g" \ + -e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \ + -e "s|@LB_BOOTAPPEND_FAILSAFE@|${LB_BOOTAPPEND_FAILSAFE}|g" \ + "${_TARGET}/live.cfg.in" >> "${_TARGET}/live.cfg" + done + + rm -f "${_TARGET}/live.cfg.in" + ;; + esac +elif [ -e "${_TARGET}/live.cfg" ] +then + sed -i -e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \ + -e "s|@LB_BOOTAPPEND_FAILSAFE@|${LB_BOOTAPPEND_FAILSAFE}|g" \ + ${_TARGET}/live.cfg +fi + +if [ -e ${_TARGET}/install.cfg ] +then + sed -i -e "s|@LB_BOOTAPPEND_INSTALL@|${LB_BOOTAPPEND_INSTALL}|g" \ + ${_TARGET}/install.cfg +fi + +if [ -e "${_TARGET}/splash.svg.in" ] +then + case "${LB_MODE}" in + progress) + _PROJECT="Progress Linux" + + if ls config/package-lists/client-gnome.list* + then + _DESCRIPTION="Client GNOME" + elif ls config/package-lists/client-lxde.list* > /dev/null 2>&1 + then + _DESCRIPTION="Client LXDE" + elif ls config/package-lists/server-lxc.list* > /dev/null 2>&1 + then + _DESCRIPTION="Server LXC" + else + _DESCRIPTION="Standard" + fi + ;; + + *) + _PROJECT="Debian GNU/Linux" + _DESCRIPTION="" + ;; + + esac + + eval _VERSION="$`echo RELEASE_${LB_DISTRIBUTION}`" + _DISTRIBUTION="${LB_DISTRIBUTION}" + _ARCHITECTURE="${LB_ARCHITECTURES}" + _DATE=$(date -R) + _YEAR="$(date +%Y)" + _MONTH="$(date +%m)" + _DAY="$(date +%d)" + _HOUR="$(date +%H)" + _MINUTE="$(date +%M)" + _SECOND="$(date +%S)" + _LINUX_VERSIONS="$(for _LINUX in chroot/boot/vmlinuz-* ; do chroot chroot apt-cache policy $(basename ${_LINUX} | sed -e 's|vmlinuz-|linux-image-|') | awk '/Installed: / { print $2 }' ; done | sort -u)" + _LIVE_BUILD_VERSION="$(lb --version)" + _LIVE_BOOT_VERSION="$(chroot chroot apt-cache policy live-boot | awk '/Installed: / { print $2 }')" + _LIVE_CONFIG_VERSION="$(chroot chroot apt-cache policy live-config | awk '/Installed: / { print $2 }')" + _LIVE_TOOLS_VERSION="$(chroot chroot apt-cache policy live-tools | awk '/Installed: / { print $2 }')" + + sed -e "s|@PROJECT@|${_PROJECT}|g" \ + -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \ + -e "s|@VERSION@|${_VERSION}|g" \ + -e "s|@ARCHITECTURE@|${_ARCHITECTURE}|g" \ + -e "s|@DESCRIPTION@|${_DESCRIPTION}|g" \ + -e "s|@DATE@|${_DATE}|g" \ + -e "s|@YEAR@|${_YEAR}|g" \ + -e "s|@MONTH@|${_MONTH}|g" \ + -e "s|@DAY@|${_DAY}|g" \ + -e "s|@HOUR@|${_HOUR}|g" \ + -e "s|@MINUTE@|${_MINUTE}|g" \ + -e "s|@SECOND@|${_SECOND}|g" \ + -e "s|@LINUX_VERSIONS@|${_LINUX_VERSIONS}|g" \ + -e "s|@LIVE_BUILD_VERSION@|${_LIVE_BUILD_VERSION}|g" \ + -e "s|@LIVE_BOOT_VERSION@|${_LIVE_BOOT_VERSION}|g" \ + -e "s|@LIVE_CONFIG_VERSION@|${_LIVE_CONFIG_VERSION}|g" \ + -e "s|@LIVE_TOOLS_VERSION@|${_LIVE_TOOLS_VERSION}|g" \ + "${_TARGET}/splash.svg.in" > "${_TARGET}/splash.svg" + + case "${LB_BUILD_WITH_CHROOT}" in + true) + cp "${_TARGET}/splash.svg" chroot + Chroot chroot "rsvg --format png --height 480 --width 640 splash.svg splash.png" + mv chroot/splash.png "${_TARGET}" + rm -f chroot/splash.svg + ;; + + false) + rsvg --format png --height 480 --width 640 "${_TARGET}/splash.svg" "${_TARGET}/splash.png" + ;; + esac + + rm -f "${_TARGET}/splash.svg.in" "${_TARGET}/splash.svg" +fi + +case "${LB_MODE}" in + progress) + for _FILE in "${_TARGET}/isolinux.bin" "${_TARGET}/isolinux.cfg" "${_TARGET}/syslinux.cfg" + do + if [ -e "${_FILE}" ] + then + mv "${_FILE}" "${_TARGET}/$(echo ${_FILE} | sed -e 's|.*linux|boot|')" + fi + done + ;; +esac + +case "${LB_BUILD_WITH_CHROOT}" in + true) + # Saving cache + Save_cache cache/packages.binary + + # Removing depends + Remove_package + ;; +esac + +# Creating stage file +Create_stagefile .build/binary_syslinux diff --git a/scripts/build/binary_tar b/scripts/build/binary_tar new file mode 100755 index 000000000..9b9b3dec0 --- /dev/null +++ b/scripts/build/binary_tar @@ -0,0 +1,73 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 "${LB_BINARY_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building binary harddisk image..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_tar + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Remove old binary +rm -f binary.tar.bz2 binary.tar.gz binary.tar.lz binary.tar + +tar cf binary-tar.tar binary + +case "${LB_COMPRESSION}" in + bzip2) + bzip2 ${BZIP2_OPTIONS} binary-tar.tar + ;; + + gzip) + gzip ${GZIP_OPTIONS} binary-tar.tar + ;; + + lzip) + lzip ${LZIP_OPTIONS} binary-tar.tar + ;; + + xz) + xz ${XZ_OPTIONS} binary-tar.tar + ;; + + none) + ;; +esac + +# Creating stage file +Create_stagefile .build/binary_tar diff --git a/scripts/build/binary_virtual-hdd b/scripts/build/binary_virtual-hdd new file mode 100755 index 000000000..f8121e625 --- /dev/null +++ b/scripts/build/binary_virtual-hdd @@ -0,0 +1,111 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 "${LB_BINARY_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building binary virtual-hdd image..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap .build/chroot_proc + +# Checking stage file +Check_stagefile .build/binary_virtual-hdd + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] +then + case "${LB_BINARY_FILESYSTEM}" in + ext2|ext3|ext4) + Check_package chroot/sbin/mkfs.${LB_BINARY_FILESYSTEM} 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=${LB_HDD_SIZE} + +if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] +then + mv binary-virtual.img chroot + + # hack to recreate mtab from chroot_hacks if its gone for some reason + if ! Chroot chroot "test -s /etc/mtab" + then + Chroot chroot "rm -f /etc/mtab" + Chroot chroot "ln -s /proc/mounts /etc/mtab" + fi + + case "${LB_BINARY_FILESYSTEM}" in + ext2|ext3|ext4) + Chroot chroot "mkfs.${LB_BINARY_FILESYSTEM} -F binary-virtual.img" + ;; + esac + + mv chroot/binary-virtual.img ./ +else + case "${LB_BINARY_FILESYSTEM}" in + ext2|ext3|ext4) + mkfs.${LB_BINARY_FILESYSTEM} . -F binary-virtual.img + ;; + esac +fi + +mkdir -p binary.tmp +${LB_ROOT_COMMAND} mount -o loop binary-virtual.img binary.tmp +cp -a binary/* binary.tmp +cp -af binary/.disk* binary.tmp + +${LB_ROOT_COMMAND} umount binary.tmp +rmdir binary.tmp + +# Saving cache +Save_cache cache/packages.binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .build/binary_virtual-hdd diff --git a/scripts/build/binary_win32-loader b/scripts/build/binary_win32-loader new file mode 100755 index 000000000..7fd5ff2a4 --- /dev/null +++ b/scripts/build/binary_win32-loader @@ -0,0 +1,103 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_WIN32_LOADER}" != "true" ] || [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ] +then + exit 0 +fi + +Echo_message "Begin copying win32-loader..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_win32-loader + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +case "${LB_ARCHITECTURES}" in + amd64|i386) + if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] + then + # Checking depends + Check_package chroot/usr/share/win32/win32-loader.exe win32-loader + + # Restoring cache + Restore_cache cache/packages.binary + + # Installing depends + Install_package + + # Copying win32-loader + cp -r chroot/usr/share/win32/* binary + else + cp -r usr/share/win32/* binary + fi + + mv binary/win32-loader.exe binary/setup.exe + + if [ -e binary/win32-loader-standalone.exe ] + then + mv binary/win32-loader-standalone.exe binary/setup-standalone.exe + fi + + if [ "${LB_DEBIAN_INSTALLER}" != "false" ] + then + +cat > binary/win32-loader.ini << EOF +[installer] +arch=${LB_ARCHITECTURES} +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 .build/binary_win32-loader diff --git a/scripts/build/binary_yaboot b/scripts/build/binary_yaboot new file mode 100755 index 000000000..4838cf351 --- /dev/null +++ b/scripts/build/binary_yaboot @@ -0,0 +1,284 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTLOADER}" != "yaboot" ] +then + exit 0 +fi + +Echo_message "Begin installing yaboot..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_yaboot + +# Checking yaboot templates +Check_templates yaboot + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Check architecture +Check_architectures powerpc ppc64 +Check_crossarchitectures + +# 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=\"${INITFS:+boot=${INITFS} }config LB_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} ${LB_BOOTAPPEND_INSTALL}\"\n" + LINUX_INSTALL="${LINUX_INSTALL}\tinitrd-size=10240\n" + done +} + +case "${LB_INITRAMFS}" in + casper) + INITFS="casper" + ;; + + live-boot) + INITFS="live" + ;; + + *) + INITFS="" + ;; +esac + +# Setting destination directory +case "${LB_BINARY_IMAGES}" in + iso*) + case "${LB_INITRAMFS}" in + casper) + DESTDIR_LIVE="binary/casper" + ;; + + live-boot) + DESTDIR_LIVE="binary/live" + ;; + + *) + DESTDIR_LIVE="binary/boot" + ;; + esac + + DESTDIR_INSTALL="binary/install" + ;; + + hdd*|netboot|tar) + Echo_error "not yet supported, aborting (FIXME)." + exit 1 + ;; +esac + +Check_multiarchitectures + +# Creating directory +mkdir -p "${DESTDIR_LIVE}" + +# Setting boot parameters +if [ "${LB_UNION_FILESYSTEM}" != "aufs" ] +then + LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} union=${LB_UNION_FILESYSTEM}" +fi + +if [ -n "${LB_NET_COW_PATH}" ] +then + Echo_error "Net cow not yet supported on yaboot" + exit 1 +fi + +if [ "${LB_EXPOSED_ROOT}" != "false" ] +then + LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} exposedroot" +fi + +LB_BOOTAPPEND_LIVE="$(echo ${LB_BOOTAPPEND_LIVE} | sed -e 's| ||')" + +# Assembling kernel configuration + +# Default entries +DEFAULT_FLAVOUR="$(echo ${LB_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}" + +if [ "${LB_BOOTAPPEND_FAILSAFE}" != "none" ] +then + Yaboot_live_entry "live-failsafe" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" "${LB_BOOTAPPEND_FAILSAFE}" +fi + +if [ "$(echo ${LB_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}" "${LB_BOOTAPPEND_FAILSAFE}" + done +fi + +LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" + +# Assembling debian-installer configuration +if [ "${LB_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 "${LB_BINARY_IMAGES}" in + iso*|hdd*) + # Copying yaboot + mkdir -p binary/yaboot + + case "${LB_BUILD_WITH_CHROOT}" in + true) + cp chroot/usr/lib/yaboot/yaboot binary/yaboot + ;; + + false) + cp /usr/lib/yaboot/yaboot binary/yaboot + ;; + esac + + cp -r "${TEMPLATES}"/* binary/yaboot + + case "${LB_BINARY_IMAGES}" in + hdd*) + 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 + ;; + esac + + # 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|LB_BOOTAPPEND_INSTALL|${LB_BOOTAPPEND_INSTALL}|" -e "s|LB_BOOTAPPEND_LIVE|${LB_BOOTAPPEND_LIVE}|" binary/yaboot/yaboot.conf + sed -i -e "s|LB_DATE|$(date +%Y%m%d)|" -e "s|LB_VERSION|${VERSION}|" binary/yaboot/boot.msg + ;; +esac + +# Saving cache +Save_cache cache/packages.binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .build/binary_yaboot diff --git a/scripts/build/binary_zsync b/scripts/build/binary_zsync new file mode 100755 index 000000000..7fdaf596a --- /dev/null +++ b/scripts/build/binary_zsync @@ -0,0 +1,125 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'build zsync control files')" +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 [ "${LB_ZSYNC}" != "true" ] +then + exit 0 +fi + +Echo_message "Begin building zsync control files..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/binary_zsync + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Checking depends +Check_package chroot/usr/bin/zsyncmake zsync + +# Restoring cache +Restore_cache cache/packages.binary + +# Installing depends +Install_package + +case "${LB_BINARY_IMAGES}" in + iso) + _IMAGES="binary.iso" + ;; + + iso-hybrid) + _IMAGES="binary.hybrid.iso" + ;; + + hdd) + _IMAGES="binary.img" + ;; + + net) + _IMAGES="binary.netboot.tar*" + ;; + + tar) + _IMAGES="binary.tar*" + ;; +esac + +for _IMAGE in ${_IMAGES} +do + if [ -e "${_IMAGE}" ] + then + case "${LB_BUILD_WITH_CHROOT}" in + true) + mv ${_IMAGE} chroot + Chroot chroot "zsyncmake -C -b 2048 -u ${_IMAGE} ${_IMAGE}" + mv chroot/${_IMAGE} chroot/${_IMAGE}.zsync ./ + ;; + + false) + zsyncmake -C -b 2048 -u "${_IMAGE}" "${_IMAGE}" + ;; + esac + + case "${LB_COMPRESSION}" in + bzip2) + bzip2 ${BZIP2_OPTIONS} ${_IMAGE}.zsync + ;; + + gzip) + gzip ${GZIP_OPTIONS} ${_IMAGE}.zsync + ;; + + lzip) + lzip ${LZIP_OPTIONS} ${_IMAGE}.zsync + ;; + + xz) + xz ${XZ_OPTIONS} ${_IMAGE}.zsync + ;; + + none) + ;; + esac + fi +done + +#CHECKSUMS + +# Saving cache +Save_cache cache/packages.binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .build/binary_zsync diff --git a/scripts/build/bootstrap b/scripts/build/bootstrap new file mode 100755 index 000000000..ed9c77498 --- /dev/null +++ b/scripts/build/bootstrap @@ -0,0 +1,49 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Automatically populating config tree +if [ -x auto/config ] && [ ! -e .build/config ] +then + Echo_message "Automatically populating config tree." + lb config +fi + +# 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 +lb bootstrap_cache restore ${@} +lb bootstrap_copy ${@} +lb bootstrap_cdebootstrap ${@} +lb bootstrap_debootstrap ${@} +lb bootstrap_cache save ${@} + +# Temporary hack until we have multistrap in place +case "${LB_MODE}" in + progress) + echo '0.0.0' > chroot/etc/progress_version + ;; +esac diff --git a/scripts/build/bootstrap_cache b/scripts/build/bootstrap_cache new file mode 100755 index 000000000..6b0f582ea --- /dev/null +++ b/scripts/build/bootstrap_cache @@ -0,0 +1,96 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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_crossarchitectures + +for STAGE in ${LB_CACHE_STAGES} +do + if [ "${STAGE}" = "bootstrap" ] + then + case "${1}" in + restore) + Echo_message "Restoring bootstrap stage from cache..." + + # Checking stage file + Check_stagefile .build/bootstrap_cache.restore + + if [ -d cache/bootstrap ] + then + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Removing old chroot + rm -rf chroot + + # Restoring old cache + ${LB_ROOT_COMMAND} cp -a cache/bootstrap chroot + + if [ -n "${LB_ROOT_COMMAND}" ] + then + ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot + fi + + # Creating stage file + Create_stagefile .build/bootstrap_cache.restore + Create_stagefile .build/bootstrap + + exit 0 + fi + ;; + + save) + Echo_message "Saving bootstrap stage to cache..." + + # Checking stage file + Check_stagefile .build/bootstrap_cache.save + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + rm -rf cache/bootstrap + + mkdir -p cache + + ${LB_ROOT_COMMAND} cp -a chroot cache/bootstrap + + if [ -n "${LB_ROOT_COMMAND}" ] + then + ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/bootstrap + fi + + # Creating stage file + Create_stagefile .build/bootstrap_cache.save + ;; + esac + fi +done diff --git a/scripts/build/bootstrap_cdebootstrap b/scripts/build/bootstrap_cdebootstrap new file mode 100755 index 000000000..3c8843e2b --- /dev/null +++ b/scripts/build/bootstrap_cdebootstrap @@ -0,0 +1,139 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTSTRAP}" != "cdebootstrap" ] && [ "${LB_BOOTSTRAP}" != "cdebootstrap-static" ] +then + exit 0 +fi + +if [ ! -x "$(which cdebootstrap 2>/dev/null)" ] +then + echo "E: cdebootstrap - command not found"; \ + echo "I: cdebootstrap can be optained from http://ftp.debian.org/debian/pool/main/d/cdebootstrap/"; \ + echo "I: On Debian based systems, cdebootstrap can be installed with 'apt-get install debootstrap'."; \ + exit 1 +fi + +# Check architecture +Check_crossarchitectures + +Echo_message "Begin bootstrapping system..." + +Check_package /usr/bin/${LB_BOOTSTRAP} cdebootstrap + +# Ensure that a system is built as root +lb testroot + +# Checking stage file +Check_stagefile .build/bootstrap +Check_stagefile .build/bootstrap_cache.restore + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Creating chroot directory +mkdir -p chroot + +# Temporarily including bzip2 manually until #657560 has been fixed in unstable +CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --include=bzip2" + +# Setting cdebootstrap options +if [ -n "${LB_ARCHITECTURES}" ] +then + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --arch=${LB_ARCHITECTURES}" +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 [ "${LB_APT_SECURE}" = "false" ] +then + CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --allow-unauthenticated" +fi + +if [ -x "/usr/bin/cdebootstrap" ] || [ -x "/usr/bin/cdebootstrap-static" ] +then + if [ "${LB_CACHE_PACKAGES}" = "true" ] + then + if ls cache/packages.bootstrap/*.deb > /dev/null 2>&1 + then + mkdir -p chroot/var/cache/bootstrap + cp cache/packages.bootstrap/*.deb chroot/var/cache/bootstrap + fi + + Echo_breakage "Running ${LB_BOOTSTRAP} (download-only)... " + ${LB_ROOT_COMMAND} ${LB_BOOTSTRAP} ${CDEBOOTSTRAP_OPTIONS} --download-only "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" + + if [ -n "${LB_ROOT_COMMAND}" ] + then + ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot + fi + + # Removing old cache + rm -f cache/packages.bootstrap/*.deb + + # Saving new cache + mkdir -p cache/packages.bootstrap + cp chroot/var/cache/bootstrap/*.deb cache/packages.bootstrap + fi + + Echo_breakage "Running ${LB_BOOTSTRAP}... " + ${LB_ROOT_COMMAND} ${LB_BOOTSTRAP} ${CDEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" + + if [ -n "${LB_ROOT_COMMAND}" ] + then + ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot + fi + + # 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 .build/bootstrap +else + Echo_error "Can't process file /usr/bin/${LB_BOOTSTRAP} (FIXME)" + exit 1 +fi diff --git a/scripts/build/bootstrap_copy b/scripts/build/bootstrap_copy new file mode 100755 index 000000000..1028342c6 --- /dev/null +++ b/scripts/build/bootstrap_copy @@ -0,0 +1,56 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTSTRAP}" != "copy" ] +then + exit 0 +fi + +# Check architecture +Check_crossarchitectures + +Echo_message "Begin bootstrapping system..." + +# Ensure that a system is built as root +lb testroot + +# Checking stage file +Check_stagefile .build/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 .build/bootstrap diff --git a/scripts/build/bootstrap_debootstrap b/scripts/build/bootstrap_debootstrap new file mode 100755 index 000000000..b0fa09fa1 --- /dev/null +++ b/scripts/build/bootstrap_debootstrap @@ -0,0 +1,158 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTSTRAP}" != "debootstrap" ] +then + exit 0 +fi + +if [ ! -x "$(which debootstrap 2>/dev/null)" ] +then + echo "E: debootstrap - command not found"; \ + echo "I: debootstrap can be optained from http://ftp.debian.org/debian/pool/main/d/debootstrap/"; \ + echo "I: On Debian based systems, debootstrap can be installed with 'apt-get install debootstrap'."; \ + exit 1 +fi + +# Check architecture +Check_crossarchitectures + +Echo_message "Begin bootstrapping system..." + +Check_package /usr/sbin/debootstrap debootstrap + +# Ensure that a system is built as root +lb testroot + +# Checking stage file +Check_stagefile .build/bootstrap +Check_stagefile .build/bootstrap_cache.restore + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Creating chroot directory +mkdir -p chroot + +# Temporarily including bzip2 manually until #657560 has been fixed in unstable +DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --include=bzip2" + +# Setting debootstrap options +if [ -n "${LB_ARCHITECTURES}" ] +then + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --arch=${LB_ARCHITECTURES}" +fi + +if [ "${LB_ARCHIVE_AREAS}" != "main" ] +then + # Modify archive areas to remove leading/trailing whitespaces and replace other whitepspace with commas + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --components=$(echo ${LB_ARCHIVE_AREAS} | sed -e 's| |,|g')" +fi + +case "${LB_USE_FAKEROOT}" in + true) + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=fakechroot" + ;; +esac + +if [ "${_VERBOSE}" = "true" ] +then + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --verbose" +fi + +# If LB_APT_SECURE is false, do not check signatures of the Release file +# (requires debootstrap >= 1.0.30) +if [ "${LB_APT_SECURE}" = "false" ] && /usr/sbin/debootstrap --help | grep -qs '\-\-no-check-gpg' +then + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --no-check-gpg" +fi + +if [ -x "/usr/sbin/debootstrap" ] +then + if [ "${LB_CACHE_PACKAGES}" = "true" ] + then + if ls cache/packages.bootstrap/*.deb > /dev/null 2>&1 + 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)... " + ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" + + if [ -n "${LB_ROOT_COMMAND}" ] + then + ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot + fi + + # Removing old cache + rm -f cache/packages.bootstrap/*.deb + + # Saving new cache + mkdir -p cache/packages.bootstrap + cp chroot/var/cache/apt/archives/*.deb cache/packages.bootstrap + fi + + Echo_breakage "Running debootstrap... " + + # Run appropriate bootstrap, i.e. foreign or regular bootstrap + if [ "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" = "${LB_ARCHITECTURES}" ]; then + + if [ -n "${LB_BOOTSTRAP_QEMU_EXCLUDE}" ] + then + DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LB_BOOTSTRAP_QEMU_EXCLUDE} | sed 's| *|,|g')" + fi + + Echo_message "Bootstrap will be foreign" + ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --foreign "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" + + Echo_message "Running debootstrap second stage under QEMU" + cp ${LB_BOOTSTRAP_QEMU_STATIC} chroot/usr/bin + Chroot chroot /bin/sh /debootstrap/debootstrap --second-stage + else + ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" + fi + + if [ -n "${LB_ROOT_COMMAND}" ] + then + ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot + fi + + # Deconfiguring debootstrap configurations + rm -f chroot/etc/hosts + + # Removing bootstrap cache + rm -f chroot/var/cache/apt/archives/*.deb + + # Creating stage file + Create_stagefile .build/bootstrap +else + Echo_error "Can't process file /usr/bin/debootstrap (FIXME)" + exit 1 +fi diff --git a/scripts/build/build b/scripts/build/build new file mode 100755 index 000000000..d7b989dec --- /dev/null +++ b/scripts/build/build @@ -0,0 +1,77 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Automatically populating config tree +if [ -x auto/config ] && [ ! -e .build/config ] +then + Echo_message "Automatically populating config tree." + lb config +fi + +# Read meta config +if [ "${1}" != "noauto" ] && [ -x auto/build ] +then + Echo_message "Executing auto/build script." + ./auto/build "${@}" + exit ${?} +fi + +if [ "${1}" = "noauto" ] +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 +lb bootstrap ${@} + +# Customizing chroot +lb chroot ${@} + +# Building binary images +lb binary ${@} + +# Building source images +lb source ${@} diff --git a/scripts/build/chroot b/scripts/build/chroot new file mode 100755 index 000000000..1c6348293 --- /dev/null +++ b/scripts/build/chroot @@ -0,0 +1,92 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Automatically populating config tree +if [ -x auto/config ] && [ ! -e .build/config ] +then + Echo_message "Automatically populating config tree." + lb config +fi + +# 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 +lb chroot_cache restore ${@} +lb chroot_devpts install ${@} +lb chroot_proc install ${@} +lb chroot_selinuxfs install ${@} +lb chroot_sysfs install ${@} +lb chroot_debianchroot install ${@} +lb chroot_dpkg install ${@} +lb chroot_tmpfs install ${@} +lb chroot_sysv-rc install ${@} +lb chroot_upstart install ${@} +lb chroot_hosts install ${@} +lb chroot_resolv install ${@} +lb chroot_hostname install ${@} +lb chroot_apt install ${@} +lb chroot_archives chroot install ${@} + +# Customizing chroot +lb chroot_linux-image ${@} +lb chroot_preseed ${@} + +for _PASS in install live +do + lb chroot_package-lists ${_PASS} ${@} + lb chroot_install-packages ${_PASS} ${@} + + if [ "${_PASS}" = install ] + then + Chroot chroot "dpkg-query -W" > chroot.packages.install + fi +done + +lb chroot_live-packages ${@} +lb chroot_includes ${@} +lb chroot_hooks ${@} +lb chroot_hacks ${@} +lb chroot_interactive ${@} + +Chroot chroot "dpkg-query -W" > chroot.packages.live + +# Deconfiguring chroot +lb chroot_archives chroot remove ${@} +lb chroot_apt remove ${@} +lb chroot_hostname remove ${@} +lb chroot_resolv remove ${@} +lb chroot_hosts remove ${@} +lb chroot_sysv-rc remove ${@} +lb chroot_upstart remove ${@} +lb chroot_tmpfs remove ${@} +lb chroot_dpkg remove ${@} +lb chroot_debianchroot remove ${@} +lb chroot_sysfs remove ${@} +lb chroot_selinuxfs remove ${@} +lb chroot_proc remove ${@} +lb chroot_devpts remove ${@} +lb chroot_cache save ${@} diff --git a/scripts/build/chroot_apt b/scripts/build/chroot_apt new file mode 100755 index 000000000..2e1bce289 --- /dev/null +++ b/scripts/build/chroot_apt @@ -0,0 +1,335 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap + +case "${1}" in + install|install-binary) + Echo_message "Configuring file /etc/apt/apt.conf" + + # Checking stage file + Check_stagefile .build/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 "${LB_APT_FTP_PROXY}" ] + then + echo "Acquire::ftp::Proxy \"${LB_APT_FTP_PROXY}\";" > chroot/etc/apt/apt.conf.d/00ftp-proxy + fi + + # Configuring apt http proxy + if [ -n "${LB_APT_HTTP_PROXY}" ] + then + echo "Acquire::http::Proxy \"${LB_APT_HTTP_PROXY}\";" > chroot/etc/apt/apt.conf.d/00http-proxy + fi + + # Configuring apt pipeline + if [ -n "${LB_APT_PIPELINE}" ] + then + echo "Acquire::http::Pipeline-Depth \"${LB_APT_PIPELINE}\";" > chroot/etc/apt/apt.conf.d/00pipeline + fi + + # Configuring apt recommends + case "${LB_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 "${LB_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_apt/*.pref + then + for _FILE in config/chroot_apt/*.pref + do + if [ -f chroot/etc/apt/preferences.d/$(basename ${_FILE}) ] + then + mv chroot/etc/apt/preferences.d/$(basename ${_FILE}) chroot/etc/apt/preferences.d/$(basename ${_FILE}).orig + fi + + cp -aL ${_FILE} chroot/etc/apt/preferences.d + done + fi + + if Find_files config/packages.chroot/*.deb || Find_files config/packages/*.deb + then + echo >> chroot/etc/apt/preferences + echo "# Added by lb_chroot_apt ${@}" >> chroot/etc/apt/preferences + echo "Package: *" >> chroot/etc/apt/preferences + echo "Pin: release o=config/packages.chroot" >> 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 lb_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 + + case "${LB_MODE}" in + progress) + if [ ! -e chroot/etc/apt/preferences.d/progress.pref ] + then + _DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | sed -e 's|-backports||')" + + _ENABLE_DISTRIBUTIONS="${_DISTRIBUTION}" + _DISABLE_DISTRIBUTIONS="" + + if [ "${LB_SECURITY}" = "true" ] + then + _ENABLE_DISTRIBUTIONS="${_ENABLE_DISTRIBUTIONS} ${_DISTRIBUTION}-security" + fi + + if [ "${LB_VOLATILE}" = "true" ] + then + _ENABLE_DISTRIBUTIONS="${_ENABLE_DISTRIBUTIONS} ${_DISTRIBUTION}-updates" + fi + + case "${LB_DISTRIBUTION}" in + *-backports) + if [ "${LB_BACKPORTS}" = "true" ] + then + _ENABLE_DISTRIBUTIONS="${_ENABLE_DISTRIBUTIONS} ${_DISTRIBUTION}-backports" + fi + ;; + + *) + if [ "${LB_BACKPORTS}" = "true" ] + then + _DISABLE_DISTRIBUTIONS="${_DISABLE_DISTRIBUTIONS} ${_DISTRIBUTION}-backports" + fi + ;; + esac + + for _DISTRIBUTION in ${_ENABLE_DISTRIBUTIONS} + do + +cat >> chroot/etc/apt/preferences.d/progress.pref << EOF + +Package: * +Pin: release n=${_DISTRIBUTION} +Pin-Priority: 999 +EOF + + done + + for _DISTRIBUTION in ${_DISABLE_DISTRIBUTIONS} + do + +cat >> chroot/etc/apt/preferences.d/progress.pref << EOF + +#Package: * +#Pin: release n=${_DISTRIBUTION} +#Pin-Priority: 999 +EOF + + done + + # Add temporary hack to avoid squashfs version mismatch + case "${LB_DISTRIBUTION}" in + artax-backports) + +cat >> chroot/etc/apt/preferences.d/progress.tmp.pref << EOF +Package: squashfs-tools +Pin: release n=squeeze +Pin-Priority: 1001 +EOF + + ;; + esac + fi + ;; + esac + + # Creating stage file + Create_stagefile .build/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 pipeline + rm -f chroot/etc/apt/apt.conf.d/00pipeline + + # Deconfiguring aptitude recommends + if [ "${LB_APT_RECOMMENDS}" = "true" ] + then + rm -f chroot/etc/apt/apt.conf.d/00recommends + fi + + # Deconfiguring aptitude secure + if [ "${LB_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_apt/*.pref + then + for _FILE in config/chroot_apt/*.pref + do + if [ -f chroot/etc/apt/preferences.d/$(basename ${_FILE}) ] + then + mv chroot/etc/apt/preferences.d/$(basename ${_FILE}) chroot/etc/apt/preferences.d/$(basename ${_FILE}).orig + fi + + cp -aL ${_FILE} chroot/etc/apt/preferences.d + + if [ -f chroot/etc/apt/preferences.d/$(basename ${_FILE}) ] + then + mv chroot/etc/apt/preferences.d/$(basename ${_FILE}).orig chroot/etc/apt/preferences.d/$(basename ${_FILE}) + fi + done + fi + + if Find_files config/packages.chroot/*.deb || Find_files config/packages/*.deb + then + if [ -f chroot/etc/apt/preferences ] + then + # delete additions from lb_chroot_apt install|install-binary to preferences + sed -i '/# Added by lb_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 + + # Remove temporary hack to avoid squashfs version mismatch for artax-backports + rm -f chroot/etc/apt/preferences.d/progress.tmp.pref + + # Removing stage file + rm -f .build/chroot_apt + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/chroot_archives b/scripts/build/chroot_archives new file mode 100755 index 000000000..d0033d29e --- /dev/null +++ b/scripts/build/chroot_archives @@ -0,0 +1,901 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'manage /etc/apt/sources.list')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +_PASS="${1}" +shift + +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 .build/config .build/bootstrap + +_LB_LOCAL_KEY_EMAIL="live-build-local-key@invalid" + +# FIXME: this is ugly +if [ -n "${LIVE_BUILD}" ] +then + _BASE="${LIVE_BUILD}" +else + _BASE="/usr/share/live/build" +fi + +case "${LB_DERIVATIVE}" in + true) + _PARENT_FILE="sources.list.d/debian.list" + ;; + + false) + _PARENT_FILE="sources.list" + ;; +esac + +case "${1}" in + install) + Echo_message "Configuring file /etc/apt/sources.list" + + # Checking stage file + Check_stagefile .build/chroot_archives + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Restoring cache + Restore_cache cache/packages.chroot + + # Configure custom sources.list + +cat > chroot/etc/apt/${_PARENT_FILE} << EOF +deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS} +EOF + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + fi + + if [ "${LB_DERIVATIVE}" = "true" ] + then + rm -f chroot/etc/apt/sources.list.d/${LB_MODE}.list + + _DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | sed -e 's|-backports||')" + + echo "deb ${LB_MIRROR_CHROOT} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_MIRROR_CHROOT} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + fi + fi + + if [ "${LB_SECURITY}" = "true" ] + then + case "${LB_MODE}" in + debian|progress) + case "${LB_PARENT_DISTRIBUTION}" in + sid) + + ;; + + *) + echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + fi + ;; + esac + + if [ "${LB_MODE}" = progress ] + then + echo "deb ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + fi + else + if [ "${LB_DERIVATIVE}" = "true" ] + then + echo "deb ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + fi + fi + fi + ;; + + ubuntu|kubuntu) + echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + fi + ;; + esac + fi + + if [ "${LB_VOLATILE}" = "true" ] + then + echo "deb ${LB_PARENT_MIRROR_CHROOT_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_PARENT_MIRROR_CHROOT_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + fi + + if [ "${LB_DERIVATIVE}" = "true" ] && [ "${LB_MIRROR_CHROOT_VOLATILE}" != "none" ] + then + echo "deb ${LB_MIRROR_CHROOT_VOLATILE} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_MIRROR_CHROOT_VOLATILE} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + fi + fi + fi + + if [ "${LB_BACKPORTS}" = "true" ] + then + case "${LB_MODE}" in + debian) + if [ "${LB_PARENT_DISTRIBUTION}" != "sid" ] + then + echo "deb ${LB_PARENT_MIRROR_CHROOT_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_PARENT_MIRROR_CHROOT_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + fi + fi + ;; + esac + + if [ "${LB_DERIVATIVE}" = "true" ] && [ "${LB_MIRROR_CHROOT_BACKPORTS}" != "none" ] + then + echo "deb ${LB_MIRROR_CHROOT_BACKPORTS} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_MIRROR_CHROOT_BACKPORTS} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + fi + fi + fi + + # probably too bold, needs refinment (FIXME) + rm -f chroot/etc/apt/preferences.d/* + + # Configure third-party archives + if [ -n "${LB_ARCHIVES}" ] + then + for REPOSITORY in ${LB_ARCHIVES} + do + # ubuntu workaround to allow using live.debian.net + case "${LB_MODE}" in + ubuntu|kubuntu) + if [ "${REPOSITORY}" = "live.debian.net" ] + then + _DISTRIBUTION="sid" + else + _DISTRIBUTION="${LB_PARENT_DISTRIBUTION}" + fi + ;; + + *) + _DISTRIBUTION="${LB_PARENT_DISTRIBUTION}" + ;; + esac + + # Prefer archives from the config tree + # over the global ones. + if ! ls "${_BASE}/archives/${REPOSITORY}"* > /dev/null 2>&1 + then + continue + fi + + # Adding sources.list entries (chroot) + if [ -e "${_BASE}/archives/${REPOSITORY}.chroot" ] + then + sed -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \ + -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ + "${_BASE}/archives/${REPOSITORY}.chroot" > \ + "chroot/etc/apt/sources.list.d/${REPOSITORY}.list" + elif [ -e "${_BASE}/archives/${REPOSITORY}" ] + then + sed -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \ + -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ + "${_BASE}/archives/${REPOSITORY}" > \ + "chroot/etc/apt/sources.list.d/${REPOSITORY}.list" + fi + + # Adding pinning preferences (chroot) + if [ -e "${_BASE}/archives/${REPOSITORY}.pref" ] + then + cp "${_BASE}/archives/${REPOSITORY}.pref" chroot/etc/apt/sources.list.d + elif [ -e "${_BASE}/archives/${REPOSITORY}.pref.chroot" ] + then + cp "${_BASE}/archives/${REPOSITORY}.pref.chroot" "chroot/etc/apt/sources.list.d/${REPOSITORY}.pref" + fi + + if [ "${LB_APT_SECURE}" != false ] + then + # Adding archive signing keys (chroot) + if [ -e "${_BASE}/archives/${REPOSITORY}.key.chroot" ] + then + cat "${_BASE}/archives/${REPOSITORY}.key.chroot" | Chroot chroot "apt-key add -" + elif [ -e "${_BASE}/archives/${REPOSITORY}.key" ] + then + cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -" + fi + fi + done + fi + + # Check local sources.list + if Find_files config/archives/*.list || \ + Find_files config/archives/*.list.chroot + then + for FILE in config/archives/*.list \ + config/archives/*.list.chroot + do + if [ -e "${FILE}" ] + then + sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \ + -e "s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \ + -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ + -e "s|@PARENT_ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ + "${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)" + + if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" = "false" ] + then + # Strip out source archives + sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)" + fi + fi + done + fi + + # Check local pinning preferences + if Find_files config/archives/*.pref || \ + Find_files config/archives/*.pref.chroot + then + for FILE in config/archives/*.pref \ + config/archives/*.pref.chroot + do + if [ -e "${FILE}" ] + then + cp config/archives/$(basename ${_FILE} .chroot) chroot/etc/apt/preferences.d + fi + done + fi + + # Configure local package repository + if Find_files config/packages.chroot/*.deb || Find_files config/packages/*.deb + then + rm -rf chroot/root/packages + mkdir -p chroot/root/packages + + if [ "$(stat --printf %d config/packages.chroot)" = "$(stat --printf %d chroot/root/packages)" ] || + [ "$(stat --printf %d config/packages)" = "$(stat --printf %d chroot/root/packages)" ] + then + CP_OPTIONS="-l" + fi + + # Copy packages + if Find_files config/packages.chroot/*_"${LB_ARCHITECTURES}".deb || Find_files config/packages/*_"${LB_ARCHITECTURES}".deb + then + for FILE in config/packages.chroot/*_"${LB_ARCHITECTURES}".deb config/packages/*_"${LB_ARCHITECTURES}".deb + do + if [ -L "${FILE}" ] + then + cp -L "${FILE}" chroot/root/packages + elif [ -e "${FILE}" ] + then + cp ${CP_OPTIONS} "${FILE}" chroot/root/packages + fi + done + fi + + if Find_files config/packages.chroot/*_all.deb || Find_files config/packages/*_all.deb + then + for FILE in config/packages.chroot/*_all.deb config/packages/*_all.deb + do + if [ -L "${FILE}" ] + then + cp -L "${FILE}" chroot/root/packages + elif [ -e "${FILE}" ] + then + cp ${CP_OPTIONS} "${FILE}" chroot/root/packages + fi + done + fi + + if Find_files chroot/root/packages/*.deb + then + # If we bootstrapped a minimal chroot, we need + # to install apt-utils before we have + # completed all the indices. + if [ ! -e chroot/usr/bin/apt-ftparchive ] + then + Apt chroot update + fi + + # Check depends + Check_package chroot/usr/bin/apt-ftparchive apt-utils + + # Installing depends + Install_package + + # Generate Packages and Packages.gz + echo "cd /root/packages && apt-ftparchive packages . > Packages" | Chroot chroot sh + gzip -9 -c chroot/root/packages/Packages > chroot/root/packages/Packages.gz + + # Generate Release + echo "cd /root/packages && apt-ftparchive \ + -o APT::FTPArchive::Release::Origin=config/packages.chroot \ + release . > Release" | Chroot chroot sh + + if [ "${LB_APT_SECURE}" = "true" ] + then + _LB_DOTGNUPG_EXISTED=0 + if [ -d chroot/root/.gnupg ] + then + _LB_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. + if [ -e chroot/dev/random ] + then + mv chroot/dev/random chroot/dev/random.orig + cp -a chroot/dev/urandom chroot/dev/random + fi + + 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-build local packages key + Name-Email: ${_LB_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" || _LB_RET=${?} + + case "${_LB_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" "${_LB_RET}" + exit ${_LB_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/packages/Release.gpg /root/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 ${_LB_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 + if [ -e chroot/dev/random.orig ] + then + mv chroot/dev/random.orig chroot/dev/random + fi + + # Remove /root/.gnupg if we created it during the signing process + if [ "${_LB_DOTGNUPG_EXISTED}" -eq 0 ] + then + rm -rf chroot/root/.gnupg + fi + fi + + # Add to sources.list.d + echo "deb file:/root/packages ./" > chroot/etc/apt/sources.list.d/packages.list + + # Move top-level sources away, otherwise apt always preferes it (#644148) + if [ -e chroot/etc/apt/sources.list ] + then + mv chroot/etc/apt/sources.list chroot/etc/apt/sources.list.d/zz-sources.list + fi + + # Removing depends + Remove_package + else + Echo_warning "Local packages must be named with suffix '_all.deb' or '_\$architecture.deb'." + fi + fi + + if Find_files chroot/root/packages/*.deb + then + gunzip < chroot/root/packages/Packages.gz | awk '/^Package: / { print $2 }' \ + >> chroot/root/packages.chroot + fi + + # Update indices from cache + if [ "${LB_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 -rf 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 [ "${LB_APT}" = "aptitude" ] && [ ! -x /usr/bin/aptitude ] + then + Chroot chroot "apt-get ${APT_OPTIONS} update" + Chroot chroot "apt-get ${APT_OPTIONS} install aptitude" + fi + else # Get fresh indices + # Check local archive keys + if Find_files config/archives/*.key || \ + Find_files config/archives/*.key.chroot + then + for FILE in config/archives/*.key \ + config/archives/*.key.chroot + do + if [ -e "${FILE}" ] + then + cp ${FILE} chroot/root + Chroot chroot "apt-key add /root/$(basename ${FILE})" + rm -f chroot/root/$(basename ${FILE}) + fi + done + fi + + # Check local keyring packages + if Find_files config/archives/*.deb + then + for PACKAGE in config/archives/*.deb + do + cp ${PACKAGE} chroot/root + Chroot chroot "dpkg -i /root/$(basename ${PACKAGE})" + rm -f chroot/root/$(basename ${PACKAGE}) + done + fi + + # Installing aptitude (FIXME) + if [ "${LB_APT}" = "aptitude" ] && [ ! -x /usr/bin/aptitude ] + then + Chroot chroot "apt-get ${APT_OPTIONS} update" + Chroot chroot "apt-get ${APT_OPTIONS} install aptitude" + fi + + # Rebuild apt indices from scratch. + # Due to the fact that apt doesn't understand + # pinning on the fly, we need to manually remove + # the cached indices and rebuild them again. + rm -rf chroot/var/cache/apt/*.bin + + Apt chroot update + + # Installing keyring packages + if [ -n "${LB_KEYRING_PACKAGES}" ] + then + if [ "${LB_DERIVATIVE}" = "true" ] + then + # Temporary hack (FIXME) + Chroot chroot "apt-get ${APT_OPTIONS} --force-yes install ${LB_KEYRING_PACKAGES}" + else + Apt chroot "install ${LB_KEYRING_PACKAGES}" + fi + fi + + rm -rf chroot/var/cache/apt/*.bin + + Apt chroot update + Apt chroot "upgrade" + Apt chroot "dist-upgrade" + + if [ "${LB_CACHE_INDICES}" = "true" ] + then + mkdir -p cache/indices.bootstrap + + if Find_files chroot/etc/apt/secring.gpg* + then + cp -f chroot/etc/apt/secring.gpg* cache/indices.bootstrap + fi + + cp -rf 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 + + # Saving cache + Save_cache cache/packages.chroot + + # Creating stage file + Create_stagefile .build/chroot_archives + ;; + + remove) + Echo_message "Deconfiguring file /etc/apt/sources.list" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Restore top-level sources + if [ -e chroot/etc/apt/sources.list.d/zz-sources.list ] + then + mv chroot/etc/apt/sources.list.d/zz-sources.list chroot/etc/apt/sources.list + fi + + # Configure generic indices + # Don't do anything if it's not required + if [ "${LB_PARENT_MIRROR_CHROOT}" = "${LB_PARENT_MIRROR_BINARY}" ] && \ + [ "${LB_PARENT_MIRROR_CHROOT_SECURITY}" = "${LB_PARENT_MIRROR_BINARY_SECURITY}" ] && \ + [ ! -d chroot/root/packages ] + then + # Removing stage file + rm -f .build/chroot_archives + + exit 0 + fi + + # Cleaning apt list cache + rm -rf chroot/var/lib/apt/lists + mkdir -p chroot/var/lib/apt/lists/partial + + # Configure custom sources.list + +cat > chroot/etc/apt/${_PARENT_FILE} << EOF +deb ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS} +EOF + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + fi + + if [ "${LB_DERIVATIVE}" = "true" ] + then + rm -f chroot/etc/apt/sources.list.d/${LB_MODE}.list + + _DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | sed -e 's|-backports||')" + + echo "deb ${LB_MIRROR_BINARY} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_MIRROR_BINARY} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + fi + fi + + if [ "${LB_SECURITY}" = "true" ] + then + case "${LB_MODE}" in + debian|progress) + case "${LB_PARENT_DISTRIBUTION}" in + sid) + + ;; + + *) + echo "deb ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + fi + ;; + esac + + if [ "${LB_MODE}" = progress ] + then + echo "deb ${LB_MIRROR_BINARY_SECURITY} ${_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_MIRROR_BINARY_SECURITY} ${_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + fi + else + if [ "${LB_DERIVATIVE}" = "true" ] + then + echo "deb ${LB_MIRROR_BINARY_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_MIRROR_BINARY_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + fi + fi + fi + ;; + + ubuntu|kubuntu) + echo "deb ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + fi + ;; + esac + fi + + if [ "${LB_VOLATILE}" = "true" ] + then + echo "deb ${LB_PARENT_MIRROR_BINARY_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_PARENT_MIRROR_BINARY_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + fi + + if [ "${LB_DERIVATIVE}" = "true" ] && [ "${LB_MIRROR_BINARY_VOLATILE}" != "none" ] + then + echo "deb ${LB_MIRROR_BINARY_VOLATILE} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_MIRROR_BINARY_VOLATILE} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + fi + fi + fi + + if [ "${LB_BACKPORTS}" = "true" ] + then + case "${LB_MODE}" in + debian) + if [ "${LB_PARENT_DISTRIBUTION}" != "sid" ] + then + echo "deb ${LB_PARENT_MIRROR_BINARY_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_PARENT_MIRROR_BINARY_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} + fi + fi + ;; + esac + + if [ "${LB_DERIVATIVE}" = "true" ] && [ "${LB_MIRROR_BINARY_BACKPORTS}" != "none" ] + then + echo "deb ${LB_MIRROR_BINARY_BACKPORTS} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + + if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] + then + echo "deb-src ${LB_MIRROR_BINARY_BACKPORTS} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list + fi + fi + fi + + # probably too bold, needs refinment (FIXME) + rm -f chroot/etc/apt/preferences.d/* + + # Configure third-party archives + if [ -n "${LB_ARCHIVES}" ] + then + for REPOSITORY in ${LB_ARCHIVES} + do + # Removing sources.list entries (chroot) + rm -f "chroot/etc/apt/sources.list.d/${REPOSITORY}.list" + + # Prefer archives from the config tree + # over the global ones. + if ! ls "${_BASE}/archives/${REPOSITORY}"* > /dev/null 2>&1 + then + continue + fi + + # Adding sources.list entries (binary) + if [ -e "${_BASE}/archives/${REPOSITORY}.binary" ] + then + sed -e "s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ + -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ + "${_BASE}/archives/${REPOSITORY}.binary" > \ + "chroot/etc/apt/sources.list.d/${REPOSITORY}.list" + elif [ -e "${_BASE}/archives/${REPOSITORY}" ] + then + sed -e "s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ + -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ + "${_BASE}/archives/${REPOSITORY}" > \ + "chroot/etc/apt/sources.list.d/${REPOSITORY}.list" + fi + + # Adding pinning preferences (binary) + if [ -e "${_BASE}/archives/${REPOSITORY}.pref" ] + then + cp "${_BASE}/archives/${REPOSITORY}.pref" chroot/etc/apt/sources.list.d + elif [ -e "${_BASE}/archives/${REPOSITORY}.pref.binary" ] + then + cp "${_BASE}/archives/${REPOSITORY}.pref.binary" "chroot/etc/apt/sources.list.d/${REPOSITORY}.pref" + fi + + if [ "${LB_APT_SECURE}" != false ] + then + # Adding archive signing keys (binary) + if [ -e "${_BASE}/archives/${REPOSITORY}.key.binary" ] + then + cat "${_BASE}/archives/${REPOSITORY}.key.binary" | Chroot chroot "apt-key add -" + elif [ -e "${_BASE}/archives/${REPOSITORY}.key" ] + then + cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -" + fi + fi + done + fi + + # Check local sources.list + if Find_files config/archives/*.list || \ + Find_files config/archives/*.list.binary + then + for FILE in config/archives/*.list \ + config/archives/*.list.binary + do + if [ -e "${FILE}" ] + then + sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \ + -e "s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \ + -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ + -e "s|@PARENT_ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ + "${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)" + + if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" = "false" ] + then + # Strip out source archives + sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)" + fi + fi + done + fi + + # Check local pinning preferences + if Find_files config/archives/*.pref || \ + Find_files config/archives/*.pref.binary + then + for FILE in config/archives/*.pref \ + config/archives/*.pref.binary + do + if [ -e "${FILE}" ] + then + cp config/archives/$(basename ${_FILE} .binary) chroot/etc/apt/preferences.d + fi + done + fi + + # Check local archive keys + if Find_files config/archives/*.key || \ + Find_files config/archives/*.key.binary + then + for FILE in config/archives/*.key \ + config/archives/*.key.binary + do + if [ -e "${FILE}" ] + then + cp ${FILE} chroot/root + Chroot chroot "apt-key add /root/$(basename ${FILE})" + rm -f chroot/root/$(basename ${FILE}) + fi + done + fi + + # Updating indices + Apt chroot update + + # Cleaning apt package cache + rm -rf chroot/var/cache/apt + mkdir -p chroot/var/cache/apt/archives/partial + + # Cleaning apt package lists + if [ "${LB_APT_INDICES}" = "false" ] + then + rm -rf chroot/var/lib/apt/lists + mkdir -p chroot/var/lib/apt/lists/partial + fi + + # Remove local package repository + rm -f chroot/etc/apt/sources.list.d/packages.list + rm -rf chroot/root/packages + + # Remove local packages key if it exists + if apt-key list | grep -q ${_LB_LOCAL_KEY_EMAIL} + then + apt-key del ${_LB_LOCAL_KEY_EMAIL} + fi + + # Removing stage file + rm -f .build/chroot_archives + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/chroot_cache b/scripts/build/chroot_cache new file mode 100755 index 000000000..4c4b055bf --- /dev/null +++ b/scripts/build/chroot_cache @@ -0,0 +1,92 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 + +for STAGE in ${LB_CACHE_STAGES} +do + if [ "${STAGE}" = "chroot" ] + then + case "${1}" in + restore) + Echo_message "Restoring chroot stage from cache..." + + # Checking stage file + Check_stagefile .build/chroot_cache.restore + + if [ -d cache/chroot ] + then + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Removing old chroot + rm -rf chroot + + # Restoring old cache + ${LB_ROOT_COMMAND} cp -a cache/chroot chroot + + if [ -n "${LB_ROOT_COMMAND}" ] + then + ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot + fi + + # Creating stage file + Create_stagefile .build/chroot_cache.restore + + exit 0 + fi + ;; + + save) + Echo_message "Saving chroot stage to cache..." + + # Checking stage file + Check_stagefile .build/chroot_cache.save + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + rm -rf cache/chroot + + mkdir -p cache + + ${LB_ROOT_COMMAND} cp -a chroot cache/chroot + + if [ -n "${LB_ROOT_COMMAND}" ] + then + ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/chroot + fi + + # Creating stage file + Create_stagefile .build/chroot_cache.save + ;; + esac + fi +done diff --git a/scripts/build/chroot_debianchroot b/scripts/build/chroot_debianchroot new file mode 100755 index 000000000..7e07b3655 --- /dev/null +++ b/scripts/build/chroot_debianchroot @@ -0,0 +1,81 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /etc/debian_chroot" + + # Checking stage file + Check_stagefile .build/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 .build/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 .build/chroot_debianchroot + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/chroot_devpts b/scripts/build/chroot_devpts new file mode 100755 index 000000000..428927f06 --- /dev/null +++ b/scripts/build/chroot_devpts @@ -0,0 +1,86 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'mount /dev/pts')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Ensure that a system is built as root +lb 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 .build/config .build/bootstrap + +case "${1}" in + install) + Echo_message "Begin mounting /dev/pts..." + + # Checking stage file + Check_stagefile .build/chroot_devpts + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LB_USE_FAKEROOT}" != "true" ] + then + # Creating mountpoint + mkdir -p chroot/dev/pts + + # Mounting /dev/pts + ${LB_ROOT_COMMAND} mount devpts-live -t devpts chroot/dev/pts || true + fi + + # Creating stage file + Create_stagefile .build/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 [ "${LB_USE_FAKEROOT}" != "true" ] + then + if grep -qs "$(pwd)/chroot/dev/pts" /proc/mounts || Find_files chroot/dev/pts/* + then + ${LB_ROOT_COMMAND} umount chroot/dev/pts + else + ${LB_ROOT_COMMAND} umount -f chroot/dev/pts > /dev/null 2>&1 || true + fi + fi + + # Removing stage file + rm -f .build/chroot_devpts + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/chroot_dpkg b/scripts/build/chroot_dpkg new file mode 100755 index 000000000..9698f7923 --- /dev/null +++ b/scripts/build/chroot_dpkg @@ -0,0 +1,122 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /sbin/start-stop-daemon" + + # Checking stage file + Check_stagefile .build/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 + + # Disable dpkg syncing + +cat > chroot/etc/dpkg/dpkg.cfg.d/live-build << EOF +force-unsafe-io +EOF + + # Manual hacks for special packages + + # samhain + if [ -e /var/state/samhain/samhain_file ] + then + mv /var/state/samhain/samhain_file /var/state/samhain/samhain_file.orig + else + mkdir -p /var/state/samhain + touch /var/state/samhain/samhain_file + fi + + # flash-kernel + Chroot chroot dpkg-divert --rename --quiet --add /usr/sbin/flash-kernel + ln -s /bin/true chroot/usr/sbin/flash-kernel + + # Creating stage file + Create_stagefile .build/chroot_dpkg + ;; + + remove) + Echo_message "Deconfiguring file /sbin/start-stop-daemon" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Manual hacks for special packages + + # flash-kernel + rm -f chroot/usr/sbin/flash-kernel + Chroot chroot dpkg-divert --rename --quiet --remove /usr/sbin/flash-kernel + + # samhain + if [ -e /var/state/samhain/samhain_file.orig ] + then + mv /var/state/samhain/samhain_file.orig /var/state/samhain/samhain_file + elif [ -d /var/state/samhain ] + then + rm -f /var/state/samhain/samhain_file + rmdir --ignore-fail-on-non-empty /var/state/samhain || true + fi + + # 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 + + # Remove dpkg sync configuration + rm -f chroot/etc/dpkg/dpkg.cfg.d/live-build + + # Removing stage file + rm -f .build/chroot_dpkg + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/chroot_hacks b/scripts/build/chroot_hacks new file mode 100755 index 000000000..f0e885b08 --- /dev/null +++ b/scripts/build/chroot_hacks @@ -0,0 +1,309 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/chroot_hacks + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +case "${LB_PARENT_DISTRIBUTION}" in + squeeze) + if echo "${LB_TASKS}" | grep -qs lxde || + echo "${LB_TASKS}" | grep -qs xfce + then + GDM="gdm" + else + GDM="gdm3" + fi + ;; + + *) + GDM="gdm3" + ;; +esac + +# Handling default desktop configuration +case "${LB_MODE}" in + debian*) + # disable kexec-tools + if [ -e chroot/sbin/kexec ] + then + echo "kexec-tools kexec-tools/load_kexec boolean false" > chroot/root/preseed + Chroot chroot "debconf-set-selections /root/preseed" + rm -f chroot/root/preseed + Chroot chroot "dpkg-reconfigure kexec-tools" + fi + ;; +esac + +for TASK in ${LB_TASKS} +do + case "${TASK}" in + gnome-desktop) + # gnome is the only desktop environment in this image + if [ -z "$(echo ${LB_TASKS} | sed -e 's|gnome-desktop||' -e 's| desktop ||' | grep desktop)" ] + then + # set display manager + echo "${GDM} shared/default-x-display-manager select ${GDM}" > chroot/root/preseed + Chroot chroot "debconf-set-selections /root/preseed" + rm -f chroot/root/preseed + Chroot chroot "dpkg-reconfigure ${GDM}" + echo "/usr/bin/${GDM}" > chroot/etc/X11/default-display-manager + + # set session manager + Chroot chroot "update-alternatives --set x-session-manager /usr/bin/gnome-session" + fi + ;; + + kde-desktop) + # kde is the only desktop-environment in this image + if [ -z "$(echo ${LB_TASKS} | sed -e 's|kde-desktop||' -e 's| desktop ||' | grep desktop)" ] + then + # set display manager + echo "kdm shared/default-x-display-manager select kdm" > chroot/root/preseed + Chroot chroot "debconf-set-selections /root/preseed" + rm -f chroot/root/preseed + Chroot chroot "dpkg-reconfigure kdm" + echo "/usr/bin/kdm" > chroot/etc/X11/default-display-manager + + # set session manager + Chroot chroot "update-alternatives --set x-session-manager /usr/bin/startkde" + + # get rid of resolvconf + Chroot chroot "dpkg -P resolvconf" + fi + ;; + + lxde-desktop) + # lxde is the only desktop environment in this image + if [ -z "$(echo ${LB_TASKS} | sed -e 's|lxde-desktop||' -e 's| desktop ||' | grep desktop)" ] + then + # set display manager + echo "${GDM} shared/default-x-display-manager select ${GDM}" > chroot/root/preseed + Chroot chroot "debconf-set-selections /root/preseed" + rm -f chroot/root/preseed + Chroot chroot "dpkg-reconfigure ${GDM}" + echo "/usr/bin/${GDM}" > chroot/etc/X11/default-display-manager + + # set session manager + Chroot chroot "update-alternatives --set x-session-manager /usr/bin/startlxde" + fi + ;; + + xfce-desktop) + # xfce is the only desktop environment in this image + if [ -z "$(echo ${LB_TASKS} | sed -e 's|xfce-desktop||' -e 's| desktop ||' | grep desktop)" ] + then + # set display manager + echo "${GDM} shared/default-x-display-manager select ${GDM}" > chroot/root/preseed + Chroot chroot "debconf-set-selections /root/preseed" + rm -f chroot/root/preseed + Chroot chroot "dpkg-reconfigure ${GDM}" + echo "/usr/bin/${GDM}" > chroot/etc/X11/default-display-manager + + # set session manager + Chroot chroot "update-alternatives --set x-session-manager /usr/bin/xfce4-session" + fi + ;; + esac +done + +case "${LB_BINARY_IMAGES}" in + netboot) + if [ ! -f chroot/sbin/mount.cifs ] + then + Apt chroot install cifs-utils + fi + + if [ ! -d chroot/etc/initramfs-tools ] + then + mkdir chroot/etc/initramfs-tools + fi + + # Configuring initramfs for NFS + if ! grep -qs "BOOT=nfs" chroot/etc/initramfs-tools/initramfs.conf + then + echo "BOOT=nfs" >> chroot/etc/initramfs-tools/initramfs.conf + fi + + if ! grep -qs "NFSROOT=auto" chroot/etc/initramfs-tools/initramfs.conf + then + echo "NFSROOT=auto" >> chroot/etc/initramfs-tools/initramfs.conf + fi + ;; +esac + +# Update initramfs (always, because of udev rules in initrd) +case "${LB_INITRAMFS}" in + casper) + UPDATE_INITRAMFS_OPTIONS="CASPER_GENERATE_UUID=1" + ;; + + live-boot) + #UPDATE_INITRAMFS_OPTIONS="LIVE_GENERATE_UUID=1" + ;; +esac + +if [ "${LB_INITRAMFS}" != "none" ] +then + Chroot chroot "${UPDATE_INITRAMFS_OPTIONS} update-initramfs -k all -t -u" +fi + +# We probably ought to use COMPRESS= in a temporary file in +# /etc/initramfs-tools/conf.d/ instead, but it's hard to pass options that +# way. +case "${LB_INITRAMFS_COMPRESSION}" in + gzip) + ;; + + bzip2) + for INITRAMFS in $(find chroot/boot -name 'initrd*'); do + zcat "${INITRAMFS}" | bzip2 -c ${BZIP2_OPTIONS} > "${INITRAMFS}.new" + mv "${INITRAMFS}.new" "${INITRAMFS}" + done + ;; + + lzma) + # We probably ought to use COMPRESS= in a temporary file in + # /etc/initramfs-tools/conf.d/ instead, but it's hard to + # pass options that way. + for INITRAMFS in $(find chroot/boot -name 'initrd*'); do + zcat "${INITRAMFS}" | lzma -c ${LZMA_OPTIONS} > "${INITRAMFS}.new" + mv "${INITRAMFS}.new" "${INITRAMFS}" + done + ;; +esac + +# Ensure readable permissions on initramfs. loop-aes-utils sets umask to +# protect GPG keys, which live-build 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 +rm -f chroot/var/log/apt/term.log + +# Delete and re-create temporary directories +TEMP_DIRS="/tmp /var/tmp" +for DIR in ${TEMP_DIRS} +do + rm -rf "chroot/${DIR}" + install -d -m 1777 "chroot/${DIR}" +done + +if [ -n "${LB_ROOT_COMMAND}" ] +then + ${LB_ROOT_COMMAND} chown -R --quiet $(whoami):$(whoami) chroot +fi + +case "${LB_INITRAMFS}" in + casper) + ID="999" + ;; + + live-boot) + ID="1000" + ;; + + *) + ID="" + ;; +esac + +if [ "${LB_DEBIAN_INSTALLER}" = "live" ] +then + # This is a temporary hack to get rid of fstab; + # needs cleanup in live-boot first to proper fix. + rm -f chroot/etc/fstab + touch chroot/etc/fstab +fi + +if [ "${LB_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 + +if [ "${LB_SWAP_FILE_PATH}" ]; then + dd if=/dev/zero of="chroot/${LB_SWAP_FILE_PATH}" bs=1024k count="${LB_SWAP_FILE_SIZE}" + mkswap "chroot/${LB_SWAP_FILE_PATH}" +fi + +# Creating stage file +Create_stagefile .build/chroot_hacks diff --git a/scripts/build/chroot_hooks b/scripts/build/chroot_hooks new file mode 100755 index 000000000..b81e3cb24 --- /dev/null +++ b/scripts/build/chroot_hooks @@ -0,0 +1,115 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/chroot_hooks + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +## Processing distribution hooks + +# Make build config available to chroot hooks. First, make the bind +# mount and then make it read-only. This can't happen in one mount +# command, then the resulting mount will be rw (see mount(8)). Making it +# ro prevents modifications and prevents accidentally removing the +# contents of the config directory when removing the chroot. +mkdir -p chroot/root/config +mount -o bind config chroot/root/config +mount -o remount,ro,bind config chroot/root/config + +# Copying hooks +for _HOOK in ${LB_CHROOT_HOOKS} +do + for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks + do + for FILE in "${LOCATION}"/???-"${_HOOK}".chroot + do + if [ -e "${FILE}" ] + then + mkdir -p chroot/root/lb_chroot_hooks + cp "${FILE}" chroot/root/lb_chroot_hooks + fi + done + done +done + +# Running hooks +if ls chroot/root/lb_chroot_hooks/* > /dev/null 2>&1 +then + for _HOOK in chroot/root/lb_chroot_hooks/* + do + Chroot chroot "/root/lb_chroot_hooks/$(basename ${_HOOK})" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;} + rm -f chroot/root/lb_chroot_hooks/"$(basename ${_HOOK})" + done + + rmdir chroot/root/lb_chroot_hooks +fi + +## Processing local hooks + +if Find_files config/hooks/*.chroot +then + # Restoring cache + Restore_cache cache/packages.chroot + + for _HOOK in config/hooks/*.chroot + 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 .build/chroot_hooks +fi + +# Remove bind mount of build config inside chroot. +umount chroot/root/config +rmdir chroot/root/config + diff --git a/scripts/build/chroot_hostname b/scripts/build/chroot_hostname new file mode 100755 index 000000000..9f56901e4 --- /dev/null +++ b/scripts/build/chroot_hostname @@ -0,0 +1,95 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /etc/hostname" + + # Checking stage file + Check_stagefile .build/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 .build/chroot_hostname + ;; + + remove) + Echo_message "Deconfiguring file /etc/hostname" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + # Copying hostname from includes, if existing + if [ -e config/includes.chroot/etc/hostname ] + then + cp -a config/includes.chroot/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 .build/chroot_hostname + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/chroot_hosts b/scripts/build/chroot_hosts new file mode 100755 index 000000000..3adaebfe4 --- /dev/null +++ b/scripts/build/chroot_hosts @@ -0,0 +1,98 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /etc/hosts" + + # Checking stage file + Check_stagefile .build/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 .build/chroot_hosts + ;; + + remove) + Echo_message "Deconfiguring file /etc/hosts" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ -e config/includes.chroot/etc/hosts ] + then + # Copying local hosts + cp -a config/includes.chroot/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 .build/chroot_hosts + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/chroot_includes b/scripts/build/chroot_includes new file mode 100755 index 000000000..8d3c75eee --- /dev/null +++ b/scripts/build/chroot_includes @@ -0,0 +1,50 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'copy 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 includes..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/includes.chroot + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if Find_files config/includes.chroot/ +then + # Copying includes + cd config/includes.chroot + find . | cpio -dmpu --no-preserve-owner "${OLDPWD}"/chroot + cd "${OLDPWD}" + + # Creating stage file + Create_stagefile .build/chroot_includes +fi diff --git a/scripts/build/chroot_install-packages b/scripts/build/chroot_install-packages new file mode 100755 index 000000000..d7d916496 --- /dev/null +++ b/scripts/build/chroot_install-packages @@ -0,0 +1,70 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'install queued packages into chroot')" +HELP="" +USAGE="${PROGRAM} [--force]" +USAGE="${PROGRAM} {install|live} [--force]" + +_PASS="${1}" +shift + +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 (${_PASS} pass)..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/chroot_install-packages.${PASS} + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ -e chroot/root/packages.chroot ] && [ -s chroot/root/packages.chroot ] +then + # Restoring cache + Restore_cache cache/packages.chroot + + # Installing packages + case "${LB_APT}" in + apt|apt-get) + Chroot chroot "xargs --arg-file=/root/packages.chroot apt-get ${APT_OPTIONS} install" + ;; + + aptitude) + Chroot chroot "xargs --arg-file=/root/packages.chroot aptitude ${APTITUDE_OPTIONS} install" + ;; + esac + + # Tidying up + rm -f chroot/root/packages.chroot + + # Saving cache + Save_cache cache/packages.chroot + +fi + +# Creating stage file +Create_stagefile .build/chroot_install-packages.${_PASS} diff --git a/scripts/build/chroot_interactive b/scripts/build/chroot_interactive new file mode 100755 index 000000000..31a34fc8a --- /dev/null +++ b/scripts/build/chroot_interactive @@ -0,0 +1,62 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_INTERACTIVE}" = "false" ] +then + exit 0 +fi + +Echo_message "Begin interactive build..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/chroot_interactive + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +case "${LB_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 .build/chroot_interactive diff --git a/scripts/build/chroot_linux-image b/scripts/build/chroot_linux-image new file mode 100755 index 000000000..bb672c1d2 --- /dev/null +++ b/scripts/build/chroot_linux-image @@ -0,0 +1,123 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'schedule kernel packages for installation')" +HELP="" +USAGE="${PROGRAM} [--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 .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/chroot_linux-image + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Diverting update-initramfs +#case "${LB_INITRAMFS}" in +# live-boot) +# mv chroot/usr/sbin/update-initramfs chroot/usr/sbin/update-initramfs.live-build +# ;; +#esac + +if [ "${LB_LINUX_PACKAGES}" != "none" ] +then + for FLAVOUR in ${LB_LINUX_FLAVOURS} + do + for PACKAGE in ${LB_LINUX_PACKAGES} + do + echo ${PACKAGE}-${FLAVOUR} >> chroot/root/packages.chroot + done + done + + # Include firmware packages + if [ "${LB_FIRMWARE_CHROOT}" = "true" ] + then + # Assumption: firmware packages install files into /lib/firmware + + # Get all firmware packages names + mkdir -p cache/contents.chroot + wget ${WGET_OPTIONS} ${LB_PARENT_MIRROR_CHROOT}/dists/${LB_PARENT_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz -O - | gunzip -c > cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES} + + FIRMWARE_PACKAGES="" + FIRMWARE_PACKAGES="$(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)" + + if [ "${LB_DERIVATIVE}" = "true" ] + then + wget {WGET_OPTIONS} ${LB_MIRROR_CHROOT}/dists/${LB_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz -O - | gunzip -c > cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES} + + FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)" + fi + + # Filter out contrib packages if contrib is not enabled + if ! echo ${LB_ARCHIVE_AREAS} | grep -qs contrib + then + _FIRMWARE_PACKAGES="" + + for _PACKAGE in ${FIRMWARE_PACKAGES} + do + _FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | sed -e 's|^contrib/.*$||')" + done + + FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES}" + fi + + # Filter out non-free packages if non-free is not enabled + if ! echo ${LB_ARCHIVE_AREAS} | grep -qs non-free + then + _FIRMWARE_PACKAGES="" + + for _PACKAGE in ${FIRMWARE_PACKAGES} + do + _FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | sed -e 's|^non-free/.*$||')" + done + + FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES}" + else + # Manually add firmware-linux/non-free meta package + FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} firmware-linux" + + # Manually add intel-microcode + FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} intel-microcode" + fi + + # Drop section and keep package names only + for _PACKAGE in ${FIRMWARE_PACKAGES} + do + echo $(echo ${_PACKAGE} | awk -F/ '{ print $NF }') >> chroot/root/packages.chroot + done + +# Some known licenses required to be accepted +cat >> chroot/root/packages.chroot.cfg << EOF +firmware-ivtv firmware-ivtv/license/accepted boolean true +firmware-ipw2x00 firmware-ipw2x00/license/accepted boolean true +EOF + + fi + + # Creating stage file + Create_stagefile .build/chroot_linux-image +fi diff --git a/scripts/build/chroot_live-packages b/scripts/build/chroot_live-packages new file mode 100755 index 000000000..057e423f6 --- /dev/null +++ b/scripts/build/chroot_live-packages @@ -0,0 +1,80 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'schedule live packages for installation')" +HELP="" +USAGE="${PROGRAM} [--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 .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/chroot_live-packages + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Queue installation of live-boot +if [ -n "${LB_INITRAMFS}" ] && [ "${LB_INITRAMFS}" != "none" ] +then + _PACKAGES="${LB_INITRAMFS}" +fi + +# Queue installation of live-config +if [ -n "${LB_INITSYSTEM}" ] && [ "${LB_INITSYSTEM}" != "none" ] +then + _PACKAGES="${_PACKAGES} live-config live-config-${LB_INITSYSTEM}" +fi + +# Do initsystem specific hacks +if [ -n "${LB_INITSYSTEM}" ] && [ "${LB_INITSYSTEM}" != "sysvinit" ] +then + # lets see if we still need the squeeze's "pre init system policy discussion" hack: + IS_SYSVINIT_ESSENTIAL="$(Chroot chroot dpkg-query --show --showformat='${Essential}\n' sysvinit)" + RC="$?" + + if [ "${IS_SYSVINIT_ESSENTIAL}" != "no" ] && [ "${RC}" = "0" ] + then + # sysvinit is both installed and essential, ugly hack to remove it + Chroot chroot dpkg --force-remove-essential --remove sysvinit || true + fi +fi + +# Install live packages +if [ -n "${_PACKAGES}" ] +then + case "${LB_APT}" in + apt|apt-get) + Chroot chroot "apt-get ${APT_OPTIONS} install ${_PACKAGES}" + ;; + + aptitude) + Chroot chroot "aptitude ${APTITUDE_OPTIONS} install ${_PACKAGES}" + ;; + esac + + # Creating stage file + Create_stagefile .build/chroot_live-packages +fi diff --git a/scripts/build/chroot_package-lists b/scripts/build/chroot_package-lists new file mode 100755 index 000000000..b85c00059 --- /dev/null +++ b/scripts/build/chroot_package-lists @@ -0,0 +1,91 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'queue install of package lists into chroot')" +HELP="" +USAGE="${PROGRAM} {install|live} [--force]" + +_PASS="${1}" +shift + +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 package lists (${_PASS} pass)..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/chroot_package-lists.${_PASS} + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Handling local package lists +if ls config/package-lists/*.list > /dev/null 2>&1 || \ + ls config/package-lists/*.list.chroot > /dev/null 2>&1 || \ + ls config/package-lists/*.list.chroot_${_PASS} > /dev/null 2>&1 +then + # Checking depends + Check_package chroot/usr/bin/grep-aptavail dctrl-tools + + # Restoring cache + Restore_cache cache/packages.chroot + + # Installing depends + Install_package + + if [ -e "${LIVE_BUILD}/share/bin/Packages" ] + then + cp "${LIVE_BUILD}/share/bin/Packages" chroot/bin + else + cp /usr/share/live/build/bin/Packages chroot/bin + fi + + for LIST in config/package-lists/*.list \ + config/package-lists/*.list.chroot \ + config/package-lists/*.list.chroot_${_PASS} + do + if [ -e "${LIST}" ] + then + # Generating package list + Expand_packagelist "$(basename ${LIST})" "config/package-lists" \ + >> chroot/root/packages.chroot + fi + done + + rm -f chroot/bin/Packages + + # Removing dctrl-tools again if the user has not installed it + if ! grep -qs dctrl-tools chroot/root/packages.chroot + then + # Removing depends + Remove_package + fi + + # Saving cache + Save_cache cache/packages.binary + + # Creating stage file + Create_stagefile .build/chroot_package-lists.${_PASS} +fi diff --git a/scripts/build/chroot_preseed b/scripts/build/chroot_preseed new file mode 100755 index 000000000..1a70340d8 --- /dev/null +++ b/scripts/build/chroot_preseed @@ -0,0 +1,72 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/chroot_preseed + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if ls config/preseed/*.preseed > /dev/null 2>&1 || \ + ls config/preseed/*.preseed.chroot > /dev/null 2>&1 || \ + ls chroot/root/packages.chroot.cfg > /dev/null 2>&1 +then + # Check dependency + Check_package chroot/usr/bin/debconf-set-selections debconf + + # Install dependency + Install_package + + for PRESEED in config/preseed/*.preseed config/preseed/*.preseed.chroot chroot/root/packages.chroot.cfg + do + if [ -e "${PRESEED}" ] + then + # Copying local preseed + cp "${PRESEED}" chroot/root/preseed + + Chroot chroot "debconf-set-selections /root/preseed" + + # Removing local preseed file + rm -f chroot/root/preseed + fi + done + + rm -f chroot/root/packages.chroot.cfg + + # Remove dependency + Remove_package + + # Creating stage file + Create_stagefile .build/chroot_preseed +fi diff --git a/scripts/build/chroot_proc b/scripts/build/chroot_proc new file mode 100755 index 000000000..2c13fceb1 --- /dev/null +++ b/scripts/build/chroot_proc @@ -0,0 +1,97 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'mount /proc')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Ensure that a system is built as root +lb 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 .build/config .build/bootstrap + +case "${1}" in + install) + Echo_message "Begin mounting /proc..." + + # Checking stage file + Check_stagefile .build/chroot_proc + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LB_USE_FAKEROOT}" != "true" ] + then + # Creating mountpoint + mkdir -p chroot/proc + + # Mounting /proc + ${LB_ROOT_COMMAND} mount proc-live -t proc chroot/proc + else + rm -rf chroot/proc + ln -s /proc chroot/ + fi + + # Creating stage file + Create_stagefile .build/chroot_proc + ;; + + remove) + Echo_message "Begin unmounting /proc..." + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LB_USE_FAKEROOT}" != "true" ] + then + # Workaround binfmt-support /proc locking + if [ -e chroot/proc/sys/fs/binfmt_misc/status ] + then + ${LB_ROOT_COMMAND} umount chroot/proc/sys/fs/binfmt_misc + fi + + # Unmounting /proc + #fuser -km chroot/proc + if [ -e chroot/proc/version ] + then + ${LB_ROOT_COMMAND} umount chroot/proc + fi + else + rm -rf chroot/proc + mkdir -p chroot/proc + fi + + # Removing stage file + rm -f .build/chroot_proc + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/chroot_resolv b/scripts/build/chroot_resolv new file mode 100755 index 000000000..b82e3667a --- /dev/null +++ b/scripts/build/chroot_resolv @@ -0,0 +1,100 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /etc/resolv.conf" + + # Checking stage file + Check_stagefile .build/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 + elif [ -L chroot/etc/resolv.conf ] + then + # Move resolv.conf aside if it's a symlink (likely resolvconf) + mv chroot/etc/resolv.conf 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 .build/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/includes.chroot/etc/resolv.conf ] + then + # Copying local resolv.conf + cp -a config/includes.chroot/etc/resolv.conf chroot/etc/resolv.conf + rm -f chroot/etc/resolv.conf.orig + elif [ -e chroot/etc/resolv.conf.orig ] || [ -L 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 .build/chroot_resolv + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/chroot_selinuxfs b/scripts/build/chroot_selinuxfs new file mode 100755 index 000000000..20e30fb35 --- /dev/null +++ b/scripts/build/chroot_selinuxfs @@ -0,0 +1,97 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'mount /selinux')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Ensure that a system is built as root +lb 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 .build/config .build/bootstrap + +case "${1}" in + install) + if [ -e /selinux/enforce ] && [ "$(cat /selinux/enforce)" = "1" ] + then + Echo_message "Begin mounting /selinux..." + + # Checking stage file + Check_stagefile .build/chroot_selinuxfs + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LB_USE_FAKEROOT}" != "true" ] + then + # Create mountpoint + mkdir -p chroot/selinux + + # Mounting /selinux + ${LB_ROOT_COMMAND} mount selinuxfs-live -t selinuxfs chroot/selinux + else + rm -rf chroot/selinux + ln -s /selinux chroot/ + fi + + # Creating stage file + Create_stagefile .build/chroot_selinuxfs + fi + ;; + + remove) + Echo_message "Begin unmounting /selinux..." + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LB_USE_FAKEROOT}" != "true" ] + then + # Unmounting /selinux + #fuser -km chroot/selinux + if [ -e chroot/selinux/enforce ] + then + ${LB_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 .build/chroot_selinux + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/chroot_sysfs b/scripts/build/chroot_sysfs new file mode 100755 index 000000000..409728429 --- /dev/null +++ b/scripts/build/chroot_sysfs @@ -0,0 +1,91 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'mount /sys')" +HELP="" +USAGE="${PROGRAM} {install|remove} [--force]" + +Arguments "${@}" + +# Ensure that a system is built as root +lb 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 .build/config .build/bootstrap + +case "${1}" in + install) + Echo_message "Begin mounting /sys..." + + # Checking stage file + Check_stagefile .build/chroot_sysfs + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LB_USE_FAKEROOT}" != "true" ] + then + # Create mountpoint + mkdir -p chroot/sys + + # Mounting /sys + ${LB_ROOT_COMMAND} mount sysfs-live -t sysfs chroot/sys + else + rm -rf chroot/sys + ln -s /sys chroot/ + fi + + # Creating stage file + Create_stagefile .build/chroot_sysfs + ;; + + remove) + Echo_message "Begin unmounting /sys..." + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ "${LB_USE_FAKEROOT}" != "true" ] + then + # Unmounting /sys + #fuser -km chroot/sys + if [ -e chroot/sys/class ] + then + ${LB_ROOT_COMMAND} umount chroot/sys + fi + else + rm -rf chroot/sys + mkdir -p chroot/sys + fi + + # Removing stage file + rm -f .build/chroot_sysfs + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/chroot_sysv-rc b/scripts/build/chroot_sysv-rc new file mode 100755 index 000000000..4e1fc160e --- /dev/null +++ b/scripts/build/chroot_sysv-rc @@ -0,0 +1,87 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /usr/sbin/policy-rc.d" + + # Checking stage file + Check_stagefile .build/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 .build/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 .build/chroot_sysv-rc + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/chroot_tmpfs b/scripts/build/chroot_tmpfs new file mode 100755 index 000000000..80311f531 --- /dev/null +++ b/scripts/build/chroot_tmpfs @@ -0,0 +1,80 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'use tmpfs to speedup the build')" +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 + +if [ "${LB_BUILD_WITH_TMPFS}" != "true" ] +then + exit 0 +fi + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +case "${1}" in + install) + Echo_message "Configuring tmpfs for /var/lib/dpkg" + + # Checking stage file + Check_stagefile .build/chroot_tmpfs + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + mv chroot/var/lib/dpkg chroot/var/lib/dpkg.tmp + mkdir chroot/var/lib/dpkg + mount -t tmpfs tmpfs chroot/var/lib/dpkg + mv chroot/var/lib/dpkg.tmp/* chroot/var/lib/dpkg + rm -rf chroot/var/lib/dpkg.tmp + + # Creating stage file + Create_stagefile .build/chroot_tmpfs + ;; + + remove) + Echo_message "Deconfiguring tmpfs for /var/lib/dpkg" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + mkdir -p chroot/var/lib/dpkg.tmp + mv chroot/var/lib/dpkg/* chroot/var/lib/dpkg.tmp + umount chroot/var/lib/dpkg + rm -rf chroot/var/lib/dpkg + mv chroot/var/lib/dpkg.tmp chroot/var/lib/dpkg + + # Removing stage file + rm -f .build/chroot_tmpfs + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/chroot_upstart b/scripts/build/chroot_upstart new file mode 100755 index 000000000..fd7c72f75 --- /dev/null +++ b/scripts/build/chroot_upstart @@ -0,0 +1,87 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'manage /sbin/initctl')" +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 .build/config .build/bootstrap + +case "${1}" in + install) + Echo_message "Configuring file /sbin/initctl" + + # Checking stage file + Check_stagefile .build/chroot_upstart + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ -f chroot/sbin/initctl ] + then + # Save initctl file + mv chroot/sbin/initctl chroot/sbin/initctl.orig + fi + + # Create initctl file +cat > chroot/sbin/initctl << EOF +#!/bin/sh +echo "All runlevel operations denied by policy" >&2 +exit 101 +EOF + + chmod 0755 chroot/sbin/initctl + + # Creating stage file + Create_stagefile .build/chroot_upstart + ;; + + remove) + Echo_message "Deconfiguring file /sbin/initctl" + + # Checking lock file + Check_lockfile .lock + + # Creating lock file + Create_lockfile .lock + + if [ -f chroot/sbin/initctl.orig ] + then + # Restore initctl file + mv chroot/sbin/initctl.orig chroot/sbin/initctl + else + # Remove initctl file + rm -f chroot/sbin/initctl + fi + + # Removing stage file + rm -f .build/chroot_upstart + ;; + + *) + Usage + ;; +esac diff --git a/scripts/build/clean b/scripts/build/clean new file mode 100755 index 000000000..4104e5256 --- /dev/null +++ b/scripts/build/clean @@ -0,0 +1,161 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Read meta config +if [ "${1}" != "noauto" ] && [ -x auto/clean ] +then + Echo_message "Executing auto/clean script." + ./auto/clean "${@}" + exit ${?} +fi + +if [ "${1}" = "noauto" ] +then + shift +fi + +# 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) + "${0}" noauto --chroot + "${0}" noauto --binary + "${0}" noauto --stage + "${0}" noauto --source + + rmdir --ignore-fail-on-non-empty auto > /dev/null 2>&1 || true + ;; + + --cache) + ${LB_ROOT_COMMAND} rm -rf cache + ;; + + --chroot) + Echo_message "Cleaning chroot" + ${LB_ROOT_COMMAND} umount -f chroot/run > /dev/null 2>&1 || true + ${LB_ROOT_COMMAND} umount -f chroot/sys > /dev/null 2>&1 || true + ${LB_ROOT_COMMAND} umount -f chroot/proc/sys/fs/binfmt_misc > /dev/null 2>&1 || true + ${LB_ROOT_COMMAND} umount -f chroot/proc > /dev/null 2>&1 || true + ${LB_ROOT_COMMAND} umount -f chroot/lib/init/rw > /dev/null 2>&1 || true + ${LB_ROOT_COMMAND} umount -f chroot/dev/shm > /dev/null 2>&1 || true + ${LB_ROOT_COMMAND} umount -f chroot/dev/pts > /dev/null 2>&1 || true + ${LB_ROOT_COMMAND} umount -f chroot/dev > /dev/null 2>&1 || true + ${LB_ROOT_COMMAND} umount -f chroot/var/lib/dpkg > /dev/null 2>&1 || true + ${LB_ROOT_COMMAND} umount -f chroot/root/config > /dev/null 2>&1 || true + + ${LB_ROOT_COMMAND} umount -f chroot/binary.tmp > /dev/null 2>&1 || true + ${LB_ROOT_COMMAND} umount -f chroot/dev.tmp/pts > /dev/null 2>&1 || true + + ${LB_ROOT_COMMAND} rm -rf chroot chroot.tmp + + rm -f chroot.packages.live chroot.packages.install + + rm -f .build/chroot* + ;; + + --binary) + ${LB_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*.zsync* + rm -f binary.sh + rm -f binary.contents binary.packages md5sum.txt + + rm -rf binary + rm -rf tftpboot + + rm -f .build/binary* + ;; + + --remove) + "${0}" --all + rm -rf cache/packages.* + ;; + + --purge) + "${0}" --all + "${0}" --cache + + if [ -e auto/config ] + then + rm -f .build/config + fi + ;; + + --stage) + rm -rf .build + ;; + + --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 .build/source* + ;; + + -h|--help) + Help + ;; + + -u|--usage) + Usage + ;; + + -v|--version) + echo "${VERSION}" + exit 0 + ;; + + *) + Usage + exit 1 + ;; + esac +done diff --git a/scripts/build/config b/scripts/build/config new file mode 100755 index 000000000..2a1ae567b --- /dev/null +++ b/scripts/build/config @@ -0,0 +1,1494 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +PROGRAM="lb config" +DESCRIPTION="$(Echo 'create configuration for live-build(7)')" +USAGE="${PROGRAM} [--apt apt|aptitude]\n\ +\t [--apt-ftp-proxy URL]\n\ +\t [--apt-http-proxy URL]\n\ +\t [--apt-indices true|false|none]\n\ +\t [--apt-options OPTION|\"OPTIONS\"]\n\ +\t [--aptitude-options OPTION|\"OPTIONS\"]\n\ +\t [--apt-pipeline DEPTH]\n\ +\t [--apt-recommends true|false]\n\ +\t [--apt-secure true|false]\n\ +\t [--apt-source-archives true|false]\n\ +\t [-a|--architectures ARCHITECTURE]\n\ +\t [-b|--binary-images iso|iso-hybrid|netboot|tar|hdd]\n\ +\t [--binary-filesystem fat16|fat32|ext2|ext3|ext4|ntfs]\n\ +\t [--bootappend-install PARAMETER|\"PARAMETERS\"]\n\ +\t [--bootappend-live PARAMETER|\"PARAMETERS\"]\n\ +\t [--bootappend-failsafe PARAMETER|\"PARAMETERS\"]\n\ +\t [--bootloader grub|syslinux|yaboot]\n\ +\t [--bootstrap cdebootstrap|cdebootstrap-static|debootstrap|copy]\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 md5|sha1|sha256|none]\n\ +\t [--compression bzip2|gzip|lzip|xz|none]\n\ +\t [--config GIT_URL::GIT_BRANCH]\n\ +\t [--zsync true|false]\n\ +\t [--build-with-chroot true|false]\n\ +\t [--chroot-filesystem ext2|ext3|ext4|squashfs|jffs2|none]\n\ +\t [--clean\n\ +\t [-c|--conffile FILE]\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 daily|CODENAME]\n\ +\t [--debian-installer-preseedfile FILE|URL]\n\ +\t [--debian-installer-gui true|false]\n\ +\t [--debug]\n\ +\t [-d|--distribution CODENAME]\n\ +\t [--parent-distribution CODENAME]\n\ +\t [--parent-debian-installer-distribution CODENAME]\n\ +\t [--dump]\n\ +\t [--fdisk fdisk|fdisk.dist]\n\ +\t [--force]\n\ +\t [--grub-splash FILE]\n\ +\t [--gzip-options OPTION|\"OPTIONS\"]\n\ +\t [--hooks FILE]\n\ +\t [--ignore-system-defaults]\n\ +\t [--initramfs auto|none|live-boot|casper]\n\ +\t [--initramfs-compression bzip2|gzip|lzma]\n\ +\t [--initsystem sysvinit|runit|systemd|upstart|none]\n\ +\t [--interactive shell]\n\ +\t [--isohybrid-options OPTION|\"OPTIONS\"]\n\ +\t [--hdd-label LABEL]\n\ +\t [--hdd-size MB]\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 [-k|--linux-flavours FLAVOUR|\"FLAVOURS\"]\n\ +\t [--linux-packages \"PACKAGES\"]\n\ +\t [--losetup losetup|losetup.orig]\n\ +\t [--memtest memtest86+|memtest86|none]\n\ +\t [-m|--parent-mirror-bootstrap URL]\n\ +\t [--parent-mirror-chroot URL]\n\ +\t [--parent-mirror-chroot-security URL]\n\ +\t [--parent-mirror-chroot-volatile URL]\n\ +\t [--parent-mirror-chroot-backports URL]\n\ +\t [--parent-mirror-binary URL]\n\ +\t [--parent-mirror-binary-security URL]\n\ +\t [--parent-mirror-binary-volatile URL]\n\ +\t [--parent-mirror-binary-backports URL]\n\ +\t [--parent-mirror-debian-installer URL]\n\ +\t [--mirror-bootstrap URL]\n\ +\t [--mirror-chroot URL]\n\ +\t [--mirror-chroot-security URL]\n\ +\t [--mirror-chroot-volatile URL]\n\ +\t [--mirror-chroot-backports URL]\n\ +\t [--mirror-binary URL]\n\ +\t [--mirror-binary-security URL]\n\ +\t [--mirror-binary-volatile URL]\n\ +\t [--mirror-binary-backports URL]\n\ +\t [--mirror-debian-installer URL]\n\ +\t [--mode debian|emdebian|ubuntu|kubuntu]\n\ +\t [--system live|normal]\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 true|false]\n\ +\t [--quiet]\n\ +\t [--root-command sudo]\n\ +\t [--use-fakeroot true|false]\n\ +\t [--archives ARCHIVE|\"ARCHIVES\"]\n\ +\t [--archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\ +\t [--parent-archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\ +\t [--security true|false]\n\ +\t [--source true|false]\n\ +\t [-s|--source-images iso|netboot|tar|hdd]\n\ +\t [--firmware-binary true|false]\n\ +\t [--firmware-chroot true|false]\n\ +\t [--swap-file-path PATH]\n\ +\t [--swap-file-size MB]\n\ +\t [--syslinux-theme THEME_SUFFIX]\n\ +\t [--tasksel apt|aptitude|tasksel]\n\ +\t [--templates PATH]\n\ +\t [--volatile true|false]\n\ +\t [--backports true|false]\n\ +\t [--exposed-root true|false]\n\ +\t [--verbose]\n\ +\t [--win32-loader true|false]\n\ +\t [--bootstrap-qemu-exclude PACKAGES]\n\ +\t [--bootstrap-qemu-static PATH]\n\ +\t [--bootstrap-qemu-arch ARCH]" + + +Local_arguments () +{ + LONG_OPTIONS="apt:,apt-ftp-proxy:,apt-http-proxy:,apt-options:,aptitute-options:debootstrap-options:,cdebootstrap-ptions, + apt-pipeline:,apt-recommends:,apt-secure:,apt-source-archives:,bootstrap:,cache:,cache-indices:,cache-packages:, + cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,dump, + initramfs:,initramfs-compression:,initsystem:,fdisk:,losetup:,mode:,system:,root-command:,use-fakeroot:,tasksel:, + templates:,architectures:,clean, + distribution:,parent-distribution:,parent-debian-installer-distribution:,parent-mirror-bootstrap:,parent-mirror-chroot:,parent-mirror-chroot-security:,parent-mirror-chroot-volatile:,parent-mirror-chroot-backports:,parent-mirror-binary:, + parent-mirror-binary-security:,parent-mirror-binary-volatile:,parent-mirror-binary-backports:,parent-mirror-debian-installer:, + mirror-bootstrap:,mirror-chroot:,mirror-chroot-security:,mirror-chroot-volatile:,mirror-chroot-backports:,mirror-binary:, + mirror-binary-security:,mirror-binary-volatile:,mirror-binary-backports:,mirror-debian-installer:, + archives:,archive-areas:,parent-archive-areas:,chroot-filesystem:,exposed-root:, + gzip-options:,hooks:,interactive:,keyring-packages:,linux-flavours:,linux-packages:, + security:,volatile:,backports:,binary-filesystem:,binary-images:, + apt-indices:,bootappend-install:,bootappend-live:,bootappend-failsafe:,bootloader:,checksums:,compression:,config:,zsync:,build-with-chroot:, + debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:, + grub-splash:,isohybrid-options:,hdd-label:,hdd-size:,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:,firmware-binary:,firmware-chroot:,swap-file-path:,swap-file-size:,syslinux-theme:, + win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force, + help,ignore-system-defaults,quiet,usage,verbose,version,bootstrap-qemu-static:,bootstrap-qemu-arch:, + bootstrap-qemu-exclude:" + # 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-build)" + fi + + Echo "%s: This is live-build 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/package-lists config/chroot_apt config/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) + _CLEAN="true" + shift + ;; + + # config/common + --apt) + LB_APT="${2}" + shift 2 + ;; + + --apt-ftp-proxy) + LB_APT_FTP_PROXY="${2}" + shift 2 + ;; + + --apt-http-proxy) + LB_APT_HTTP_PROXY="${2}" + shift 2 + ;; + + --apt-indices) + LB_APT_INDICES="${2}" + shift 2 + ;; + + --apt-options) + APT_OPTIONS="${2}" + shift 2 + ;; + + --aptitude-options) + LB_APTITUDE_OPTIONS="${2}" + shift 2 + ;; + + --apt-pipeline) + LB_APT_PIPELINE="${2}" + shift 2 + ;; + + --apt-recommends) + LB_APT_RECOMMENDS="${2}" + shift 2 + ;; + + --apt-secure) + LB_APT_SECURE="${2}" + shift 2 + ;; + + --apt-source-archives) + LB_APT_SOURCE_ARCHIVES="${2}" + shift 2 + ;; + + --bootstrap) + LB_BOOTSTRAP="${2}" + shift 2 + ;; + + --debootstrap-options) + DEBOOTSTRAP_OPTIONS="${2}" + shift 2 + ;; + + --cdebootstrap-options) + CDEBOOTSTRAP_OPTIONS="${2}" + shift 2 + ;; + + --cache) + LB_CACHE="${2}" + shift 2 + ;; + + --cache-indices) + LB_CACHE_INDICES="${2}" + shift 2 + ;; + + --cache-packages) + LB_CACHE_PACKAGES="${2}" + shift 2 + ;; + + --cache-stages) + LB_CACHE_STAGES="${2}" + shift 2 + ;; + + --debconf-frontend) + LB_DEBCONF_FRONTEND="${2}" + shift 2 + ;; + + --debconf-nowarnings) + LB_DEBCONF_NOWARNINGS="${2}" + shift 2 + ;; + + --debconf-priority) + LB_DEBCONF_PRIORITY="${2}" + shift 2 + ;; + + --initramfs) + LB_INITRAMFS="${2}" + shift 2 + ;; + + --initramfs-compression) + LB_INITRAMFS_COMPRESSION="${2}" + shift 2 + ;; + + --initsystem) + LB_INITSYSTEM="${2}" + shift 2 + ;; + + --fdisk) + LB_FDISK="${2}" + shift 2 + ;; + + --losetup) + LB_LOSETUP="${2}" + shift 2 + ;; + + --mode) + LB_MODE="${2}" + shift 2 + ;; + + --system) + LB_SYSTEM="${2}" + shift 2 + ;; + + --root-command) + LB_ROOT_COMMAND="${2}" + shift 2 + ;; + + --use-fakeroot) + LB_USE_FAKEROOT="${2}" + shift 2 + ;; + + --tasksel) + LB_TASKSEL="${2}" + shift 2 + ;; + + --templates) + LB_TEMPLATES="${2}" + shift 2 + ;; + + # config/bootstrap + -a|--architectures) + LB_ARCHITECTURES="${2}" + shift 2 + ;; + + -d|--distribution) + LB_DISTRIBUTION="${2}" + shift 2 + ;; + + --parent-distribution) + LB_PARENT_DISTRIBUTION="${2}" + shift 2 + ;; + + -m|--parent-mirror-bootstrap) + LB_PARENT_MIRROR_BOOTSTRAP="${2}" + shift 2 + ;; + + --parent-mirror-chroot) + LB_PARENT_MIRROR_CHROOT="${2}" + shift 2 + ;; + + --parent-mirror-chroot-security) + LB_PARENT_MIRROR_CHROOT_SECURITY="${2}" + shift 2 + ;; + + --parent-mirror-chroot-volatile) + LB_PARENT_MIRROR_CHROOT_VOLATILE="${2}" + shift 2 + ;; + + --parent-mirror-chroot-backports) + LB_PARENT_MIRROR_CHROOT_BACKPORTS="${2}" + shift 2 + ;; + + --parent-mirror-binary) + LB_PARENT_MIRROR_BINARY="${2}" + shift 2 + ;; + + --parent-mirror-binary-security) + LB_PARENT_MIRROR_BINARY_SECURITY="${2}" + shift 2 + ;; + + --parent-mirror-binary-volatile) + LB_PARENT_MIRROR_BINARY_VOLATILE="${2}" + shift 2 + ;; + + --parent-mirror-binary-backports) + LB_PARENT_MIRROR_BINARY_BACKPORTS="${2}" + shift 2 + ;; + + --parent-mirror-debian-installer) + LB_PARENT_MIRROR_DEBIAN_INSTALLER="${2}" + shift 2 + ;; + + --mirror-bootstrap) + LB_MIRROR_BOOTSTRAP="${2}" + shift 2 + ;; + + --mirror-chroot) + LB_MIRROR_CHROOT="${2}" + shift 2 + ;; + + --mirror-chroot-security) + LB_MIRROR_CHROOT_SECURITY="${2}" + shift 2 + ;; + + --mirror-chroot-volatile) + LB_MIRROR_CHROOT_VOLATILE="${2}" + shift 2 + ;; + + --mirror-chroot-backports) + LB_MIRROR_CHROOT_BACKPORTS="${2}" + shift 2 + ;; + + --mirror-binary) + LB_MIRROR_BINARY="${2}" + shift 2 + ;; + + --mirror-binary-security) + LB_MIRROR_BINARY_SECURITY="${2}" + shift 2 + ;; + + --mirror-binary-volatile) + LB_MIRROR_BINARY_VOLATILE="${2}" + shift 2 + ;; + + --mirror-binary-backports) + LB_MIRROR_BINARY_BACKPORTS="${2}" + shift 2 + ;; + + --mirror-debian-installer) + LB_MIRROR_DEBIAN_INSTALLER="${2}" + shift 2 + ;; + + --archives) + LB_ARCHIVES="${2}" + shift 2 + ;; + + --archive-areas) + LB_ARCHIVE_AREAS="${2}" + shift 2 + ;; + + --parent-archive-areas) + LB_PARENT_ARCHIVE_AREAS="${2}" + shift 2 + ;; + + # config/chroot + --chroot-filesystem) + LB_CHROOT_FILESYSTEM="${2}" + shift 2 + ;; + + --exposed-root) + LB_EXPOSED_ROOT="${2}" + shift 2 + ;; + + --gzip-options) + GZIP_OPTIONS="${2}" + shift 2 + ;; + + --hooks) + LB_HOOKS="${2}" + shift 2 + ;; + + --interactive) + LB_INTERACTIVE="${2}" + shift 2 + ;; + + --keyring-packages) + LB_KEYRING_PACKAGES="${2}" + shift 2 + ;; + + -k|--linux-flavours) + LB_LINUX_FLAVOURS="${2}" + shift 2 + ;; + + --linux-packages) + LB_LINUX_PACKAGES="${2}" + shift 2 + ;; + + --security) + LB_SECURITY="${2}" + shift 2 + ;; + + --volatile) + LB_VOLATILE="${2}" + shift 2 + ;; + + --backports) + LB_BACKPORTS="${2}" + shift 2 + ;; + + # config/binary + --binary-filesystem) + LB_BINARY_FILESYSTEM="${2}" + shift 2 + ;; + + -b|--binary-images) + LB_BINARY_IMAGES="${2}" + shift 2 + ;; + + --bootappend-live) + LB_BOOTAPPEND_LIVE="${2}" + shift 2 + ;; + + --bootappend-install) + LB_BOOTAPPEND_INSTALL="${2}" + shift 2 + ;; + + --bootappend-failsafe) + LB_BOOTAPPEND_FAILSAFE="${2}" + shift 2 + ;; + + --bootloader) + LB_BOOTLOADER="${2}" + shift 2 + ;; + + --checksums) + LB_CHECKSUMS="${2}" + shift 2 + ;; + + --compression) + LB_COMPRESSION="${2}" + shift 2 + ;; + + --config) + _CONFIG="${2}" + shift 2 + ;; + + --zsync) + LB_ZSYNC="${2}" + shift 2 + ;; + + --build-with-chroot) + LB_BUILD_WITH_CHROOT="${2}" + shift 2 + ;; + + --debian-installer) + LB_DEBIAN_INSTALLER="${2}" + shift 2 + ;; + + --debian-installer-distribution) + LB_DEBIAN_INSTALLER_DISTRIBUTION="${2}" + shift 2 + ;; + + --parent-debian-installer-distribution) + LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${2}" + shift 2 + ;; + + --debian-installer-preseedfile) + LB_DEBIAN_INSTALLER_PRESEEDFILE="${2}" + shift 2 + ;; + + --debian-installer-gui) + LB_DEBIAN_INSTALLER_GUI="${2}" + shift 2 + ;; + + --grub-splash) + LB_GRUB_SPLASH="${2}" + shift 2 + ;; + + --isohybrid-options) + LB_ISOHYBRID_OPTIONS="${2}" + shift 2 + ;; + + --hdd-label) + LB_HDD_LABEL="${2}" + shift 2 + ;; + + --hdd-size) + LB_HDD_SIZE="${2}" + shift 2 + ;; + + --iso-application) + LB_ISO_APPLICATION="${2}" + shift 2 + ;; + + --iso-preparer) + LB_ISO_PREPARER="${2}" + shift 2 + ;; + + --iso-publisher) + LB_ISO_PUBLISHER="${2}" + shift 2 + ;; + + --iso-volume) + LB_ISO_VOLUME="${2}" + shift 2 + ;; + + --jffs2-eraseblock) + LB_JFFS2_ERASEBLOCK="${2}" + shift 2 + ;; + + --memtest) + LB_MEMTEST="${2}" + shift 2 + ;; + + --net-root-filesystem) + LB_NET_ROOT_FILESYSTEM="${2}" + shift 2 + ;; + + --net-root-mountoptions) + LB_NET_ROOT_MOUNTOPTIONS="${2}" + shift 2 + ;; + + --net-root-path) + LB_NET_ROOT_PATH="${2}" + shift 2 + ;; + + --net-root-server) + LB_NET_ROOT_SERVER="${2}" + shift 2 + ;; + + --net-cow-filesystem) + LB_NET_COW_FILESYSTEM="${2}" + shift 2 + ;; + + --net-cow-mountoptions) + LB_NET_COW_MOUNTOPTIONS="${2}" + shift 2 + ;; + + --net-cow-path) + LB_NET_COW_PATH="${2}" + shift 2 + ;; + + --net-cow-server) + LB_NET_COW_SERVER="${2}" + shift 2 + ;; + + --net-tarball) + LB_NET_TARBALL="${2}" + shift 2 + ;; + + --firmware-binary) + LB_FIRMWARE_BINARY="${2}" + shift 2 + ;; + + --firmware-chroot) + LB_FIRMWARE_CHROOT="${2}" + shift 2 + ;; + + --swap-file-path) + LB_SWAP_FILE_PATH="${2}" + shift 2 + ;; + + --swap-file-size) + LB_SWAP_FILE_SIZE="${2}" + shift 2 + ;; + + --syslinux-theme) + LB_SYSLINUX_THEME="${2}" + shift 2 + ;; + + --win32-loader) + LB_WIN32_LOADER="${2}" + shift 2 + ;; + + --bootstrap-qemu-arch) + LB_BOOTSTRAP_QEMU_ARCHITECTURES="${2}" + shift 2 + ;; + + --bootstrap-qemu-exclude) + LB_BOOTSTRAP_QEMU_EXCLUDE="${2}" + shift 2 + ;; + + --bootstrap-qemu-static) + LB_BOOTSTRAP_QEMU_STATIC="${2}" + shift 2 + ;; + + # config/source + --source) + LB_SOURCE="${2}" + shift 2 + ;; + + -s|--source-images) + LB_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) + echo "${VERSION}" + exit 0 + ;; + + --) + shift + break + ;; + + *) + Echo_error "internal error %s" "${0}" + exit 1 + ;; + esac + done +} + +Local_arguments "${@}" + +if [ -e .git ] && [ -n "${_CONFIG}" ] +then + if [ "${1}" != "noauto" ] + then + Echo_message "Ignoring --config ${_CONFIG}: ${PWD} is already a git repository" + fi + + _CONFIG="" +fi + +if [ -n "${_CONFIG}" ] +then + _GIT_REPOSITORY="$(echo ${_CONFIG} | sed -e 's|::.*$||')" + + Echo_message "Cloning ${_GIT_REPOSITORY}" + git clone ${_GIT_REPOSITORY} ./ + + if [ "${_GIT_REPOSITORY}" != "${_CONFIG}" ] + then + _GIT_BRANCH="$(echo ${_CONFIG} | awk -F\:\: '{ print $NF }')" + + Echo_message "Checking out ${_GIT_BRANCH}" + git checkout ${_GIT_BRANCH} + fi + + if [ -e auto/config ] + then + _EXTRA_OPTIONS="$(echo ${@} | sed -e "s|--config ${_GIT_REPOSITORY}::${_GIT_BRANCH}||g" -e "s|--config ${_GIT_REPOSITORY}||g")" + + Echo_message "The following extra options specified to lb config are going to be added to auto/config: ${_EXTRA_OPTIONS}" + sed -i -e "s|\"\${@}\"|${_EXTRA_OPTIONS} \"\${@}\"|" auto/config + fi +fi + +# Read meta config +if [ "${1}" != "noauto" ] && [ -x auto/config ] +then + Echo_message "Executing auto/config script." + ./auto/config "${@}" + exit ${?} +fi + +if [ "${1}" = "noauto" ] +then + shift +fi + +# Reading system configuration +if ! In_list "--ignore-system-defaults" "${@}" +then + Echo_message "Considering defaults defined in %s" "/etc/live/build.conf" + + Read_conffiles /etc/live/build.conf /etc/live/build/* +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 for a ${LB_MODE}/${LB_ARCHITECTURES} system" +else + Echo_message "Updating config tree for a ${LB_MODE}/${LB_ARCHITECTURES} system" +fi + +# Creating bootstrap configuration +mkdir -p config +mkdir -p config/includes +mkdir -p config/templates + +# Creating live-build configuration +cat > config/common << EOF +# config/common - common options for live-build(7) + +# LB_CONFIG_VERSION: internal version of the configuration file format +LB_CONFIG_VERSION="${CONFIG_VERSION}" + +# \$LB_APT: set package manager +# (Default: ${LB_APT}) +LB_APT="${LB_APT}" + +# \$LB_APT_FTP_PROXY: set apt/aptitude ftp proxy +# (Default: autodetected or empty) +LB_APT_FTP_PROXY="${LB_APT_FTP_PROXY}" + +# \$LB_APT_HTTP_PROXY: set apt/aptitude http proxy +# (Default: autodetected or empty) +LB_APT_HTTP_PROXY="${LB_APT_HTTP_PROXY}" + +# \$LB_APT_PIPELINE: set apt/aptitude pipeline depth +# (Default: ${LB_APT_PIPELINE}) +LB_APT_PIPELINE="${LB_APT_PIPELINE}" + +# \$LB_APT_RECOMMENDS: set apt/aptitude recommends +# (Default: ${LB_APT_RECOMMENDS}) +LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS}" + +# \$LB_APT_SECURE: set apt/aptitude security +# (Default: ${LB_APT_SECURE}) +LB_APT_SECURE="${LB_APT_SECURE}" + +# \$LB_APT_SOURCE_ARCHIVES: set apt/aptitude source entries in sources.list +# (Default: ${LB_APT_SOURCE_ARCHIVES}) +LB_APT_SOURCE_ARCHIVES="${LB_APT_SOURCE_ARCHIVES}" + +# \$LB_BOOTSTRAP: set bootstrap program +# (Default: ${LB_BOOTSTRAP}) +LB_BOOTSTRAP="${LB_BOOTSTRAP}" + +# \$LB_CACHE: control cache +# (Default: ${LB_CACHE}) +LB_CACHE="${LB_CACHE}" + +# \$LB_CACHE_INDICES: control if downloaded package indices should be cached +# (Default: ${LB_CACHE_INDICES}) +LB_CACHE_INDICES="${LB_CACHE_INDICES}" + +# \$LB_CACHE_PACKAGES: control if downloaded packages files should be cached +# (Default: ${LB_CACHE_PACKAGES}) +LB_CACHE_PACKAGES="${LB_CACHE_PACKAGES}" + +# \$LB_CACHE_STAGES: control if completed stages should be cached +# (Default: ${LB_CACHE_STAGES}) +LB_CACHE_STAGES="${LB_CACHE_STAGES}" + +# \$LB_DEBCONF_FRONTEND: set debconf(1) frontend to use +# (Default: ${LB_DEBCONF_FRONTEND}) +LB_DEBCONF_FRONTEND="${LB_DEBCONF_FRONTEND}" + +# \$LB_DEBCONF_NOWARNINGS: set debconf(1) warnings +# (Default: ${LB_DEBCONF_NOWARNINGS}) +LB_DEBCONF_NOWARNINGS="${LB_DEBCONF_NOWARNINGS}" + +# \$LB_DEBCONF_PRIORITY: set debconf(1) priority to use +# (Default: ${LB_DEBCONF_PRIORITY}) +LB_DEBCONF_PRIORITY="${LB_DEBCONF_PRIORITY}" + +# \$LB_INITRAMFS: set initramfs hook +# (Default: ${LB_INITRAMFS}) +LB_INITRAMFS="${LB_INITRAMFS}" + +# \$LB_INITRAMFS_COMPRESSION: set initramfs compression +# (Default: ${LB_INITRAMFS_COMPRESSION}) +LB_INITRAMFS_COMPRESSION="${LB_INITRAMFS_COMPRESSION}" + +# \$LB_INITSYSTEM: set init system +# (Default: ${LB_INITSYSTEM}) +LB_INITSYSTEM="${LB_INITSYSTEM}" + +# \$LB_FDISK: set fdisk program +# (Default: autodetected) +LB_FDISK="${LB_FDISK}" + +# \$LB_LOSETUP: set losetup program +# (Default: autodetected) +LB_LOSETUP="${LB_LOSETUP}" + +# \$LB_MODE: set distribution mode +# (Default: ${LB_MODE}) +LB_MODE="${LB_MODE}" + +# \$LB_SYSTEM: set system type +# (Default: ${LB_SYSTEM}) +LB_SYSTEM="${LB_SYSTEM}" + +# \$LB_ROOT_COMMAND: use sudo or equivalent +# (Default: empty) +#LB_ROOT_COMMAND="sudo" + +# \$LB_USE_FAKEROOT: use fakeroot/fakechroot +# (Default: ${LB_USE_FAKEROOT}) +LB_USE_FAKEROOT="${LB_USE_FAKEROOT}" + +# \$LB_TASKSEL: set tasksel program +# (Default: ${LB_TASKSEL}) +LB_TASKSEL="${LB_TASKSEL}" + +# \$LB_TEMPLATES: set templates +# (Default: ${LB_TEMPLATES}) +LB_TEMPLATES="${LB_TEMPLATES}" + +# live-build 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}" +DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS}" +CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS}" +GZIP_OPTIONS="${GZIP_OPTIONS}" +ISOHYBRID_OPTIONS="${ISOHYBRID_OPTIONS}" +EOF + +# Creating lb_bootstrap_* configuration +cat > config/bootstrap << EOF +# config/bootstrap - options for live-build(7), bootstrap stage + +# \$LB_ARCHITECTURES: select chroot architectures +# (Default: autodetected) +LB_ARCHITECTURES="${LB_ARCHITECTURES}" + +# \$LB_DISTRIBUTION: select distribution to use +# (Default: ${LB_DISTRIBUTION}) +LB_DISTRIBUTION="${LB_DISTRIBUTION}" + +# \$LB_PARENT_DISTRIBUTION: select parent distribution to use +# (Default: ${LB_PARENT_DISTRIBUTION}) +LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION}" + +# \$LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION: select parent distribution for debian-installer to use +# (Default: ${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}) +LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}" + +# \$LB_PARENT_MIRROR_BOOTSTRAP: set parent mirror to bootstrap from +# (Default: ${LB_PARENT_MIRROR_BOOTSTRAP}) +LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP}" + +# \$LB_PARENT_MIRROR_CHROOT: set parent mirror to fetch packages from +# (Default: ${LB_PARENT_MIRROR_CHROOT}) +LB_PARENT_MIRROR_CHROOT="${LB_PARENT_MIRROR_CHROOT}" + +# \$LB_PARENT_MIRROR_CHROOT_SECURITY: set security parent mirror to fetch packages from +# (Default: ${LB_PARENT_MIRROR_CHROOT_SECURITY}) +LB_PARENT_MIRROR_CHROOT_SECURITY="${LB_PARENT_MIRROR_CHROOT_SECURITY}" + +# \$LB_PARENT_MIRROR_CHROOT_VOLATILE: set volatile parent mirror to fetch packages from +# (Default: ${LB_PARENT_MIRROR_CHROOT_VOLATILE}) +LB_PARENT_MIRROR_CHROOT_VOLATILE="${LB_PARENT_MIRROR_CHROOT_VOLATILE}" + +# \$LB_PARENT_MIRROR_CHROOT_BACKPORTS: set backports parent mirror to fetch packages from +# (Default: ${LB_PARENT_MIRROR_CHROOT_BACKPORTS}) +LB_PARENT_MIRROR_CHROOT_BACKPORTS="${LB_PARENT_MIRROR_CHROOT_BACKPORTS}" + +# \$LB_PARENT_MIRROR_BINARY: set parent mirror which ends up in the image +# (Default: ${LB_PARENT_MIRROR_BINARY}) +LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY}" + +# \$LB_PARENT_MIRROR_BINARY_SECURITY: set security parent mirror which ends up in the image +# (Default: ${LB_PARENT_MIRROR_BINARY_SECURITY}) +LB_PARENT_MIRROR_BINARY_SECURITY="${LB_PARENT_MIRROR_BINARY_SECURITY}" + +# \$LB_PARENT_MIRROR_BINARY_VOLATILE: set volatile parent mirror which ends up in the image +# (Default: ${LB_PARENT_MIRROR_BINARY_VOLATILE}) +LB_PARENT_MIRROR_BINARY_VOLATILE="${LB_PARENT_MIRROR_BINARY_VOLATILE}" + +# \$LB_PARENT_MIRROR_BINARY_BACKPORTS: set backports parent mirror which ends up in the image +# (Default: ${LB_PARENT_MIRROR_BINARY_BACKPORTS}) +LB_PARENT_MIRROR_BINARY_BACKPORTS="${LB_PARENT_MIRROR_BINARY_BACKPORTS}" + +# \$LB_PARENT_MIRROR_DEBIAN_INSTALLER: set debian-installer parent mirror +# (Default: ${LB_PARENT_MIRROR_BOOTSTRAP}) +LB_PARENT_MIRROR_DEBIAN_INSTALLER="${LB_PARENT_MIRROR_DEBIAN_INSTALLER}" + +# \$LB_MIRROR_BOOTSTRAP: set mirror to bootstrap from +# (Default: ${LB_MIRROR_BOOTSTRAP}) +LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP}" + +# \$LB_MIRROR_CHROOT: set mirror to fetch packages from +# (Default: ${LB_MIRROR_CHROOT}) +LB_MIRROR_CHROOT="${LB_MIRROR_CHROOT}" + +# \$LB_MIRROR_CHROOT_SECURITY: set security mirror to fetch packages from +# (Default: ${LB_MIRROR_CHROOT_SECURITY}) +LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY}" + +# \$LB_MIRROR_CHROOT_VOLATILE: set volatile mirror to fetch packages from +# (Default: ${LB_MIRROR_CHROOT_VOLATILE}) +LB_MIRROR_CHROOT_VOLATILE="${LB_MIRROR_CHROOT_VOLATILE}" + +# \$LB_MIRROR_CHROOT_BACKPORTS: set backports mirror to fetch packages from +# (Default: ${LB_MIRROR_CHROOT_BACKPORTS}) +LB_MIRROR_CHROOT_BACKPORTS="${LB_MIRROR_CHROOT_BACKPORTS}" + +# \$LB_MIRROR_BINARY: set mirror which ends up in the image +# (Default: ${LB_MIRROR_BINARY}) +LB_MIRROR_BINARY="${LB_MIRROR_BINARY}" + +# \$LB_MIRROR_BINARY_SECURITY: set security mirror which ends up in the image +# (Default: ${LB_MIRROR_BINARY_SECURITY}) +LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY}" + +# \$LB_MIRROR_BINARY_VOLATILE: set volatile mirror which ends up in the image +# (Default: ${LB_MIRROR_BINARY_VOLATILE}) +LB_MIRROR_BINARY_VOLATILE="${LB_MIRROR_BINARY_VOLATILE}" + +# \$LB_MIRROR_BINARY_BACKPORTS: set backports mirror which ends up in the image +# (Default: ${LB_MIRROR_BINARY_BACKPORTS}) +LB_MIRROR_BINARY_BACKPORTS="${LB_MIRROR_BINARY_BACKPORTS}" + +# \$LB_MIRROR_DEBIAN_INSTALLER: set debian-installer mirror +# (Default: ${LB_MIRROR_BOOTSTRAP}) +LB_MIRROR_DEBIAN_INSTALLER="${LB_MIRROR_DEBIAN_INSTALLER}" + +# \$LB_ARCHIVES: enable available third-party archives +# (Default: empty) +LB_ARCHIVES="${LB_ARCHIVES}" + +# \$LB_ARCHIVE_AREAS: select archive areas to use +# (Default: ${LB_ARCHIVE_AREAS}) +LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS}" + +# \$LB_PARENT_ARCHIVE_AREAS: select archive areas to use +# (Default: ${LB_PARENT_ARCHIVE_AREAS}) +LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS}" + +# \$LB_BOOTSTRAP_QEMU_ARCHITECTURES: architectures to use foreign bootstrap +# (Default: ${LB_BOOTSTRAP_QEMU_ARCHITECTURES}) +LB_BOOTSTRAP_QEMU_ARCHITECTURES="${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" + +# \$LB_BOOTSTRAP_QEMU_EXCLUDE: packages to exclude during foreign bootstrap +# (Default: ${LB_BOOTSTRAP_QEMU_EXCLUDE}) +LB_BOOTSTRAP_QEMU_EXCLUDE="${LB_BOOTSTRAP_QEMU_EXCLUDE}" + +# \$LB_BOOTSTRAP_QEMU_STATIC: static qemu binary for foreign bootstrap +# (Default: ${LB_BOOTSTRAP_QEMU_STATIC}) +LB_BOOTSTRAP_QEMU_STATIC="${LB_BOOTSTRAP_QEMU_STATIC}" +EOF + +# Creating lb_chroot_* configuration +mkdir -p config/archives +mkdir -p config/chroot_apt +mkdir -p config/hooks +mkdir -p config/includes.chroot +mkdir -p config/packages +mkdir -p config/packages.chroot +mkdir -p config/package-lists +mkdir -p config/preseed + +cat > config/chroot << EOF +# config/chroot - options for live-build(7), chroot stage + +# \$LB_CHROOT_FILESYSTEM: set chroot filesystem +# (Default: ${LB_CHROOT_FILESYSTEM}) +LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM}" + +# \$LB_UNION_FILESYSTEM: set union filesystem +# (Default: ${LB_UNION_FILESYSTEM}) +LB_UNION_FILESYSTEM="${LB_UNION_FILESYSTEM}" + +# \$LB_EXPOSED_ROOT: expose root as read only +# (Default: ${LB_EXPOSED_ROOT}) +LB_EXPOSED_ROOT="${LB_EXPOSED_ROOT}" + +# \$LB_HOOKS: set hook commands +# (Default: empty) +LB_HOOKS="${LB_HOOKS}" + +# \$LB_INTERACTIVE: set interactive build +# (Default: ${LB_INTERACTIVE}) +LB_INTERACTIVE="${LB_INTERACTIVE}" + +# \$LB_KEYRING_PACKAGES: set keyring packages +# (Default: empty) +LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES}" + +# \$LB_LINUX_FLAVOURS: set kernel flavour to use +# (Default: autodetected) +LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS}" + +# \$LB_LINUX_PACKAGES: set kernel packages to use +# (Default: autodetected) +LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES}" + +# \$LB_SECURITY: enable security updates +# (Default: ${LB_SECURITY}) +LB_SECURITY="${LB_SECURITY}" + +# \$LB_VOLATILE: enable volatile updates +# (Default: ${LB_VOLATILE}) +LB_VOLATILE="${LB_VOLATILE}" + +# \$LB_BACKPORTS: enable backports updates +# (Default: ${LB_BACKPORTS}) +LB_BACKPORTS="${LB_BACKPORTS}" +EOF + +# Creating lb_binary_* configuration +mkdir -p config/binary_debian-installer +mkdir -p config/binary_grub +mkdir -p config/includes.binary +mkdir -p config/includes.binary_debian-installer +mkdir -p config/packages.binary +mkdir -p config/package-lists +mkdir -p config/binary_rootfs +mkdir -p config/binary_syslinux + +cat > config/binary << EOF +# config/binary - options for live-build(7), binary stage + +# \$LB_BINARY_FILESYSTEM: set image filesystem +# (Default: ${LB_BINARY_FILESYSTEM}) +LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM}" + +# \$LB_BINARY_IMAGES: set image type +# (Default: ${LB_BINARY_IMAGES}) +LB_BINARY_IMAGES="${LB_BINARY_IMAGES}" + +# \$LB_APT_INDICES: set apt/aptitude generic indices +# (Default: ${LB_APT_INDICES}) +LB_APT_INDICES="${LB_APT_INDICES}" + +# \$LB_BOOTAPPEND_LIVE: set boot parameters +# (Default: empty) +LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE}" + +# \$LB_BOOTAPPEND_INSTALL: set boot parameters +# (Default: empty) +LB_BOOTAPPEND_INSTALL="${LB_BOOTAPPEND_INSTALL}" + +# \$LB_BOOTAPPEND_FAILSAFE: set boot parameters +# (Default: empty) +LB_BOOTAPPEND_FAILSAFE="${LB_BOOTAPPEND_FAILSAFE}" + +# \$LB_BOOTLOADER: set bootloader +# (Default: ${LB_BOOTLOADER}) +LB_BOOTLOADER="${LB_BOOTLOADER}" + +# \$LB_CHECKSUMS: set checksums +# (Default: ${LB_CHECKSUMS}) +LB_CHECKSUMS="${LB_CHECKSUMS}" + +# \$LB_COMPRESSION: set compression +# (Default: ${LB_COMPRESSION}) +LB_COMPRESSION="${LB_COMPRESSION}" + +# \$LB_ZSYNC: set zsync +# (Default: ${LB_ZSYNC}) +LB_ZSYNC="${LB_ZSYNC}" + +# \${LB_BUILD_WITH_CHROOT: control if we build binary images chrooted +# (Default: ${LB_BUILD_WITH_CHROOT}) +# DO NEVER, *NEVER*, *N*E*V*E*R* SET THIS OPTION to false. +LB_BUILD_WITH_CHROOT="${LB_BUILD_WITH_CHROOT}" + +# \$LB_DEBIAN_INSTALLER: set debian-installer +# (Default: ${LB_DEBIAN_INSTALLER}) +LB_DEBIAN_INSTALLER="${LB_DEBIAN_INSTALLER}" + +# \$LB_DEBIAN_INSTALLER_DISTRIBUTION: set debian-installer suite +# (Default: empty) +LB_DEBIAN_INSTALLER_DISTRIBUTION="${LB_DEBIAN_INSTALLER_DISTRIBUTION}" + +# \$LB_DEBIAN_INSTALLER_PRESEEDFILE: set debian-installer preseed filename/url +# (Default: ${LB_DEBIAN_INSTALLER_PRESEEDFILE}) +LB_DEBIAN_INSTALLER_PRESEEDFILE="${LB_DEBIAN_INSTALLER_PRESEEDFILE}" + +# \$LB_DEBIAN_INSTALLER_GUI: toggle use of GUI debian-installer +# (Default: ${LB_DEBIAN_INSTALLER_GUI}) +LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI}" + +# \$LB_GRUB_SPLASH: set custom grub splash +# (Default: empty) +LB_GRUB_SPLASH="${LB_GRUB_SPLASH}" + +# \$LB_HDD_LABEL: set hdd label +# (Default: ${LB_HDD_LABEL}) +LB_HDD_LABEL="${LB_HDD_LABEL}" + +# \$LB_HDD_SIZE: set hdd filesystem size +# (Default: ${LB_HDD_SIZE}) +LB_HDD_SIZE="${LB_HDD_SIZE}" + +# \$LB_ISO_APPLICATION: set iso author +# (Default: ${LB_ISO_APPLICATION}) +LB_ISO_APPLICATION="${LB_ISO_APPLICATION}" + +# \$LB_ISO_PREPARER: set iso preparer +# (Default: ${LB_ISO_PREPARER}) +LB_ISO_PREPARER="${LB_ISO_PREPARER}" + +# \$LB_ISO_PUBLISHER: set iso publisher +# (Default: ${LB_ISO_PUBLISHER}) +LB_ISO_PUBLISHER="${LB_ISO_PUBLISHER}" + +# \$LB_ISO_VOLUME: set iso volume (max 32 chars) +# (Default: ${LB_ISO_VOLUME}) +LB_ISO_VOLUME="${LB_ISO_VOLUME}" + +# \$LB_JFFS2_ERASEBLOCK: set jffs2 eraseblock size +# (Default: unset) +LB_JFFS2_ERASEBLOCK="" + +# \$LB_MEMTEST: set memtest +# (Default: ${LB_MEMTEST}) +LB_MEMTEST="${LB_MEMTEST}" + +# \$LB_WIN32_LOADER: set win32-loader +# (Default: ${LB_WIN32_LOADER}) +LB_WIN32_LOADER="${LB_WIN32_LOADER}" + +# \$LB_NET_ROOT_FILESYSTEM: set netboot filesystem +# (Default: ${LB_NET_ROOT_FILESYSTEM}) +LB_NET_ROOT_FILESYSTEM="${LB_NET_ROOT_FILESYSTEM}" + +# \$LB_NET_ROOT_MOUNTOPTIONS: set nfsopts +# (Default: empty) +LB_NET_ROOT_MOUNTOPTIONS="${LB_NET_ROOT_MOUNTOPTIONS}" + +# \$LB_NET_ROOT_PATH: set netboot server directory +# (Default: ${LB_NET_ROOT_PATH}) +LB_NET_ROOT_PATH="${LB_NET_ROOT_PATH}" + +# \$LB_NET_ROOT_SERVER: set netboot server address +# (Default: ${LB_NET_ROOT_SERVER}) +LB_NET_ROOT_SERVER="${LB_NET_ROOT_SERVER}" + +# \$LB_NET_COW_FILESYSTEM: set net client cow filesystem +# (Default: ${LB_NET_COW_FILESYSTEM}) +LB_NET_COW_FILESYSTEM="${LB_NET_COW_FILESYSTEM}" + +# \$LB_NET_COW_MOUNTOPTIONS: set cow mount options +# (Default: empty) +LB_NET_COW_MOUNTOPTIONS="${LB_NET_COW_MOUNTOPTIONS}" + +# \$LB_NET_COW_PATH: set cow directory +# (Default: ${LB_NET_COW_PATH}) +LB_NET_COW_PATH="${LB_NET_COW_PATH}" + +# \$LB_NET_COW_SERVER: set cow server +# (Default: ${LB_NET_COW_SERVER}) +LB_NET_COW_SERVER="${LB_NET_COW_SERVER}" + +# \$LB_NET_TARBALL: set net tarball +# (Default: ${LB_NET_TARBALL}) +LB_NET_TARBALL="${LB_NET_TARBALL}" + +# \$LB_FIRMWARE_BINARY: include firmware packages in debian-installer +# (Default: ${LB_FIRMWARE_BINARY}) +LB_FIRMWARE_BINARY="${LB_FIRMWARE_BINARY}" + +# \$LB_FIRMWARE_CHROOT: include firmware packages in debian-installer +# (Default: ${LB_FIRMWARE_CHROOT}) +LB_FIRMWARE_CHROOT="${LB_FIRMWARE_CHROOT}" + +# \$LB_SWAP_FILE_PATH: set swap file path +# (Default: ${LB_SWAP_FILE_PATH}) +LB_SWAP_FILE_PATH="${LB_SWAP_FILE_PATH}" + +# \$LB_SWAP_FILE_SIZE: set swap file size +# (Default: ${LB_SWAP_FILE_SIZE}) +LB_SWAP_FILE_SIZE="${LB_SWAP_FILE_SIZE}" + +# \$LB_SYSLINUX_THEME: set syslinux theme package +# (Default: ${LB_SYSLINUX_THEME}) +LB_SYSLINUX_THEME="${LB_SYSLINUX_THEME}" +EOF + +# Creating lb_source_* configuration +cat > config/source << EOF +# config/source - options for live-build(7), source stage + +# \$LB_SOURCE: set source option +# (Default: ${LB_SOURCE}) +LB_SOURCE="${LB_SOURCE}" + +# \$LB_SOURCE_IMAGES: set image type +# (Default: ${LB_SOURCE_IMAGES}) +LB_SOURCE_IMAGES="${LB_SOURCE_IMAGES}" +EOF + +mkdir -p auto +mkdir -p local/functions +mkdir -p local/scripts + +if [ "${CONFIG}" = "clone" ] # FIXME +then + # Read package selection + echo $(dpkg --get-selections | awk '{ print $1 }') > config/package-lists/local.list.chroot + + # 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/preseed/local.preseed.chroot + fi +fi + +# Checking defaults again +Check_defaults + +if [ "${_CLEAN}" = "true" ] +then + # Remove empty directories in config tree + rmdir --ignore-fail-on-non-empty config/*/ > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty config > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty auto > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty local/functions > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty local/scripts > /dev/null 2>&1 || true + rmdir --ignore-fail-on-non-empty local > /dev/null 2>&1 || true +fi + +# Creating stage file +Create_stagefile .build/config diff --git a/scripts/build/lb_binary b/scripts/build/lb_binary deleted file mode 100755 index 4fbbc096d..000000000 --- a/scripts/build/lb_binary +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Automatically populating config tree -if [ -x auto/config ] && [ ! -e .build/config ] -then - Echo_message "Automatically populating config tree." - lb config -fi - -# 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 -lb binary_chroot ${@} - -if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] -then - # Configuring chroot - lb chroot_devpts install ${@} - lb chroot_proc install ${@} - lb chroot_selinuxfs install ${@} - lb chroot_sysfs install ${@} - lb chroot_hosts install ${@} - lb chroot_resolv install ${@} - lb chroot_hostname install ${@} - lb chroot_sysv-rc install ${@} - lb chroot_upstart install ${@} - lb chroot_apt install-binary ${@} - lb chroot_archives chroot install ${@} -fi - -# Building root filesystem -lb binary_rootfs ${@} -lb binary_manifest ${@} - -# Prepare images -lb binary_package-lists ${@} -lb binary_linux-image ${@} -lb binary_debian-installer ${@} -lb binary_memtest ${@} -lb binary_grub ${@} -lb binary_grub2 ${@} -lb binary_syslinux ${@} -lb binary_yaboot ${@} -lb binary_silo ${@} -lb binary_disk ${@} -lb binary_win32-loader ${@} -lb binary_includes ${@} -lb binary_hooks ${@} -lb binary_checksums ${@} - -if [ "${LB_BUILD_WITH_CHROOT}" != "true" ] -then - lb chroot_devpts install ${@} - lb chroot_proc install ${@} - lb chroot_selinuxfs install ${@} - lb chroot_sysfs install ${@} -fi - -# Building images -lb binary_iso ${@} -lb binary_netboot ${@} -lb binary_tar ${@} -lb binary_hdd ${@} -lb binary_virtual-hdd ${@} - -lb binary_zsync ${@} - -if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] -then - # Deconfiguring chroot - rm -f .build/chroot_archives - lb chroot_apt remove ${@} - lb chroot_hostname remove ${@} - lb chroot_resolv remove ${@} - lb chroot_hosts remove ${@} - lb chroot_upstart remove ${@} - lb chroot_sysv-rc remove ${@} - lb chroot_dpkg remove ${@} - lb chroot_debianchroot remove ${@} -fi - -lb chroot_sysfs remove ${@} -lb chroot_selinuxfs remove ${@} -lb chroot_proc remove ${@} -lb chroot_devpts remove ${@} diff --git a/scripts/build/lb_binary_checksums b/scripts/build/lb_binary_checksums deleted file mode 100755 index e6ece1457..000000000 --- a/scripts/build/lb_binary_checksums +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'create binary checksums')" -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 [ "${LB_CHECKSUMS}" = "none" ] || [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ] -then - exit 0 -fi - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_checksums - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -for CHECKSUM in ${LB_CHECKSUMS} -do - CHECKSUMS="$(echo ${CHECKSUM} | tr [a-z] [A-Z])SUMS" - - Echo_message "Begin creating binary ${CHECKSUMS}..." - - # Remove old checksums - if [ -f binary/${CHECKSUMS} ] - then - rm -f binary/${CHECKSUMS} - fi - - # Calculating checksums - cd binary - find . -type f \ - \! -path './isolinux/isolinux.bin' \ - \! -path './boot/boot.bin' \ - \! -path './boot/grub/stage2_eltorito' \ - \! -path './*SUMS' \ - -print0 | sort -z | xargs -0 ${CHECKSUM}sum > ../${CHECKSUMS} - -cat > ${CHECKSUMS} << EOF -This file contains the list of ${CHECKSUM} checksums of all files on this medium. - -You can verify them automatically with the 'integrity-check' boot parameter, -or, manually with: '${CHECKSUM}sum -c ${CHECKSUMS}'. - - -EOF - - cat ../${CHECKSUMS} >> ${CHECKSUMS} - rm -f ../${CHECKSUMS} - - cd "${OLDPWD}" -done - -# File list -cd binary -find . | sed -e 's|^.||g' | grep "^/" | sort > ../binary.contents -cd "${OLDPWD}" - -# Creating stage file -Create_stagefile .build/binary_checksums diff --git a/scripts/build/lb_binary_chroot b/scripts/build/lb_binary_chroot deleted file mode 100755 index 4d4500e55..000000000 --- a/scripts/build/lb_binary_chroot +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/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 [ "${LB_USE_FAKEROOT}" != "true" ] - then - ${LB_ROOT_COMMAND} umount chroot/proc - else - rm -rf chroot/proc - mkdir -p chroot/proc - fi -fi - -if [ -d chroot/sys/kernel ] -then - if [ "${LB_USE_FAKEROOT}" != "true" ] - then - ${LB_ROOT_COMMAND} umount chroot/sys - else - rm -rf chroot/sys - mkdir -p chroot/sys - fi -fi - -# Copying /dev if using fakeroot -if [ "${LB_USE_FAKEROOT}" = "true" ] -then - rm -rf chroot/dev - find /dev | cpio -dmpu chroot -fi - -if [ "${LB_BUILD_WITH_CHROOT}" = "false" ] -then - exit 0 -fi - -if [ "${LB_CACHE}" = "true" ] && Find_files cache/binary_rootfs/filesystem* -then - exit 0 -fi - -Echo_message "This may take a while." - -# Removing old chroot -${LB_ROOT_COMMAND} rm -rf chroot/chroot -${LB_ROOT_COMMAND} rm -rf chroot.tmp - -# Copying new chroot -if [ -d cache/bootstrap ] && [ "${LB_CHROOT_FILESYSTEM}" != "none" ] -then - ${LB_ROOT_COMMAND} mv chroot chroot.tmp - ${LB_ROOT_COMMAND} cp -a cache/bootstrap chroot - ${LB_ROOT_COMMAND} touch chroot/chroot.cache -else - ${LB_ROOT_COMMAND} cp -a chroot chroot.tmp -fi - -${LB_ROOT_COMMAND} mv chroot.tmp chroot/chroot - -# Handling chroot excludes -if [ -f config/binary_rootfs/excludes ] && [ "${LB_CHROOT_FILESYSTEM}" != "squashfs" ] -then - case "${LB_BUILD_WITH_CHROOT}" in - true) - cp config/binary_rootfs/excludes chroot/chroot/excludes - # Not using Chroot() here because we want explicitly /bin/bash (for the time being) - chroot chroot/chroot /usr/bin/env -i xargs --arg-file=/excludes -I FILE bash -c 'rm -rf FILE' - rm -f chroot/chroot/excludes - ;; - - false) - cp config/binary_rootfs/excludes chroot/excludes - # Not using Chroot() here because we want explicitly /bin/bash (for the time being) - chroot chroot /usr/bin/env -i xargs --arg-file=/excludes -I FILE bash -c 'rm -rf FILE' - rm -f chroot/excludes - ;; - esac -fi - -if [ -n "${LB_ROOT_COMMAND}" ] -then - ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot -fi - -# Creating stage file -Create_stagefile .build/binary_chroot diff --git a/scripts/build/lb_binary_debian-installer b/scripts/build/lb_binary_debian-installer deleted file mode 100755 index a6ed88b6e..000000000 --- a/scripts/build/lb_binary_debian-installer +++ /dev/null @@ -1,870 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_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 "${LB_DEBIAN_INSTALLER}" in - true|cdrom|netinst|netboot|businesscard|live) - ;; - - false) - exit 0 - ;; - - *) - Echo_error "debian-installer flavour %s not supported." "${LB_DEBIAN_INSTALLER}" - exit 1 - ;; -esac - -Echo_message "Begin installing debian-installer..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/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 "${LB_BINARY_IMAGES}" in - netboot) - DESTDIR="tftpboot/debian-install/${LB_ARCHITECTURES}" - ;; - - hdd*|tar) - DESTDIR="binary/install" - ;; - - *) - DESTDIR="binary/install" - ;; -esac - -# Set d-i image type -case "${LB_DEBIAN_INSTALLER}" in - businesscard|netboot|netinst) - DI_IMAGE_TYPE="netboot" - ;; - *) - case "${LB_BINARY_IMAGES}" in - netboot) - DI_IMAGE_TYPE="netboot" - ;; - - *) - DI_IMAGE_TYPE="cdrom" - ;; - esac - ;; -esac - -# Set architecture-specific variables -case "${LB_ARCHITECTURES}" in - armel) - DEFAULT_FLAVOUR="$(echo ${LH_LINUX_FLAVOURS} | awk '{ print $1 }')" - case "${DI_IMAGE_TYPE}" in - cdrom) - DI_REMOTE_BASE="${DEFAULT_FLAVOUR}/cdrom" - ;; - - netboot) - DI_REMOTE_BASE="${DEFAULT_FLAVOUR}/netboot" - ;; - esac - - DI_REMOTE_KERNEL="vmlinuz" - DI_REMOTE_BASE_GTK="${DI_REMOTE_BASE}/gtk" - ;; - - powerpc) - case "${DI_IMAGE_TYPE}" in - cdrom) - DI_REMOTE_BASE="${LB_ARCHITECTURES}/cdrom" - ;; - - netboot) - DI_REMOTE_BASE="${LB_ARCHITECTURES}/netboot" - ;; - esac - - DI_REMOTE_KERNEL="vmlinux" - DI_REMOTE_BASE_GTK="${DI_REMOTE_BASE}/gtk" - ;; - - sparc) - DEFAULT_FLAVOUR="$(echo ${LB_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/${LB_ARCHITECTURES}" - DI_REMOTE_BASE_GTK="netboot/gtk/debian-installer/${LB_ARCHITECTURES}" - DI_REMOTE_KERNEL="linux" - ;; - - cdrom) - DI_REMOTE_BASE="cdrom" - DI_REMOTE_BASE_GTK="cdrom/gtk" - DI_REMOTE_KERNEL="vmlinuz" - ;; - esac - ;; -esac - -Check_multiarchitectures - -Install_file() { - local FILE - FILE="${1}" - - local ARCHIVE_AREA - ARCHIVE_AREA="$(dpkg -I ${FILE} | awk '/^.*Section: / { print $2 }')" - - if echo "${ARCHIVE_AREA}" | grep -qs '/' - then - ARCHIVE_AREA="$(echo ${ARCHIVE_AREA} | awk -F/ '{ print $1 }')" - else - ARCHIVE_AREA="main" - fi - - local TARGET - TARGET="${2}/${ARCHIVE_AREA}" - - 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. -_LB_CACHE_DIR="$(pwd)/cache/binary_debian-installer" - -Download_file () { - local _LB_TARGET - _LB_TARGET="${1}" - - local _LB_URL - _LB_URL="${2}" - - _LB_CACHE_FILE="${_LB_CACHE_DIR}/$(echo "${_LB_URL}" | sed 's|/|_|g')" - - if [ ! -f "${_LB_CACHE_FILE}" ] - then - mkdir -p ${_LB_CACHE_DIR} - if ! wget ${WGET_OPTIONS} -O "${_LB_CACHE_FILE}" "${_LB_URL}" - then - rm -f "${_LB_CACHE_FILE}" - - Echo_error "Could not download file: %s" "${_LB_URL}" - exit 1 - fi - fi - - if [ "$(stat --printf %d "${_LB_CACHE_DIR}")" = "$(stat --printf %d ./)" ] - then - CP_OPTIONS="-l" - fi - - cp -f ${CP_OPTIONS} -- "${_LB_CACHE_FILE}" "${_LB_TARGET}" -} - -VMLINUZ_DI="vmlinuz" -INITRD_DI="initrd.gz" -DESTDIR_DI="${DESTDIR}" - -VMLINUZ_GI="gtk/vmlinuz" -INITRD_GI="gtk/initrd.gz" -DESTDIR_GI="${DESTDIR}/gtk" - -case "${LB_DERIVATIVE}" in - false) - if [ "${LB_DEBIAN_INSTALLER_DISTRIBUTION}" = "daily" ] - then - # FIXME: variable name should be decupled from derivatves - LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="sid" - - # Debian Installer daily builds - URL="http://d-i.debian.org/daily-images/${LB_ARCHITECTURES}/daily/" - else - URL="${LB_MIRROR_DEBIAN_INSTALLER}/dists/${LB_DEBIAN_INSTALLER_DISTRIBUTION}/main/installer-${LB_ARCHITECTURES}/current/images/" - fi - ;; - - true) - if [ "${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}" = "daily" ] - then - LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="sid" - - # Debian Installer daily builds - URL="http://d-i.debian.org/daily-images/${LB_ARCHITECTURES}/daily/" - else - URL="${LB_PARENT_MIRROR_DEBIAN_INSTALLER}/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/main/installer-${LB_ARCHITECTURES}/current/images/" - fi - - if [ "${LB_MODE}" = "progress" ] - then - # FIXME: normal derivatives probably don't rebuild d-i, - # but progress does. - URL="${LB_MIRROR_DEBIAN_INSTALLER}/dists/${LB_DEBIAN_INSTALLER_DISTRIBUTION}/main/installer-${LB_ARCHITECTURES}/current/images/" - fi - ;; -esac - -mkdir -p "${DESTDIR_DI}" - -if [ "${LB_ARCHITECTURES}" = "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 - ${LB_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}" - - ${LB_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 [ "${LB_DEBIAN_INSTALLER_GUI}" = "true" ] - then - case "${LB_ARCHITECTURES}" in - amd64|i386) - DOWNLOAD_GTK_INSTALLER=1 - ;; - - powerpc) - if [ "${LB_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 - - mv chroot/var/lib/dpkg/status chroot/var/lib/dpkg/status.tmp - touch chroot/var/lib/dpkg/status - - case "${LB_ARCHITECTURES}" in - amd64) - DI_REQ_PACKAGES="lilo grub grub-pc" - - case "${LB_MODE}" in - ubuntu|kubuntu) - DI_PACKAGES="${DI_REQ_PACKAGES} linux-generic" - ;; - - *) - DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-amd64" - ;; - esac - ;; - - i386) - DI_REQ_PACKAGES="elilo lilo grub grub-pc" - - case "${LB_MODE}" in - ubuntu|kubuntu) - DI_PACKAGES="${DI_REQ_PACKAGES} linux-generic" - ;; - - *) - DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-486 linux-image-2.6-686" - ;; - esac - ;; - - sparc) - DI_REQ_PACKAGES="silo" - case "${LB_MODE}" in - ubuntu|kubuntu) - DI_PACKAGES="${DI_REQ_PACKAGES} linux-sparc64" - ;; - - *) - DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-sparc64 linux-image-2.6-sparc64-smp" - ;; - esac - ;; - - powerpc) - DI_REQ_PACKAGES="yaboot" - case "${LB_MODE}" in - ubuntu|kubuntu) - DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-powerpc linux-image-powerpc64-smp" - ;; - - *) - DI_PACKAGES="${DI_REQ_PACKAGES} linux-image-2.6-powerpc linux-image-2.6-powerpc64 linux-image-2.6-powerpc-smp" - ;; - esac - ;; - esac - - DI_PACKAGES="${DI_PACKAGES} busybox cryptsetup mdadm lvm2" - - case "${LB_MODE}" in - debian) - DI_REQ_PACKAGES="${DI_REQ_PACKAGES} console-setup keyboard-configuration kbd" - DI_PACKAGES="${DI_PACKAGES} console-setup keyboard-configuration kbd" - ;; - esac - - # Include firmware packages - if [ "${LB_FIRMWARE_BINARY}" = "true" ] - then - # Assumption: firmware packages install files into /lib/firmware - - # Get all firmware packages names - mkdir -p cache/contents.binary - wget ${WGET_OPTIONS} ${LB_PARENT_MIRROR_CHROOT}/dists/${LB_PARENT_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz -O - | gunzip -c > cache/contents.binary/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES} - - FIRMWARE_PACKAGES="" - FIRMWARE_PACKAGES="$(awk '/^lib\/firmware/ { print $2 }' cache/contents.binary/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)" - - if [ "${LB_DERIVATIVE}" = "true" ] - then - wget {WGET_OPTIONS} ${LB_MIRROR_CHROOT}/dists/${LB_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz -O - | gunzip -c > cache/contents.binary/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES} - - FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.binary/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)" - fi - - # Filter out contrib packages if contrib is not enabled - if ! echo ${LB_ARCHIVE_AREAS} | grep -qs contrib - then - _FIRMWARE_PACKAGES="" - - for _PACKAGE in ${FIRMWARE_PACKAGES} - do - _FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | sed -e 's|^contrib/.*$||')" - done - - FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES}" - fi - - # Filter out non-free packages if non-free is not enabled - if ! echo ${LB_ARCHIVE_AREAS} | grep -qs non-free - then - _FIRMWARE_PACKAGES="" - - for _PACKAGE in ${FIRMWARE_PACKAGES} - do - _FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | sed -e 's|^non-free/.*$||')" - done - - FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES}" - - else - # Manually add firmware-linux/non-free meta package - FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} firmware-linux" - fi - - # Drop section and keep package names only - for _PACKAGE in ${FIRMWARE_PACKAGES} - do - DI_FIRMWARE_PACKAGES="${DI_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | awk -F/ '{ print $NF }')" - done - fi - - # Set apt command prefix - _LB_APT_COMMAND="apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb -o APT::Install-Recommends=false --download-only" - - if [ "${LB_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 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 ${_LB_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 ${_LB_APT_COMMAND} install ${DI_PACKAGES} ${DI_FIRMWARE_PACKAGES} ${DI_REQ_PACKAGES} - else - # Download .debs of the required packages - Chroot chroot ${_LB_APT_COMMAND} install ${DI_PACKAGES} ${DI_FIRMWARE_PACKAGES} - - # Revert dpkg status file - mv chroot/var/lib/dpkg/status.tmp chroot/var/lib/dpkg/status - fi - - mv chroot/binary.deb ./ - - for _ARCHIVE_AREA in $(echo ${LB_PARENT_ARCHIVE_AREAS} ${LB_ARCHIVE_AREAS}) - do - mkdir -p binary/pool/${_ARCHIVE_AREA} - done - - if Find_files binary.deb/archives/*.deb - then - for FILE in binary.deb/archives/*.deb - do - Install_file "${FILE}" "binary/pool" - done - fi - - if [ "${LB_DEBIAN_INSTALLER}" != "live" ] - then - # Including base debian packages - if ls cache/packages.bootstrap/*.deb > /dev/null 2>&1 - then - for FILE in cache/packages.bootstrap/*.deb - do - Install_file "${FILE}" "binary/pool" - done - else - Echo_error "Could not find packages in cache/packages.bootstrap." - Echo_error "You selected values of LB_CACHE, LB_CACHE_PACKAGES, LB_CACHE_STAGES and LB_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/packages.binary/*_"${LB_ARCHITECTURES}".deb || Find_files config/packages/*_"${LB_ARCHITECTURES}".deb - then - for FILE in config/packages.binary/*_"${LB_ARCHITECTURES}".deb config/packages/*_"${LB_ARCHITECTURES}".deb - do - if [ -e "${FILE}" ] - then - Install_file "${FILE}" "binary/pool" - fi - done - fi - - if Find_files config/packages.binary/*_all.deb || Find_files config/packages/*_all.deb - then - for FILE in config/packages.binary/*_all.deb config/packages/*_all.deb - do - if [ -e "${FILE}" ] - then - Install_file "${FILE}" "binary/pool" - fi - done - fi - - # Generating deb indices - for _ARCHIVE_AREA in $(cd binary/pool && ls) - do - mkdir -p binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES} - - mv binary chroot/root - echo "cd /root/binary && apt-ftparchive packages pool/${_ARCHIVE_AREA} > dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES}/Packages" > chroot/binary.sh - Chroot chroot "sh binary.sh" - rm -f chroot/binary.sh - mv chroot/root/binary ./ - - gzip -9 -c binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES}/Packages > binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES}/Packages.gz - - # Fetching release - Download_file binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/${_ARCHIVE_AREA}/binary-${LB_ARCHITECTURES}/Release "${LB_PARENT_MIRROR_CHROOT}"/dists/"${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}"/${_ARCHIVE_AREA}/binary-"${LB_ARCHITECTURES}"/Release - done - - # Symlink firmware packages to /firmware - if [ -n "${DI_FIRMWARE_PACKAGES}" ] - then - mkdir -p binary/firmware - cd binary/firmware - - for _PACKAGE in ${DI_FIRMWARE_PACKAGES} - do - for _FILE in $(find ../pool -name "${_PACKAGE}_*.deb") - do - ln -s ${_FILE} ./ - done - done - - cd "${OLDPWD}" - fi - - # Udeb handling - mkdir binary.udeb - cd binary.udeb - - # Downloading udeb indices - Download_file Packages.gz "${LB_PARENT_MIRROR_CHROOT}"/dists/"${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LB_ARCHITECTURES}"/Packages.gz - gunzip -c Packages.gz > Packages - - if [ "${LB_DERIVATIVE}" = "true" ] - then - Download_file Packages.derivative.gz "${LB_MIRROR_CHROOT}"/dists/"${LB_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LB_ARCHITECTURES}"/Packages.gz - gunzip -c Packages.derivative.gz > Packages.derivative - fi - - # Sorting udebs - if [ "${LB_DERIVATIVE}" = true ] - then - UDEBS="$(awk '/Filename: / { print $2 }' Packages.derivative)" - fi - - UDEBS="${UDEBS} $(awk '/Filename: / { print $2 }' Packages)" - - # Downloading udebs packages - Echo_message "Downloading udebs..." - - if [ "${LB_DERIVATIVE}" = "true" ] - then - Echo_message "Building in derivative mode in debian+ layout.. a lot of 404 errors are ok here." - fi - - for UDEB in ${UDEBS} - do - if [ -f ../cache/packages.binary_debian-installer.udeb/"$(basename ${UDEB})" ] - then - # Copying cached udebs - cp ../cache/packages.binary_debian-installer.udeb/"$(basename ${UDEB})" ./ - else - # Downloading udebs - if ! ls "$(basename ${UDEB} | awk -F_ '{ print $1 }')"_* > /dev/null 2>&1 - then - wget ${WGET_OPTIONS} "${LB_MIRROR_CHROOT}"/${UDEB} || wget ${WGET_OPTIONS} "${LB_PARENT_MIRROR_CHROOT}"/${UDEB} - fi - fi - done - - # Caching udebs - rm -rf ../cache/packages.binary_debian-installer.udeb - mkdir -p ../cache/packages.binary_debian-installer.udeb - cp *.udeb ../cache/packages.binary_debian-installer.udeb - - # Including local udebs - if Find_files ../config/packages.binary/*_"${LB_ARCHITECTURES}".udeb || Find_files ../config/packages/*_"${LB_ARCHITECTURES}".udeb - then - for FILE in ../config/packages.binary/*_"${LB_ARCHITECTURES}".udeb ../config/packages/*_"${LB_ARCHITECTURES}".udeb - do - if [ -e "${FILE}" ] - then - Install_file "${FILE}" "pool" - - # Prefer local udebs over downloaded udebs - rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb - fi - done - fi - - if Find_files ../config/packages.binary/*_all.udeb || Find_files ../config/packages/*_all.udeb - then - for FILE in ../config/packages.binary/*_all.udeb ../config/packages/*_all.udeb - do - if [ -e "${FILE}" ] - then - Install_file "${FILE}" "pool" - - # Prefer local udebs over downloaded udebs - rm -f "$(basename ${FILE} | awk -F_ '{ print $1 }')"_*.udeb - fi - done - fi - - # Excluding udebs - for LOCATION in "${LIVE_BUILD}/data/debian-cd" /usr/share/live/build/data/debian-cd - do - if [ -e "${LOCATION}" ] - then - grep -v "^#" "${LOCATION}/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/udeb_exclude" > exclude || true - grep -v "^#" "${LOCATION}/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/exclude-udebs" >> exclude || true - grep -v "^#" "${LOCATION}/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/exclude-udebs-${LB_ARCHITECTURES}" >> exclude || true - - continue - fi - done - - # 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 [ "${LB_DEBIAN_INSTALLER}" = "live" ] && [ "${EXCLUDE}" = "live-installer" ] - then - continue - fi - - rm -f ${EXCLUDE}_*.udeb - done < exclude - - # 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/"${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}"/main/debian-installer/binary-"${LB_ARCHITECTURES}" - cd "${OLDPWD}" - - mv binary.udeb chroot/root - echo "cd /root/binary.udeb && apt-ftparchive packages pool/main > dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LB_ARCHITECTURES}/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/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LB_ARCHITECTURES}/Packages > dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/main/debian-installer/binary-${LB_ARCHITECTURES}/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 - - eval _VERSION="$`echo RELEASE_${LB_PARENT_DISTRIBUTION}`" - - case "${LB_PARENT_DISTRIBUTION}" in - sid) - _SUITE="unstable" - ;; - - *) - _SUITE="${LB_PARENT_DISTRIBUTION}" - ;; - esac - -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="${_SUITE}" \ - -o APT::FTPArchive::Release::Version="${_VERSION}" \ - -o APT::FTPArchive::Release::Codename="${LB_PARENT_DISTRIBUTION}" \ - -o APT::FTPArchive::Release::Date="$(date -R)" \ - -o APT::FTPArchive::Release::Architectures="${LB_ARCHITECTURES}" \ - -o APT::FTPArchive::Release::Components="${LB_PARENT_ARCHIVE_AREAS}" \ - -o APT::FTPArchive::Release::Description="Last updated: $(date -R)" \ - release dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION} > dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/Release -EOF - - Chroot chroot "sh binary.sh" - rm -f chroot/binary.sh - mv chroot/root/binary ./ - - DISTRIBUTIONS="stable testing unstable" - - if [ "${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}" != "${LB_PARENT_DISTRIBUTION}" ] - then - DISTRIBUTIONS="${DISTRIBUTIONS} ${LB_PARENT_DISTRIBUTION}" - fi - - case "${LB_BINARY_IMAGES}" in - hdd) - case "${LB_BINARY_FILESYSTEM}" in - fat*|ntfs) - # Creating dist directories - for DISTRIBUTION in ${DISTRIBUTIONS} - do - cp -a binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION} binary/dists/${DISTRIBUTION} - done - ;; - esac - ;; - - *) - # Creating dist symlinks - for DISTRIBUTION in ${DISTRIBUTIONS} - do - ln -s ${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION} binary/dists/${DISTRIBUTION} - done - - ln -s . binary/debian - ;; - esac - - # 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/includes.binary_debian-installer if exists and not empty -if [ -d config/includes.binary_debian-installer ] && [ -n "$(ls -A config/includes.binary_debian-installer)" ] -then - Repack_initrd "${DESTDIR}"/"${INITRD_DI}" config/includes.binary_debian-installer - - if [ -e "${DESTDIR}"/"${INITRD_GI}" ] - then - Repack_initrd "${DESTDIR}"/"${INITRD_GI}" config/includes.binary_debian-installer - fi -fi - -# Saving cache -Save_cache cache/packages.binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .build/binary_debian-installer diff --git a/scripts/build/lb_binary_disk b/scripts/build/lb_binary_disk deleted file mode 100755 index e8e5c0ddc..000000000 --- a/scripts/build/lb_binary_disk +++ /dev/null @@ -1,203 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 "${LB_BINARY_IMAGES}" in - iso*|hdd*) - ;; - *) - exit 0 - ;; -esac - -Echo_message "Begin installing disk information..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_disk - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -mkdir -p binary/.disk - -ARCHITECTURE="$(echo ${LB_ARCHITECTURES} | sed -e 's| |/|g')" -DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')" -DISTRIBUTION="${DISTRIBUTION}$(echo ${LB_DISTRIBUTION} | cut -b 2-)" -eval VERSION="$`echo RELEASE_${LB_DISTRIBUTION}`" - -case "${LB_MODE}" in - debian) - TITLE="Debian GNU/Linux" - STRING="Official Snapshot ${ARCHITECTURE}" - TRACE="project/trace/ftp-master.debian.org" - ;; - - ubuntu) - TITLE="Ubuntu" - STRING="Build ${ARCHITECTURE}" - TRACE="" - ;; - - kubuntu) - TITLE="Kubuntu" - STRING="Build ${ARCHITECTURE}" - TRACE="" - ;; - - progress) - TITLE="Progress Linux" - STRING="${VERSION} (${DISTRIBUTION}) - ${ARCHITECTURE}" - TRACE="project/trace/archive-master.progress-linux.org" - ;; - - *) - TITLE="Debian GNU/Linux" - STRING="Snapshot ${ARCHITECTURE}" - TRACE="" - ;; -esac - -if [ -n "${TRACE}" ] -then - echo "$(wget -q ${LB_PARENT_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \ - > binary/.disk/archive_trace -fi - -case "${LB_INITRAMFS}" in - casper) - for INITRD in binary/casper/initrd.img* - do - mkdir -p binary/uuid - cd binary/uuid - - case "${LB_INITRAMFS_COMPRESSION}" in - gzip) - zcat "../../${INITRD}" | cpio --quiet -id conf/uuid.conf - ;; - - bzip2) - bzcat "../../${INITRD}" | cpio --quiet -id conf/uuid.conf - ;; - - lzma) - lzcat -S "" "../../${INITRD}" | cpio --quiet -id conf/uuid.conf - ;; - esac - - if [ -e conf/uuid.conf ] - then - mv conf/uuid.conf "../.disk/casper-uuid${INITRD#binary/casper/initrd.img}" - else - Echo_warning "Failed to find casper uuid.conf in '${INITRD}'" - fi - - cd ${OLDPWD} - rm -rf binary/uuid - done - ;; -esac - -case "${LB_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 - - for LOCATION in "${LIVE_BUILD}/data/debian-cd" /usr/share/live/build/data/debian-cd - do - if [ -e "${LOCATION}" ] - then - cp "${LOCATION}/${LB_PARENT_DISTRIBUTION}/${LB_ARCHITECTURES}_udeb_include" binary/.disk/udeb_include - - continue - fi - done - ;; - - true|netinst|live) - echo "main" > binary/.disk/base_components - - touch binary/.disk/base_installable - - if [ "${LB_DEBIAN_INSTALLER}" = "live" ] - then - echo "live" > binary/.disk/cd_type - echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/INSTALL Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info - else - echo "not_complete" > binary/.disk/cd_type - echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE/NETINST Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info - fi - - for LOCATION in "${LIVE_BUILD}/data/debian-cd" /usr/share/live/build/data/debian-cd - do - if [ -e "${LOCATION}" ] - then - cp "${LOCATION}/${LB_PARENT_DISTRIBUTION}/${LB_ARCHITECTURES}_netinst_udeb_include" binary/.disk/udeb_include - - continue - fi - done - - if [ "${LB_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 - - for LOCATION in "${LIVE_BUILD}/data/debian-cd" /usr/share/live/build/data/debian-cd - do - if [ -e "${LOCATION}" ] - then - cp "${LOCATION}/${LB_PARENT_DISTRIBUTION}/${LB_ARCHITECTURES}_businesscard_udeb_include" binary/.disk/udeb_include - - continue - fi - done - ;; - - false) - echo "${TITLE} ${VERSION} \"${DISTRIBUTION}\" - ${STRING} LIVE Binary $(date +%Y%m%d-%H:%M)" > binary/.disk/info - ;; -esac - -# Creating stage file -Create_stagefile .build/binary_disk diff --git a/scripts/build/lb_binary_grub b/scripts/build/lb_binary_grub deleted file mode 100755 index 1dd1201e7..000000000 --- a/scripts/build/lb_binary_grub +++ /dev/null @@ -1,309 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTLOADER}" != "grub" ] -then - exit 0 -fi - -Echo_message "Begin installing grub..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_grub - -# Checking grub templates -Check_templates grub - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Check architecture -Check_architectures amd64 i386 -Check_crossarchitectures - -# Checking depends -Check_package chroot/usr/sbin/grub grub-legacy - -# 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} ${INITFS:+boot=${INITFS} }config LB_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} ${LB_BOOTAPPEND_INSTALL}" - LINUX_INSTALL="${LINUX_INSTALL}\ninitrd\t\t/${INITRD}" - done -} - -case "${LB_INITRAMFS}" in - casper) - INITFS="casper" - ;; - - live-boot) - INITFS="live" - ;; - - *) - INITFS="" - ;; -esac - -# Setting destination directory -case "${LB_BINARY_IMAGES}" in - iso*|tar) - case "${LB_INITRAMFS}" in - casper) - DESTDIR_LIVE="binary/casper" - ;; - - live-boot) - DESTDIR_LIVE="binary/live" - ;; - - *) - DESTDIR_LIVE="binary/boot" - ;; - esac - - DESTDIR_INSTALL="binary/install" - ;; - - hdd*|netboot) - Echo_warning "Bootloader in this image type not yet supported by live-build." - Echo_warning "This would produce a not bootable image, aborting (FIXME)." - exit 1 - ;; -esac - -Check_multiarchitectures - -# Creating directory -mkdir -p "${DESTDIR_LIVE}" - -# Setting boot parameters -if [ "${LB_UNION_FILESYSTEM}" != "aufs" ] -then - LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} union=${LB_UNION_FILESYSTEM}" -fi - -if [ -n "${LB_NET_COW_PATH}" ] -then - Echo_error "Net cow not yet supported on grub" - exit 1 -fi - -if [ "${LB_EXPOSED_ROOT}" != "false" ] -then - LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} exposedroot" -fi - -LB_BOOTAPPEND_LIVE="$(echo ${LB_BOOTAPPEND_LIVE} | sed -e 's| ||')" - -# Assembling kernel configuration - -# Default entries -DEFAULT_FLAVOUR="$(echo ${LB_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}" - -if [ "${LB_BOOTAPPEND_FAILSAFE}" != "none" ] -then - Grub_live_entry "live (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" "${LB_BOOTAPPEND_FAILSAFE}" -fi - -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}" "${LB_BOOTAPPEND_FAILSAFE}" -done - -LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" - -# Assembling debian-installer configuration -if [ "${LB_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/${VMLINUZ_DI}" ] && [ -f "binary/${INITRD_DI}" ] - then - Grub_install_entry "Text" "${VMLINUZ_DI}" "${INITRD_DI}" "${APPEND_DI}" - fi - - if [ -f "binary/${VMLINUZ_GI}" ] && [ -f "binary/${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${LB_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 ${LB_BINARY_IMAGES} in - iso*) - FILES="chroot/usr/lib/grub/*/stage2_eltorito" - ;; - - hdd*|tar) - FILES="chroot/usr/lib/grub/*/stage1 chroot/usr/lib/grub/*/e2fs_stage1_5 chroot/usr/lib/grub/*/stage2" - ;; -esac - -if [ "${LB_BUILD_WITH_CHROOT}" = "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 - LB_GRUB_SPLASH="config/binary_grub/splash.xpm.gz" -elif [ -f config/binary_grub/splash.xpm ] -then - LB_GRUB_SPLASH="config/binary_grub/splash.xpm" -fi - -if [ -n "${LB_GRUB_SPLASH}" ] -then - if [ "${LB_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 "${LB_GRUB_SPLASH}" binary/boot/grub - sed -i -e "s|splashimage.*|splashimage /boot/grub/$(basename ${LB_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|LB_BOOTAPPEND_INSTALL|${LB_BOOTAPPEND_INSTALL}|" -e "s|LB_BOOTAPPEND_LIVE|${LB_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 .build/binary_grub diff --git a/scripts/build/lb_binary_grub2 b/scripts/build/lb_binary_grub2 deleted file mode 100755 index 738f28006..000000000 --- a/scripts/build/lb_binary_grub2 +++ /dev/null @@ -1,279 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTLOADER}" != "grub2" ] -then - exit 0 -fi - -Echo_message "Begin installing grub2..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_grub - -# Checking grub2 templates -Check_templates grub2 - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Check architecture -Check_architectures amd64 i386 -Check_crossarchitectures - -# 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} ${INITFS:+boot=${INITFS} }config LB_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} LB_BOOTAPPEND_INSTALL" - LINUX_INSTALL="${LINUX_INSTALL}\ninitrd\t\t/${INITRD}" - LINUX_INSTALL="${LINUX_INSTALL}\n}" -} - -case "${LB_INITRAMFS}" in - casper) - INITFS="casper" - ;; - - live-boot) - INITFS="live" - ;; - - *) - INITFS="" - ;; -esac - -# Setting destination directory -case "${LB_BINARY_IMAGES}" in - iso*|tar) - case "${LB_INITRAMFS}" in - casper) - DESTDIR_LIVE="binary/casper" - ;; - - live-boot) - DESTDIR_LIVE="binary/live" - ;; - - *) - DESTDIR_LIVE="binary/live" - ;; - esac - - DESTDIR_INSTALL="binary/install" - ;; - - hdd*|netboot) - Echo_warning "Bootloader in this image type not yet supported by live-build." - Echo_warning "This would produce a not bootable image, aborting (FIXME)." - exit 1 - ;; -esac - -Check_multiarchitectures - -# Creating directory -mkdir -p "${DESTDIR_LIVE}" - -# Setting boot parameters -if [ "${LB_UNION_FILESYSTEM}" != "aufs" ] -then - LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} union=${LB_UNION_FILESYSTEM}" -fi - -if [ -n "${LB_NET_COW_PATH}" ] -then - Echo_error "Net cow not yet supported on grub" - exit 1 -fi - -if [ "${LB_EXPOSED_ROOT}" != "false" ] -then - LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} exposedroot" -fi - -LB_BOOTAPPEND_LIVE="$(echo ${LB_BOOTAPPEND_LIVE} | sed -e 's| ||')" - -# Assembling kernel configuration - -# Default entries -DEFAULT_FLAVOUR="$(echo ${LB_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}" - -if [ "${LB_BOOTAPPEND_FAILSAFE}" != "none" ] -then - Grub_live_entry "live (fail-safe mode)" "$(basename ${DESTDIR_LIVE})/${DEFAULT_KERNEL}" "$(basename ${DESTDIR_LIVE})/${DEFAULT_INITRD}" "${LB_BOOTAPPEND_FAILSAFE}" -fi - -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}" "${LB_BOOTAPPEND_FAILSAFE}" -done - -LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" - -# Assembling debian-installer configuration -if [ "${LB_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\"${LB_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 ${LB_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" - ;; - - hdd*|tar) - FILES="chroot/usr/lib/grub/i386-pc/*" - ;; -esac - -if [ "${LB_BUILD_WITH_CHROOT}" = "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 - LB_GRUB_SPLASH="config/binary_grub/splash.tga" -fi - -if [ -n "${LB_GRUB_SPLASH}" ] -then - if [ "${LB_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 "${LB_GRUB_SPLASH}" binary/boot/grub - sed -i -e "s|background_image .*.tga|background_image \$\(root\)/boot/grub/$(basename ${LB_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|LB_BOOTAPPEND_INSTALL|${LB_BOOTAPPEND_INSTALL}|" -e "s|LB_BOOTAPPEND_LIVE|${LB_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 .build/binary_grub diff --git a/scripts/build/lb_binary_hdd b/scripts/build/lb_binary_hdd deleted file mode 100755 index 4dd515fee..000000000 --- a/scripts/build/lb_binary_hdd +++ /dev/null @@ -1,314 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 hdd "${LB_BINARY_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building binary hdd image..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap .build/chroot_proc - -# Checking stage file -Check_stagefile .build/binary_hdd - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Checking depends -case "${LB_BINARY_FILESYSTEM}" in - fat*) - Check_package chroot/sbin/mkdosfs dosfstools - ;; - - ntfs) - case "${LB_PARENT_DISTRIBUTION}" in - squeeze) - Check_package chroot/sbin/mkfs.ntfs ntfsprogs - ;; - - *) - Check_package chroot/sbin/mkfs.nfts ntfs-3g - ;; - esac - ;; -esac - -Check_package chroot/usr/share/doc/mtools mtools -Check_package chroot/sbin/parted parted - -if [ "${LB_ARCHITECTURES}" = "sparc" ] -then - case "${LB_BINARY_FILESYSTEM}" in - ext2|ext3|ext4) - Check_package chroot/sbin/mkfs.${LB_BINARY_FILESYSTEM} e2fsprogs - ;; - - *) - Echo_error "Sparc only supports booting from ext2, ext3, ext4 or ufs." - exit 1 - ;; - esac -fi - -case "${LB_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 [ "${LB_BINARY_FILESYSTEM}" = "fat16" ] && [ -n "$(find binary -size +1999M)" ] -then - Echo_warning "FAT16 doesn't support files larger than 2GB, automatically enforcing FAT32." - - LB_BINARY_FILESYSTEM="fat32" - export LB_BINARY_FILESYSTEM -fi - -# Enforce fat32 if we have images in total bigger than 2GB -if [ "${LB_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" - - LB_BINARY_FILESYSTEM="fat32" - export LB_BINARY_FILESYSTEM -fi - -# Enforce ntfs if we find individual files bigger than 4GB -if [ "${LB_BINARY_FILESYSTEM}" = "fat32" ] && [ -n "$(find binary -size +3999M)" ] -then - Echo_warning "FAT32 doesn't support files larger than 4GB, automatically enforcing NTFS." - - LB_BINARY_FILESYSTEM="ntfs" - export LB_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} ${LB_BINARY_FILESYSTEM})" -dd if=/dev/zero of=chroot/binary.img bs=1024k count=0 seek=${REAL_DIM} -FREELO="$(${LB_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 "${LB_ARCHITECTURES}" in - sparc) - PARTITION_TABLE_TYPE="sun" - ;; - *) - PARTITION_TABLE_TYPE="msdos" - ;; -esac - -case "${LB_BINARY_FILESYSTEM}" in - ext2|ext3|ext4) - PARTITION_TYPE="ext2" - ;; - - fat16|fat32) - PARTITION_TYPE="${LB_BINARY_FILESYSTEM}" - ;; - - ntfs) - PARTITION_TYPE="NTFS" - ;; - - *) - Echo_error "Unsupported binary filesystem %s" "${LB_BINARY_FILESYSTEM}" - exit 1 - ;; -esac - -case "${LB_BUILD_WITH_CHROOT}" 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 [ "${LB_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 [ "${LB_BOOTLOADER}" = "syslinux" ] - then - dd if=/usr/lib/syslinux/mbr.bin of=${FREELO} bs=440 count=1 - fi - ;; -esac - -Lodetach ${FREELO} - -FREELO="$(${LB_LOSETUP} -f)" -Losetup $FREELO chroot/binary.img 1 - -case "${LB_BINARY_FILESYSTEM}" in - ext2|ext3|ext4) - MKFS="${LB_BINARY_FILESYSTEM}" - MKFS_OPTIONS="-L ${LB_HDD_LABEL} -m 0" - ;; - - fat16) - MKFS="vfat" - MKFS_OPTIONS="-F 16 -n ${LB_HDD_LABEL}" - ;; - - fat32) - MKFS="vfat" - MKFS_OPTIONS="-F 32 -n ${LB_HDD_LABEL}" - ;; - - ntfs) - MKFS="ntfs" - MKFS_OPTIONS="-L ${LB_HDD_LABEL}" - ;; -esac - -case "${LB_BUILD_WITH_CHROOT}" in - true) - Chroot chroot "mkfs.${MKFS} ${MKFS_OPTIONS} ${FREELO}" - ;; - - false) - mkfs.${MKFS} ${MKFS_OPTIONS} ${FREELO} - ;; -esac - -case "${LB_BINARY_FILESYSTEM}" in - fat*) - CP_OPTIONS="-L" - ;; -esac - -mkdir -p chroot/binary.tmp -${LB_ROOT_COMMAND} mount ${FREELO} chroot/binary.tmp -cp -r -T ${CP_OPTIONS} binary/ chroot/binary.tmp - -FIXME() -{ -if [ "${LB_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')" - hdddev="$(echo $rootpartition | sed -e 's|,[[:digit:]]||')" - echo "Root partition is $rootpartition, device is: $hdddev" - - echo "WAITING..." && read WAIT - -#cat > chroot/grub.sh << EOF -#grub --batch << EOM -#root $rootpartition -#setup $hdddev -#EOM -#EOF - -#Chroot chroot "sh grub.sh" - - rm -f chroot/grub.sh -fi -} - -${LB_ROOT_COMMAND} umount chroot/binary.tmp -rmdir chroot/binary.tmp - -if [ "${LB_BOOTLOADER}" = "syslinux" ] -then - case "${LB_BUILD_WITH_CHROOT}" in - true) - Chroot chroot "syslinux ${FREELO}" - ;; - - false) - syslinux ${FREELO} - ;; - esac -fi - -Lodetach ${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 .build/binary_hdd diff --git a/scripts/build/lb_binary_hooks b/scripts/build/lb_binary_hooks deleted file mode 100755 index cd1270be5..000000000 --- a/scripts/build/lb_binary_hooks +++ /dev/null @@ -1,78 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'execute 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 hooks..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_hooks - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -## Processing distribution hooks - -# Running hooks -for _HOOK in ${LB_BINARY_HOOKS} -do - for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks - do - for FILE in "${LOCATION}"/???-"${_HOOK}".binary - do - if [ -e "${FILE}" ] - then - cd binary - ./"${FILE}" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;} - cd "${OLDPWD}" - fi - done - done -done - -## Processing local hooks - -if Find_files config/hooks/*.binary -then - for HOOK in config/hooks/*.binary - 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 .build/binary_hooks -fi diff --git a/scripts/build/lb_binary_includes b/scripts/build/lb_binary_includes deleted file mode 100755 index f1f345a95..000000000 --- a/scripts/build/lb_binary_includes +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 includes..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/includes.binary - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if Find_files config/includes.binary/ -then - # Copying includes - cd config/includes.binary - find . | cpio -dmpu --no-preserve-owner "${OLDPWD}"/binary - cd "${OLDPWD}" - - # Removing symlinks - case "${LB_BINARY_IMAGES}" in - hdd*) - find binary -type l | xargs rm -f - ;; - esac - - # Creating stage file - Create_stagefile .build/binary_includes -fi diff --git a/scripts/build/lb_binary_iso b/scripts/build/lb_binary_iso deleted file mode 100755 index c25674bbb..000000000 --- a/scripts/build/lb_binary_iso +++ /dev/null @@ -1,235 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 - -case "${LB_BINARY_IMAGES}" in - iso) - IMAGE="binary.iso" - ;; - - iso-hybrid) - IMAGE="binary.hybrid.iso" - ;; - - *) - exit 0 - ;; -esac - -Echo_message "Begin building binary iso image..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_iso - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Checking depends -Check_package chroot/usr/bin/genisoimage genisoimage - -if [ "${LB_BINARY_IMAGES}" = "iso-hybrid" ] -then - Check_package chroot/usr/bin/isohybrid syslinux -fi - -# Restoring cache -Restore_cache cache/packages.binary - -# Installing depends -Install_package - -# Remove old iso image -if [ -f ${IMAGE} ] -then - rm -f ${IMAGE} -fi - -# Handle genisoimage generic options -GENISOIMAGE_OPTIONS="-J -l -cache-inodes -allow-multidot" - -# Handle genisoimage live-build specific options -if [ "${_QUIET}" = "true" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -quiet" -fi - -if [ "${_VERBOSE}" = "true" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v" -fi - -if [ -n "${LB_ISO_APPLICATION}" ] && [ "${LB_ISO_APPLICATION}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LB_ISO_APPLICATION}\"" -fi - -if [ -n "${LB_ISO_PREPARER}" ] && [ "${LB_ISO_PREPARER}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LB_ISO_PREPARER}\"" -fi - -if [ -n "${LB_ISO_PUBLISHER}" ] && [ "${LB_ISO_PUBLISHER}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LB_ISO_PUBLISHER}\"" -fi - -if [ -n "${LB_ISO_VOLUME}" ] && [ "${LB_ISO_VOLUME}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LB_ISO_VOLUME}\"" -fi - -# Handle genisoimage architecture specific options -case "${LB_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" - case "${LB_MODE}" in - progress) - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b boot/boot.bin -c boot/boot.cat" - GENISOIMAGE_EXCLUDE="boot/boot.bin" - ;; - - *) - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b isolinux/isolinux.bin -c isolinux/boot.cat" - GENISOIMAGE_EXCLUDE="isolinux/isolinux.bin" - ;; - esac - ;; - - 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-build." - Echo_warning "This will produce a most likely not bootable image (Continuing in 5 seconds)." - sleep 5 - ;; -esac - -#if [ "${LB_DEBIAN_INSTALLER}" != "live" ] -#then -# GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m ${GENISOIMAGE_EXCLUDE}" -#fi - -if [ "${LB_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} -O i386-pc 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 ${IMAGE} binary -EOF - -if [ "${LB_BINARY_IMAGES}" = "iso-hybrid" ] -then - -cat >> binary.sh << EOF - -isohybrid ${ISOHYBRID_OPTIONS} ${IMAGE} -EOF - -fi - -case "${LB_BUILD_WITH_CHROOT}" in - true) - # Moving image - mv binary.sh chroot - mv binary chroot - - Chroot chroot "sh binary.sh" - - # Move image - mv chroot/binary chroot/${IMAGE} ./ - 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 .build/binary_iso diff --git a/scripts/build/lb_binary_linux-image b/scripts/build/lb_binary_linux-image deleted file mode 100755 index 94afac8f9..000000000 --- a/scripts/build/lb_binary_linux-image +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ] || [ "${LB_LINUX_PACKAGES}" = "none" ] -then - exit 0 -fi - -Echo_message "Begin install linux-image..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_linux-image - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -case "${LB_INITRAMFS}" in - casper) - DESTDIR="binary/casper" - ;; - - live-boot) - DESTDIR="binary/live" - ;; - - *) - DESTDIR="binary/boot" - ;; -esac - -case "${LB_ARCHITECTURES}" in - powerpc) - LINUX="vmlinux" - ;; - - *) - LINUX="vmlinuz" - ;; -esac - -Check_multiarchitectures - -# Creating directory -mkdir -p "${DESTDIR}" - -# Installing linux-image -if [ "${LB_LINUX_PACKAGES}" != "none" ] -then - cp chroot/boot/"${LINUX}"-* "${DESTDIR}" - cp chroot/boot/initrd.img-* "${DESTDIR}" -fi - -case "${LB_INITRAMFS}" in - live-boot) - if [ -e chroot/usr/share/doc/live-boot/parameters.txt ] - then - cp chroot/usr/share/doc/live-boot/parameters.txt "${DESTDIR}"/parameters - fi - ;; -esac - -# Creating stage file -Create_stagefile .build/binary_linux-image diff --git a/scripts/build/lb_binary_manifest b/scripts/build/lb_binary_manifest deleted file mode 100755 index b62a43754..000000000 --- a/scripts/build/lb_binary_manifest +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ] -then - exit 0 -fi - -Echo_message "Begin creating manifest..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_manifest - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -case "${LB_INITRAMFS}" in - casper) - INITFS="casper" - SUFFIX="manifest" - ;; - - live-boot) - INITFS="live" - SUFFIX="packages" - ;; - - *) - INITFS="boot" - SUFFIX="packages" - ;; -esac - -# Add filesystem.packages -cp chroot.packages.live "binary/${INITFS}/filesystem.${SUFFIX}" -echo "$(diff chroot.packages.live chroot.packages.install | awk '/^< / { print $2 }')" \ - > "binary/${INITFS}/filesystem.${SUFFIX}-remove" - -cp chroot.packages.live binary.packages - -# Creating stage file -Create_stagefile .build/binary_manifest diff --git a/scripts/build/lb_binary_memtest b/scripts/build/lb_binary_memtest deleted file mode 100755 index d96c778d2..000000000 --- a/scripts/build/lb_binary_memtest +++ /dev/null @@ -1,124 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ] || [ "${LB_MEMTEST}" = "false" ] || [ "${LB_MEMTEST}" = "none" ] -then - exit 0 -fi - -Echo_message "Begin installing memtest..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_memtest - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ "${LB_ARCHITECTURES}" != "amd64" ] && [ "${LB_ARCHITECTURES}" != "i386" ] -then - Echo_warning "skipping binary_memtest, foreign architecture." - exit 0 -fi - -if [ "${LB_BUILD_WITH_CHROOT}" = "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 "${LB_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 "${LB_INITRAMFS}" in - casper) - DESTDIR="binary/casper" - ;; - - live-boot) - DESTDIR="binary/live" - ;; - - *) - DESTDIR="binary/boot" - ;; -esac - -Check_multiarchitectures - -# Creating directory -mkdir -p "${DESTDIR}" - -# Installing memtest -case "${LB_BUILD_WITH_CHROOT}" in - true) - cp chroot/boot/${LB_MEMTEST}.bin "${DESTDIR}"/memtest - ;; - - false) - cp /boot/${LB_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 .build/binary_memtest diff --git a/scripts/build/lb_binary_netboot b/scripts/build/lb_binary_netboot deleted file mode 100755 index 08cc9d308..000000000 --- a/scripts/build/lb_binary_netboot +++ /dev/null @@ -1,183 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 netboot "${LB_BINARY_IMAGES}" -then - exit 0 -fi - -if [ "${LB_NET_TARBALL}" = "false" ] -then - exit 0 -fi - -Echo_message "Begin building binary netboot image..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_netboot - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ "${LB_ARCHITECTURES}" = "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 "${LB_INITRAMFS}" in - casper) - ORIGDIR="binary/casper" - ;; - - live-boot) - ORIGDIR="binary/live" - ;; - - *) - ORIGDIR="binary/boot" - ;; - esac - - # Find defaults - DEFAULT_FLAVOUR="$(echo ${LB_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.netboot.tar binary.netboot.tar.gz binary.netboot.tar.bz2 binary.netboot.tar.xz binary.netboot.tar.xz - -# Creating image file -ROOT_DIR=$(basename ${LB_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 - -# Moving kernel and initrd image arround -mkdir tftpboot/live -mv */live/vmlinuz* */live/initrd* tftpboot/live - -tar cf ../binary.netboot.tar * - -case "${LB_COMPRESSION}" in - bzip2) - bzip2 ${BZIP2_OPTIONS} ../binary.netboot.tar - ;; - - gzip) - gzip ${GZIP_OPTIONS} ../binary.netboot.tar - ;; - - lzip) - lzip ${LZIP_OPTIONS} ../binary.netboot.tar - ;; - - xz) - xz ${XZ_OPTIONS} ../binary.netboot.tar - ;; - - none) - ;; -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 .build/binary_netboot diff --git a/scripts/build/lb_binary_package-lists b/scripts/build/lb_binary_package-lists deleted file mode 100755 index 86716785d..000000000 --- a/scripts/build/lb_binary_package-lists +++ /dev/null @@ -1,144 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 package lists..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_package-lists - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if ls config/package-lists/*.list > /dev/null 2>&1 || \ - ls config/package-lists/*.list.binary > /dev/null 2>&1 -then - # Restoring cache - Restore_cache cache/packages.chroot - - # Check depends - Check_package chroot/usr/bin/apt-ftparchive apt-utils - Check_package chroot/usr/bin/grep-aptavail dctrl-tools - - # Installing depends - Install_package - - if [ -e "${LIVE_BUILD}/share/bin/Packages" ] - then - cp "${LIVE_BUILD}/share/bin/Packages" chroot/bin - else - cp /usr/share/live/build/bin/Packages chroot/bin - fi - - 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 LIST in config/package-lists/*.list \ - config/package-lists/*.list.binary - do - if [ -e "${LIST}" ] - then - # Generate package list - Expand_packagelist "${LIST}" "config/package-lists" > chroot/root/"$(basename ${LIST})" - - # Downloading additional packages - Chroot chroot "xargs --arg-file=/root/$(basename ${LIST}) apt-get ${APT_OPTIONS} -o Dir::Cache=/binary.deb --download-only install" - - # Remove package list - rm chroot/root/"$(basename ${LIST})" - fi - done - - for FILE in chroot/binary.deb/archives/*.deb - do - SOURCE="$(dpkg -f ${FILE} Source | awk '{ print $1 }')" - SECTION="$(dpkg -f ${FILE} Section | 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 - - if echo "${SECTION}" | grep -qs contrib - then - SECTION="contrib" - elif echo "${SECTION}" | grep -qs non-free - then - SECTION="non-free" - else - SECTION="main" - fi - - # Install directory - mkdir -p binary/pool/${SECTION}/"${LETTER}"/"${SOURCE}" - - # Move files - mv "${FILE}" binary/pool/${SECTION}/"${LETTER}"/"${SOURCE}" - done - - cd binary - - for SECTION in pool/* - do - SECTION="$(basename ${SECTION})" - - mkdir -p dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES} - apt-ftparchive packages pool/${SECTION} > dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages - gzip -9 -c dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages > dists/${LB_PARENT_DISTRIBUTION}/${SECTION}/binary-${LB_ARCHITECTURES}/Packages.gz - done - - cd "${OLDPWD}" - - rm -f chroot/bin/Packages - - 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 .build/binary_package-lists -fi diff --git a/scripts/build/lb_binary_rootfs b/scripts/build/lb_binary_rootfs deleted file mode 100755 index 6704b524a..000000000 --- a/scripts/build/lb_binary_rootfs +++ /dev/null @@ -1,508 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap .build/binary_chroot - -# Checking stage file -Check_stagefile .build/binary_rootfs - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -case "${LB_ARCHITECTURES}" in - amd64|i386) - LINUX="vmlinuz" - ;; - - powerpc) - LINUX="vmlinux" - ;; -esac - -case "${LB_INITRAMFS}" in - casper) - INITFS="casper" - ;; - - live-boot) - INITFS="live" - ;; - - *) - INITFS="boot" - ;; -esac - -# Creating directory -mkdir -p binary/${INITFS} - -for STAGE in ${LB_CACHE_STAGES} -do - if [ "${STAGE}" = "rootfs" ] && [ -d cache/binary_rootfs ] - then - # Removing old chroot - rm -rf binary/"${INITFS}"/filesystem.* - - # Restoring old cache - mkdir -p binary/"${INITFS}" - ${LB_ROOT_COMMAND} cp -a cache/binary_rootfs/filesystem.* binary/"${INITFS}" - - if [ -n "${LB_ROOT_COMMAND}" ] - then - ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) binary - fi - - # Creating stage file - Create_stagefile .build/binary_rootfs - exit 0 - fi -done - -case "${LB_CHROOT_FILESYSTEM}" in - ext2|ext3|ext4) - # Checking depends - Check_package chroot/sbin/mkfs.${LB_CHROOT_FILESYSTEM} e2fsprogs - - # Restoring cache - Restore_cache cache/packages.binary - - # Installing depends - Install_package - - # Remove old image - if [ -f binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} ] - then - rm -f binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} - fi - - case "${LB_BUILD_WITH_CHROOT}" in - true) - DU_DIM="$(du -ms chroot/chroot | cut -f1)" - INODES="$(find chroot/chroot | wc -l)" - ;; - - false) - DU_DIM="$(du -ms chroot | cut -f1)" - INODES="$(find chroot | wc -l)" - ;; - esac - - REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LB_CHROOT_FILESYSTEM})" - REAL_INODES="$(Calculate_partition_size ${INODES} ${LB_CHROOT_FILESYSTEM})" - - case "${LB_BUILD_WITH_CHROOT}" in - true) - dd if=/dev/zero of=chroot/filesystem.${LB_CHROOT_FILESYSTEM} bs=1024k count=0 seek=${REAL_DIM} - - if ! Chroot chroot "test -s /etc/mtab" - then - Chroot chroot "ln -s /proc/mounts/mtab /etc/mtab" - FAKE_MTAB="true" - fi - - Chroot chroot "mkfs.${LB_CHROOT_FILESYSTEM} -F -b 1024 -N ${REAL_INODES} -m 0 filesystem.${LB_CHROOT_FILESYSTEM}" - - mkdir -p filesystem.tmp - ${LB_ROOT_COMMAND} mount -o loop chroot/filesystem.${LB_CHROOT_FILESYSTEM} filesystem.tmp - cp -a chroot/chroot/* filesystem.tmp - - if [ "${FAKE_MTAB}" = "true" ] - then - Chroot chroot "rm -f /etc/mtab" - fi - - ${LB_ROOT_COMMAND} umount filesystem.tmp - rmdir filesystem.tmp - - # Move image - mv chroot/filesystem.${LB_CHROOT_FILESYSTEM} binary/${INITFS} - - case "${LB_MODE}" in - ubuntu|kubuntu) - du -B 1 -s chroot/chroot | cut -f1 > binary/${INITFS}/filesystem.size - ;; - esac - - if [ -e chroot/chroot.cache ] - then - rm -f .lock - mv chroot/chroot chroot.tmp - - lb chroot_archives binary remove ${@} - lb chroot_apt remove ${@} - lb chroot_hostname remove ${@} - lb chroot_resolv remove ${@} - lb chroot_hosts remove ${@} - lb chroot_sysv-rc remove ${@} - lb chroot_upstart remove ${@} - lb chroot_dpkg remove ${@} - lb chroot_debianchroot remove ${@} - lb chroot_sysfs remove ${@} - lb chroot_selinuxfs remove ${@} - lb chroot_proc remove ${@} - lb chroot_devpts remove ${@} - - rm -rf chroot - mv chroot.tmp chroot - - lb chroot_devpts install ${@} - lb chroot_proc install ${@} - lb chroot_selinuxfs install ${@} - lb chroot_sysfs install ${@} - lb chroot_debianchroot install ${@} - lb chroot_dpkg install ${@} - lb chroot_sysv-rc install ${@} - lb chroot_upstart install ${@} - lb chroot_hosts install ${@} - lb chroot_resolv install ${@} - lb chroot_hostname install ${@} - lb chroot_apt install ${@} - lb chroot_archives binary install ${@} - - touch .lock - else - rm -rf chroot/chroot - - # Removing depends - Remove_package - fi - ;; - - false) - dd if=/dev/zero of=binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} bs=1024k count=0 seek=${REAL_DIM} - mkfs.${LB_CHROOT_FILESYSTEM} -F -b 1024 -N ${REAL_INODES} -m 0 binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} - - mkdir -p filesystem.tmp - ${LB_ROOT_COMMAND} mount -o loop binary/${INITFS}/filesystem.${LB_CHROOT_FILESYSTEM} filesystem.tmp - cp -a chroot/* filesystem.tmp - - ${LB_ROOT_COMMAND} umount filesystem.tmp - rmdir filesystem.tmp - ;; - esac - - # Saving cache - Save_cache cache/packages.binary - ;; - - 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 "${LB_JFFS2_ERASEBLOCK}" ] - then - JFFS2_OPTIONS="--eraseblock=${LB_JFFS2_ERASEBLOCK}" - fi - - case "${LB_BUILD_WITH_CHROOT}" 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 - - lb chroot_archives binary remove ${@} - lb chroot_apt remove ${@} - lb chroot_hostname remove ${@} - lb chroot_resolv remove ${@} - lb chroot_hosts remove ${@} - lb chroot_sysv-rc remove ${@} - lb chroot_upstart remove ${@} - lb chroot_dpkg remove ${@} - lb chroot_debianchroot remove ${@} - lb chroot_sysfs remove ${@} - lb chroot_selinuxfs remove ${@} - lb chroot_proc remove ${@} - lb chroot_devpts remove ${@} - - rm -rf chroot - mv chroot.tmp chroot - - lb chroot_devpts install ${@} - lb chroot_proc install ${@} - lb chroot_selinuxfs install ${@} - lb chroot_sysfs install ${@} - lb chroot_debianchroot install ${@} - lb chroot_dpkg install ${@} - lb chroot_sysv-rc install ${@} - lb chroot_upstart install ${@} - lb chroot_hosts install ${@} - lb chroot_resolv install ${@} - lb chroot_hostname install ${@} - lb chroot_apt install ${@} - lb chroot_archives binary install ${@} - - touch .lock - else - rm -rf chroot/chroot - - # Removing depends - Remove_package - fi - ;; - - false) - mkfs.jffs2 ${JFFS2_OPTIONS} --root=chroot --output binary/${INITFS}/filesystem.jffs2 - ;; - esac - - # Saving cache - Save_cache cache/packages.binary - ;; - - plain) - if [ -d binary/${INITFS}/filesystem.dir ] - then - rm -rf binary/${INITFS}/filesystem.dir - fi - - case "${LB_BUILD_WITH_CHROOT}" 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" - - case "${LB_BUILD_WITH_CHROOT}" in - true) - cp config/binary_rootfs/squashfs.sort chroot - ;; - - false) - cp config/binary_rootfs/squashfs.sort . - ;; - esac - fi - - case "${LB_PARENT_DISTRIBUTION}" in - squeeze) - - ;; - - *) - # FIXME: artax-backports too, once d-i has catched up - MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -comp xz" - ;; - esac - - case "${LB_BUILD_WITH_CHROOT}" in - true) - if [ -e config/binary_rootfs/excludes ] - then - cp config/binary_rootfs/excludes chroot/excludes - - MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -wildcards -ef /excludes" - fi - - # Create image - Chroot chroot "mksquashfs chroot filesystem.squashfs ${MKSQUASHFS_OPTIONS}" - - rm -f chroot/chroot/excludes - - case "${LB_MODE}" in - ubuntu|kubuntu) - du -B 1 -s chroot/chroot | cut -f1 > binary/${INITFS}/filesystem.size - ;; - esac - - # Move image - ${LB_ROOT_COMMAND} mv chroot/filesystem.squashfs binary/${INITFS} - ${LB_ROOT_COMMAND} rm -f chroot/squashfs.sort - - if [ -e chroot/chroot.cache ] - then - rm -f .lock - mv chroot/chroot chroot.tmp - - lb chroot_archives binary remove ${@} - lb chroot_apt remove ${@} - lb chroot_hostname remove ${@} - lb chroot_resolv remove ${@} - lb chroot_hosts remove ${@} - lb chroot_sysv-rc remove ${@} - lb chroot_upstart remove ${@} - lb chroot_dpkg remove ${@} - lb chroot_debianchroot remove ${@} - lb chroot_sysfs remove ${@} - lb chroot_selinuxfs remove ${@} - lb chroot_proc remove ${@} - lb chroot_devpts remove ${@} - - rm -rf chroot - mv chroot.tmp chroot - - lb chroot_devpts install ${@} - lb chroot_proc install ${@} - lb chroot_selinuxfs install ${@} - lb chroot_sysfs install ${@} - lb chroot_debianchroot install ${@} - lb chroot_dpkg install ${@} - lb chroot_sysv-rc install ${@} - lb chroot_upstart install ${@} - lb chroot_hosts install ${@} - lb chroot_resolv install ${@} - lb chroot_hostname install ${@} - lb chroot_apt install ${@} - lb chroot_archives binary install ${@} - - touch .lock - else - rm -rf chroot/chroot - - # Removing depends - Remove_package - fi - - ${LB_ROOT_COMMAND} chmod 0644 binary/${INITFS}/filesystem.squashfs - ;; - - false) - if [ -e config/binary_rootfs/excludes ] - then - MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -wildcards -ef config/binary_rootfs/excludes" - fi - - mksquashfs chroot binary/${INITFS}/filesystem.squashfs ${MKSQUASHFS_OPTIONS} - - case "${LB_MODE}" in - ubuntu|kubuntu) - du -B 1 -s chroot | cut -f1 > binary/${INITFS}/filesystem.size - ;; - esac - ;; - esac - - if [ -n "${LB_ROOT_COMMAND}" ] - then - ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) binary/${INITFS} - fi - - # Saving cache - Save_cache cache/packages.binary - ;; - - none) - if [ -d binary ] - then - rm -rf binary - fi - - case "${LB_BUILD_WITH_CHROOT}" in - true) - mv chroot/chroot binary - ;; - - false) - Echo_message "This may take a while." - cp -a chroot binary - ;; - esac - ;; - -esac - -for STAGE in ${LB_CACHE_STAGES} -do - if [ "${STAGE}" = "rootfs" ] - then - rm -rf cache/binary_rootfs - - mkdir -p cache/binary_rootfs - - if [ "${LB_CHROOT_FILESYSTEM}" != "none" ] - then - ${LB_ROOT_COMMAND} cp -a binary/"${INITFS}"/filesystem.* cache/binary_rootfs - fi - - if [ -n "${LB_ROOT_COMMAND}" ] - then - ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/binary_rootfs - fi - fi -done - -# Creating stage file -Create_stagefile .build/binary_rootfs diff --git a/scripts/build/lb_binary_silo b/scripts/build/lb_binary_silo deleted file mode 100755 index b1ec175e4..000000000 --- a/scripts/build/lb_binary_silo +++ /dev/null @@ -1,239 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTLOADER}" != "silo" ] -then - exit 0 -fi - -# Check image type -case "${LB_BINARY_IMAGES}" in - iso*|hdd*|tar) - ;; - - netboot) - # silo not required for sparc netbooting - exit 0 - ;; -esac - -Echo_message "Begin installing silo..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_silo - -# Checking silo templates -Check_templates silo - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Check architecture -Check_architectures 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=\"${INITFS:+boot=${INITFS} }config LB_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=\"LB_BOOTAPPEND_LIVE ${APPEND} LB_BOOTAPPEND_INSTALL\"\n" -} - -# Setting destination directories -DESTDIR_INSTALL="binary/install" -case "${LB_INITRAMFS}" in - casper) - INITFS="casper" - DESTDIR_LIVE="binary/casper" - ;; - - live-boot) - INITFS="live" - DESTDIR_LIVE="binary/live" - ;; - - *) - INITFS="" - DESTDIR_LIVE="binary/boot" - ;; -esac - -# Creating directory -mkdir -p "${DESTDIR_LIVE}" - -# Setting boot parameters -if [ "${LB_UNION_FILESYSTEM}" != "aufs" ] -then - LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} union=${LB_UNION_FILESYSTEM}" -fi - -if [ -n "${LB_NET_COW_PATH}" ] -then - Echo_error "Net cow not supported on silo" - exit 1 -fi - -if [ "${LB_EXPOSED_ROOT}" != "false" ] -then - LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} exposedroot" -fi - -LB_BOOTAPPEND_LIVE="$(echo ${LB_BOOTAPPEND_LIVE} | sed -e 's| ||')" - -# Assembling kernel configuration - -# Default entries -DEFAULT_FLAVOUR="$(echo ${LB_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}" - -if [ "${LB_BOOTAPPEND_FAILSAFE}" != "none" ] -then - Silo_live_entry "live-failsafe" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" "${LB_BOOTAPPEND_FAILSAFE}" -fi - -if [ "$(echo ${LB_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}" "${LB_BOOTAPPEND_FAILSAFE}" - done -fi - -LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" - -# Assembling debian-installer configuration -if [ "${LB_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 "${LB_BINARY_IMAGES}" in - iso*|hdd*) - # Copying silo - mkdir -p binary/boot - - case "${LB_BUILD_WITH_CHROOT}" in - true) - cp chroot/boot/second.b binary/boot - ;; - - false) - cp /boot/second.b binary/boot - ;; - esac - - cp -r "${TEMPLATES}"/* binary/boot - - if [ "${LB_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|LB_BOOTAPPEND_INSTALL|${LB_BOOTAPPEND_INSTALL}|" \ - -e "s|LB_BOOTAPPEND_LIVE|${LB_BOOTAPPEND_LIVE}|" \ - binary/boot/silo.conf - sed -i -e "s|LB_DATE|$(date +%Y%m%d)|" \ - -e "s|LB_VERSION|${VERSION}|" \ - -e "s|LB_DISTRIBUTION|${LB_DISTRIBUTION}|" \ - binary/boot/debian.txt - ;; -esac - -# Saving cache -Save_cache cache/packages.binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .build/binary_silo diff --git a/scripts/build/lb_binary_syslinux b/scripts/build/lb_binary_syslinux deleted file mode 100755 index cf9c4a2c6..000000000 --- a/scripts/build/lb_binary_syslinux +++ /dev/null @@ -1,366 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTLOADER}" != "syslinux" ] -then - exit 0 -fi - -Echo_message "Begin installing syslinux..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_syslinux - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Check architecture -Check_architectures amd64 i386 -Check_crossarchitectures - -# Assembling image specifics -case "${LB_BINARY_IMAGES}" in - iso*) - _BOOTLOADER="isolinux" - - case "${LB_MODE}" in - progress) - _TARGET="binary/boot" - ;; - - *) - _TARGET="binary/isolinux" - ;; - esac - ;; - - netboot) - _BOOTLOADER="pxelinux" - _TARGET="tftpboot" - ;; - - hdd*|*) - _BOOTLOADER="syslinux" - - case "${LB_MODE}" in - progress) - _TARGET="binary/boot" - ;; - - *) - _TARGET="binary/syslinux" - ;; - esac - ;; -esac - -# Checking depends -case "${LB_BUILD_WITH_CHROOT}" in - true) - Check_package chroot/usr/bin/syslinux syslinux - Check_package chroot/usr/lib/syslinux syslinux-common - - case "${LB_SYSLINUX_THEME}" in - live-build) - Check_package chroot/usr/bin/rsvg librsvg2-bin - ;; - - *) - Check_package chroot/usr/share/syslinux/themes/${LB_SYSLINUX_THEME} syslinux-themes-${LB_SYSLINUX_THEME} - - case "${LB_MODE}" in - ubuntu) - Check_package chroot/usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz gfxboot-theme-ubuntu - ;; - esac - ;; - esac - ;; - - false) - if [ ! -e /usr/bin/syslinux ] - then - # syslinux - Echo_error "/usr/bin/syslinux - no such file." - exit 1 - fi - - if [ ! -e /usr/lib/syslinux ] - then - # syslinux-common - Echo_error "/usr/lib/syslinux - no such directory" - exit 1 - fi - - case "${LB_SYSLINUX_THEME}" in - live-build) - if [ ! -e /usr/bin/rsvg ] - then - # librsvg2-bin - Echo_error "/usr/bin/rsvg - no such file" - exit 1 - fi - ;; - - *) - if [ ! -e /usr/share/syslinux/themes/${LB_SYSLINUX_THEME} ] - then - # syslinux-theme - Echo_error "/usr/share/syslinux/themes/${LB_SYSLINUX_THEME} - no such directory." - exit 1 - fi - ;; - esac - ;; -esac - -# Restoring cache -Restore_cache cache/packages.binary - -# Installing depends -Install_package - -# FIXME: cleanup, unify, and extend themes for ${_BOOTLOADER}-live and ${_BOOTLOADER}-installer -if [ "${LB_SYSLINUX_THEME}" = "live-build" ] -then - if [ -e "config/bootloaders/${_BOOTLOADER}" ] - then - # Internal local copy - _SOURCE="config/bootloaders/${_BOOTLOADER}" - else - # Internal system copy - if [ -n "${LIVE_BUILD}" ] - then - _SOURCE="${LIVE_BUILD}/share/bootloaders/${_BOOTLOADER}" - else - _SOURCE="/usr/share/live/build/bootloaders/${_BOOTLOADER}" - fi - fi -else - # External copy from chroot or system - _SOURCE="/usr/share/syslinux/themes/${LB_SYSLINUX_THEME}/${_BOOTLOADER}-live" -fi - -# Copying files -case "${LB_BUILD_WITH_CHROOT}" in - true) - mkdir -p $(dirname ${_TARGET}) - - # Copy in two steps since the theme can have absolute symlinks and would therefore not be dereferenced correctly - if [ "${LB_SYSLINUX_THEME}" = "live-build" ] - then - cp -a ${_SOURCE} chroot/root - Chroot chroot cp -aL /root/$(basename ${_SOURCE}) /root/$(basename ${_SOURCE}).tmp - rm -rf chroot/$(basename ${_SOURCE}) - else - Chroot chroot cp -aL ${_SOURCE} /root/$(basename ${_SOURCE}).tmp - fi - - case "${LB_MODE}" in - ubuntu) - Chroot chroot "tar xfz /usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz -C /root/$(basename ${_SOURCE}).tmp" - ;; - esac - - mv chroot/root/$(basename ${_SOURCE}).tmp ${_TARGET} - ;; - - false) - mkdir -p ${_TARGET} - - cp -aL ${_SOURCE}/* ${_TARGET} - - case "${LB_MODE}" in - ubuntu) - tar xfz /usr/share/gfxboot-theme-ubuntu/bootlogo.tar.gz -C ${_TARGET} - ;; - esac - ;; -esac - -# Configuring files -if [ -e "${_TARGET}/live.cfg.in" ] -then - # This is all rather suboptimal.. needs prettifying at some point - _FLAVOURS="$(echo ${LB_LINUX_FLAVOURS} | wc -w)" - - case "${_FLAVOURS}" in - 1) - mv binary/live/vmlinuz-* binary/live/vmlinuz - mv binary/live/initrd.img-* binary/live/initrd.img - - sed -e "s|@FLAVOUR@|${LB_LINUX_FLAVOURS}|g" \ - -e "s|@KERNEL@|/live/vmlinuz|g" \ - -e "s|@INITRD@|/live/initrd.img|g" \ - -e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \ - -e "s|@LB_BOOTAPPEND_FAILSAFE@|${LB_BOOTAPPEND_FAILSAFE}|g" \ - "${_TARGET}/live.cfg.in" >> "${_TARGET}/live.cfg" - - rm -f "${_TARGET}/live.cfg.in" - ;; - - *) - _NUMBER="0" - - for _FLAVOUR in ${LB_LINUX_FLAVOURS} - do - _NUMBER="$((${_NUMBER} + 1))" - - mv binary/live/vmlinuz-*-${_FLAVOUR} binary/live/vmlinuz${_NUMBER} - mv binary/live/initrd.img-*-${_FLAVOUR} binary/live/initrd${_NUMBER}.img - - sed -e "s|@FLAVOUR@|${_FLAVOUR}|g" \ - -e "s|@KERNEL@|/live/vmlinuz${_NUMBER}|g" \ - -e "s|@INITRD@|/live/initrd${_NUMBER}.img|g" \ - -e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \ - -e "s|@LB_BOOTAPPEND_FAILSAFE@|${LB_BOOTAPPEND_FAILSAFE}|g" \ - "${_TARGET}/live.cfg.in" >> "${_TARGET}/live.cfg" - done - - rm -f "${_TARGET}/live.cfg.in" - ;; - esac -elif [ -e "${_TARGET}/live.cfg" ] -then - sed -i -e "s|@LB_BOOTAPPEND_LIVE@|${LB_BOOTAPPEND_LIVE}|g" \ - -e "s|@LB_BOOTAPPEND_FAILSAFE@|${LB_BOOTAPPEND_FAILSAFE}|g" \ - ${_TARGET}/live.cfg -fi - -if [ -e ${_TARGET}/install.cfg ] -then - sed -i -e "s|@LB_BOOTAPPEND_INSTALL@|${LB_BOOTAPPEND_INSTALL}|g" \ - ${_TARGET}/install.cfg -fi - -if [ -e "${_TARGET}/splash.svg.in" ] -then - case "${LB_MODE}" in - progress) - _PROJECT="Progress Linux" - - if ls config/package-lists/client-gnome.list* - then - _DESCRIPTION="Client GNOME" - elif ls config/package-lists/client-lxde.list* > /dev/null 2>&1 - then - _DESCRIPTION="Client LXDE" - elif ls config/package-lists/server-lxc.list* > /dev/null 2>&1 - then - _DESCRIPTION="Server LXC" - else - _DESCRIPTION="Standard" - fi - ;; - - *) - _PROJECT="Debian GNU/Linux" - _DESCRIPTION="" - ;; - - esac - - eval _VERSION="$`echo RELEASE_${LB_DISTRIBUTION}`" - _DISTRIBUTION="${LB_DISTRIBUTION}" - _ARCHITECTURE="${LB_ARCHITECTURES}" - _DATE=$(date -R) - _YEAR="$(date +%Y)" - _MONTH="$(date +%m)" - _DAY="$(date +%d)" - _HOUR="$(date +%H)" - _MINUTE="$(date +%M)" - _SECOND="$(date +%S)" - _LINUX_VERSIONS="$(for _LINUX in chroot/boot/vmlinuz-* ; do chroot chroot apt-cache policy $(basename ${_LINUX} | sed -e 's|vmlinuz-|linux-image-|') | awk '/Installed: / { print $2 }' ; done | sort -u)" - _LIVE_BUILD_VERSION="$(lb --version)" - _LIVE_BOOT_VERSION="$(chroot chroot apt-cache policy live-boot | awk '/Installed: / { print $2 }')" - _LIVE_CONFIG_VERSION="$(chroot chroot apt-cache policy live-config | awk '/Installed: / { print $2 }')" - _LIVE_TOOLS_VERSION="$(chroot chroot apt-cache policy live-tools | awk '/Installed: / { print $2 }')" - - sed -e "s|@PROJECT@|${_PROJECT}|g" \ - -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \ - -e "s|@VERSION@|${_VERSION}|g" \ - -e "s|@ARCHITECTURE@|${_ARCHITECTURE}|g" \ - -e "s|@DESCRIPTION@|${_DESCRIPTION}|g" \ - -e "s|@DATE@|${_DATE}|g" \ - -e "s|@YEAR@|${_YEAR}|g" \ - -e "s|@MONTH@|${_MONTH}|g" \ - -e "s|@DAY@|${_DAY}|g" \ - -e "s|@HOUR@|${_HOUR}|g" \ - -e "s|@MINUTE@|${_MINUTE}|g" \ - -e "s|@SECOND@|${_SECOND}|g" \ - -e "s|@LINUX_VERSIONS@|${_LINUX_VERSIONS}|g" \ - -e "s|@LIVE_BUILD_VERSION@|${_LIVE_BUILD_VERSION}|g" \ - -e "s|@LIVE_BOOT_VERSION@|${_LIVE_BOOT_VERSION}|g" \ - -e "s|@LIVE_CONFIG_VERSION@|${_LIVE_CONFIG_VERSION}|g" \ - -e "s|@LIVE_TOOLS_VERSION@|${_LIVE_TOOLS_VERSION}|g" \ - "${_TARGET}/splash.svg.in" > "${_TARGET}/splash.svg" - - case "${LB_BUILD_WITH_CHROOT}" in - true) - cp "${_TARGET}/splash.svg" chroot - Chroot chroot "rsvg --format png --height 480 --width 640 splash.svg splash.png" - mv chroot/splash.png "${_TARGET}" - rm -f chroot/splash.svg - ;; - - false) - rsvg --format png --height 480 --width 640 "${_TARGET}/splash.svg" "${_TARGET}/splash.png" - ;; - esac - - rm -f "${_TARGET}/splash.svg.in" "${_TARGET}/splash.svg" -fi - -case "${LB_MODE}" in - progress) - for _FILE in "${_TARGET}/isolinux.bin" "${_TARGET}/isolinux.cfg" "${_TARGET}/syslinux.cfg" - do - if [ -e "${_FILE}" ] - then - mv "${_FILE}" "${_TARGET}/$(echo ${_FILE} | sed -e 's|.*linux|boot|')" - fi - done - ;; -esac - -case "${LB_BUILD_WITH_CHROOT}" in - true) - # Saving cache - Save_cache cache/packages.binary - - # Removing depends - Remove_package - ;; -esac - -# Creating stage file -Create_stagefile .build/binary_syslinux diff --git a/scripts/build/lb_binary_tar b/scripts/build/lb_binary_tar deleted file mode 100755 index 9b9b3dec0..000000000 --- a/scripts/build/lb_binary_tar +++ /dev/null @@ -1,73 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 "${LB_BINARY_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building binary harddisk image..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_tar - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Remove old binary -rm -f binary.tar.bz2 binary.tar.gz binary.tar.lz binary.tar - -tar cf binary-tar.tar binary - -case "${LB_COMPRESSION}" in - bzip2) - bzip2 ${BZIP2_OPTIONS} binary-tar.tar - ;; - - gzip) - gzip ${GZIP_OPTIONS} binary-tar.tar - ;; - - lzip) - lzip ${LZIP_OPTIONS} binary-tar.tar - ;; - - xz) - xz ${XZ_OPTIONS} binary-tar.tar - ;; - - none) - ;; -esac - -# Creating stage file -Create_stagefile .build/binary_tar diff --git a/scripts/build/lb_binary_virtual-hdd b/scripts/build/lb_binary_virtual-hdd deleted file mode 100755 index f8121e625..000000000 --- a/scripts/build/lb_binary_virtual-hdd +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 "${LB_BINARY_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building binary virtual-hdd image..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap .build/chroot_proc - -# Checking stage file -Check_stagefile .build/binary_virtual-hdd - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] -then - case "${LB_BINARY_FILESYSTEM}" in - ext2|ext3|ext4) - Check_package chroot/sbin/mkfs.${LB_BINARY_FILESYSTEM} 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=${LB_HDD_SIZE} - -if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] -then - mv binary-virtual.img chroot - - # hack to recreate mtab from chroot_hacks if its gone for some reason - if ! Chroot chroot "test -s /etc/mtab" - then - Chroot chroot "rm -f /etc/mtab" - Chroot chroot "ln -s /proc/mounts /etc/mtab" - fi - - case "${LB_BINARY_FILESYSTEM}" in - ext2|ext3|ext4) - Chroot chroot "mkfs.${LB_BINARY_FILESYSTEM} -F binary-virtual.img" - ;; - esac - - mv chroot/binary-virtual.img ./ -else - case "${LB_BINARY_FILESYSTEM}" in - ext2|ext3|ext4) - mkfs.${LB_BINARY_FILESYSTEM} . -F binary-virtual.img - ;; - esac -fi - -mkdir -p binary.tmp -${LB_ROOT_COMMAND} mount -o loop binary-virtual.img binary.tmp -cp -a binary/* binary.tmp -cp -af binary/.disk* binary.tmp - -${LB_ROOT_COMMAND} umount binary.tmp -rmdir binary.tmp - -# Saving cache -Save_cache cache/packages.binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .build/binary_virtual-hdd diff --git a/scripts/build/lb_binary_win32-loader b/scripts/build/lb_binary_win32-loader deleted file mode 100755 index 7fd5ff2a4..000000000 --- a/scripts/build/lb_binary_win32-loader +++ /dev/null @@ -1,103 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_WIN32_LOADER}" != "true" ] || [ "${LB_BINARY_IMAGES}" = "virtual-hdd" ] -then - exit 0 -fi - -Echo_message "Begin copying win32-loader..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_win32-loader - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -case "${LB_ARCHITECTURES}" in - amd64|i386) - if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] - then - # Checking depends - Check_package chroot/usr/share/win32/win32-loader.exe win32-loader - - # Restoring cache - Restore_cache cache/packages.binary - - # Installing depends - Install_package - - # Copying win32-loader - cp -r chroot/usr/share/win32/* binary - else - cp -r usr/share/win32/* binary - fi - - mv binary/win32-loader.exe binary/setup.exe - - if [ -e binary/win32-loader-standalone.exe ] - then - mv binary/win32-loader-standalone.exe binary/setup-standalone.exe - fi - - if [ "${LB_DEBIAN_INSTALLER}" != "false" ] - then - -cat > binary/win32-loader.ini << EOF -[installer] -arch=${LB_ARCHITECTURES} -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 .build/binary_win32-loader diff --git a/scripts/build/lb_binary_yaboot b/scripts/build/lb_binary_yaboot deleted file mode 100755 index 4838cf351..000000000 --- a/scripts/build/lb_binary_yaboot +++ /dev/null @@ -1,284 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTLOADER}" != "yaboot" ] -then - exit 0 -fi - -Echo_message "Begin installing yaboot..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_yaboot - -# Checking yaboot templates -Check_templates yaboot - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Check architecture -Check_architectures powerpc ppc64 -Check_crossarchitectures - -# 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=\"${INITFS:+boot=${INITFS} }config LB_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} ${LB_BOOTAPPEND_INSTALL}\"\n" - LINUX_INSTALL="${LINUX_INSTALL}\tinitrd-size=10240\n" - done -} - -case "${LB_INITRAMFS}" in - casper) - INITFS="casper" - ;; - - live-boot) - INITFS="live" - ;; - - *) - INITFS="" - ;; -esac - -# Setting destination directory -case "${LB_BINARY_IMAGES}" in - iso*) - case "${LB_INITRAMFS}" in - casper) - DESTDIR_LIVE="binary/casper" - ;; - - live-boot) - DESTDIR_LIVE="binary/live" - ;; - - *) - DESTDIR_LIVE="binary/boot" - ;; - esac - - DESTDIR_INSTALL="binary/install" - ;; - - hdd*|netboot|tar) - Echo_error "not yet supported, aborting (FIXME)." - exit 1 - ;; -esac - -Check_multiarchitectures - -# Creating directory -mkdir -p "${DESTDIR_LIVE}" - -# Setting boot parameters -if [ "${LB_UNION_FILESYSTEM}" != "aufs" ] -then - LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} union=${LB_UNION_FILESYSTEM}" -fi - -if [ -n "${LB_NET_COW_PATH}" ] -then - Echo_error "Net cow not yet supported on yaboot" - exit 1 -fi - -if [ "${LB_EXPOSED_ROOT}" != "false" ] -then - LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE} exposedroot" -fi - -LB_BOOTAPPEND_LIVE="$(echo ${LB_BOOTAPPEND_LIVE} | sed -e 's| ||')" - -# Assembling kernel configuration - -# Default entries -DEFAULT_FLAVOUR="$(echo ${LB_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}" - -if [ "${LB_BOOTAPPEND_FAILSAFE}" != "none" ] -then - Yaboot_live_entry "live-failsafe" "${DEFAULT_KERNEL}" "${DEFAULT_INITRD}" "${LB_BOOTAPPEND_FAILSAFE}" -fi - -if [ "$(echo ${LB_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}" "${LB_BOOTAPPEND_FAILSAFE}" - done -fi - -LINUX_LIVE="$(/bin/echo ${LINUX_LIVE} | sed -e 's|binary||g' -e 's|//|/|g')" - -# Assembling debian-installer configuration -if [ "${LB_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 "${LB_BINARY_IMAGES}" in - iso*|hdd*) - # Copying yaboot - mkdir -p binary/yaboot - - case "${LB_BUILD_WITH_CHROOT}" in - true) - cp chroot/usr/lib/yaboot/yaboot binary/yaboot - ;; - - false) - cp /usr/lib/yaboot/yaboot binary/yaboot - ;; - esac - - cp -r "${TEMPLATES}"/* binary/yaboot - - case "${LB_BINARY_IMAGES}" in - hdd*) - 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 - ;; - esac - - # 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|LB_BOOTAPPEND_INSTALL|${LB_BOOTAPPEND_INSTALL}|" -e "s|LB_BOOTAPPEND_LIVE|${LB_BOOTAPPEND_LIVE}|" binary/yaboot/yaboot.conf - sed -i -e "s|LB_DATE|$(date +%Y%m%d)|" -e "s|LB_VERSION|${VERSION}|" binary/yaboot/boot.msg - ;; -esac - -# Saving cache -Save_cache cache/packages.binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .build/binary_yaboot diff --git a/scripts/build/lb_binary_zsync b/scripts/build/lb_binary_zsync deleted file mode 100755 index 7fdaf596a..000000000 --- a/scripts/build/lb_binary_zsync +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'build zsync control files')" -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 [ "${LB_ZSYNC}" != "true" ] -then - exit 0 -fi - -Echo_message "Begin building zsync control files..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/binary_zsync - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Checking depends -Check_package chroot/usr/bin/zsyncmake zsync - -# Restoring cache -Restore_cache cache/packages.binary - -# Installing depends -Install_package - -case "${LB_BINARY_IMAGES}" in - iso) - _IMAGES="binary.iso" - ;; - - iso-hybrid) - _IMAGES="binary.hybrid.iso" - ;; - - hdd) - _IMAGES="binary.img" - ;; - - net) - _IMAGES="binary.netboot.tar*" - ;; - - tar) - _IMAGES="binary.tar*" - ;; -esac - -for _IMAGE in ${_IMAGES} -do - if [ -e "${_IMAGE}" ] - then - case "${LB_BUILD_WITH_CHROOT}" in - true) - mv ${_IMAGE} chroot - Chroot chroot "zsyncmake -C -b 2048 -u ${_IMAGE} ${_IMAGE}" - mv chroot/${_IMAGE} chroot/${_IMAGE}.zsync ./ - ;; - - false) - zsyncmake -C -b 2048 -u "${_IMAGE}" "${_IMAGE}" - ;; - esac - - case "${LB_COMPRESSION}" in - bzip2) - bzip2 ${BZIP2_OPTIONS} ${_IMAGE}.zsync - ;; - - gzip) - gzip ${GZIP_OPTIONS} ${_IMAGE}.zsync - ;; - - lzip) - lzip ${LZIP_OPTIONS} ${_IMAGE}.zsync - ;; - - xz) - xz ${XZ_OPTIONS} ${_IMAGE}.zsync - ;; - - none) - ;; - esac - fi -done - -#CHECKSUMS - -# Saving cache -Save_cache cache/packages.binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .build/binary_zsync diff --git a/scripts/build/lb_bootstrap b/scripts/build/lb_bootstrap deleted file mode 100755 index ed9c77498..000000000 --- a/scripts/build/lb_bootstrap +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Automatically populating config tree -if [ -x auto/config ] && [ ! -e .build/config ] -then - Echo_message "Automatically populating config tree." - lb config -fi - -# 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 -lb bootstrap_cache restore ${@} -lb bootstrap_copy ${@} -lb bootstrap_cdebootstrap ${@} -lb bootstrap_debootstrap ${@} -lb bootstrap_cache save ${@} - -# Temporary hack until we have multistrap in place -case "${LB_MODE}" in - progress) - echo '0.0.0' > chroot/etc/progress_version - ;; -esac diff --git a/scripts/build/lb_bootstrap_cache b/scripts/build/lb_bootstrap_cache deleted file mode 100755 index 6b0f582ea..000000000 --- a/scripts/build/lb_bootstrap_cache +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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_crossarchitectures - -for STAGE in ${LB_CACHE_STAGES} -do - if [ "${STAGE}" = "bootstrap" ] - then - case "${1}" in - restore) - Echo_message "Restoring bootstrap stage from cache..." - - # Checking stage file - Check_stagefile .build/bootstrap_cache.restore - - if [ -d cache/bootstrap ] - then - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Removing old chroot - rm -rf chroot - - # Restoring old cache - ${LB_ROOT_COMMAND} cp -a cache/bootstrap chroot - - if [ -n "${LB_ROOT_COMMAND}" ] - then - ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot - fi - - # Creating stage file - Create_stagefile .build/bootstrap_cache.restore - Create_stagefile .build/bootstrap - - exit 0 - fi - ;; - - save) - Echo_message "Saving bootstrap stage to cache..." - - # Checking stage file - Check_stagefile .build/bootstrap_cache.save - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - rm -rf cache/bootstrap - - mkdir -p cache - - ${LB_ROOT_COMMAND} cp -a chroot cache/bootstrap - - if [ -n "${LB_ROOT_COMMAND}" ] - then - ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/bootstrap - fi - - # Creating stage file - Create_stagefile .build/bootstrap_cache.save - ;; - esac - fi -done diff --git a/scripts/build/lb_bootstrap_cdebootstrap b/scripts/build/lb_bootstrap_cdebootstrap deleted file mode 100755 index 3c8843e2b..000000000 --- a/scripts/build/lb_bootstrap_cdebootstrap +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTSTRAP}" != "cdebootstrap" ] && [ "${LB_BOOTSTRAP}" != "cdebootstrap-static" ] -then - exit 0 -fi - -if [ ! -x "$(which cdebootstrap 2>/dev/null)" ] -then - echo "E: cdebootstrap - command not found"; \ - echo "I: cdebootstrap can be optained from http://ftp.debian.org/debian/pool/main/d/cdebootstrap/"; \ - echo "I: On Debian based systems, cdebootstrap can be installed with 'apt-get install debootstrap'."; \ - exit 1 -fi - -# Check architecture -Check_crossarchitectures - -Echo_message "Begin bootstrapping system..." - -Check_package /usr/bin/${LB_BOOTSTRAP} cdebootstrap - -# Ensure that a system is built as root -lb testroot - -# Checking stage file -Check_stagefile .build/bootstrap -Check_stagefile .build/bootstrap_cache.restore - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Creating chroot directory -mkdir -p chroot - -# Temporarily including bzip2 manually until #657560 has been fixed in unstable -CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --include=bzip2" - -# Setting cdebootstrap options -if [ -n "${LB_ARCHITECTURES}" ] -then - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --arch=${LB_ARCHITECTURES}" -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 [ "${LB_APT_SECURE}" = "false" ] -then - CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --allow-unauthenticated" -fi - -if [ -x "/usr/bin/cdebootstrap" ] || [ -x "/usr/bin/cdebootstrap-static" ] -then - if [ "${LB_CACHE_PACKAGES}" = "true" ] - then - if ls cache/packages.bootstrap/*.deb > /dev/null 2>&1 - then - mkdir -p chroot/var/cache/bootstrap - cp cache/packages.bootstrap/*.deb chroot/var/cache/bootstrap - fi - - Echo_breakage "Running ${LB_BOOTSTRAP} (download-only)... " - ${LB_ROOT_COMMAND} ${LB_BOOTSTRAP} ${CDEBOOTSTRAP_OPTIONS} --download-only "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" - - if [ -n "${LB_ROOT_COMMAND}" ] - then - ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot - fi - - # Removing old cache - rm -f cache/packages.bootstrap/*.deb - - # Saving new cache - mkdir -p cache/packages.bootstrap - cp chroot/var/cache/bootstrap/*.deb cache/packages.bootstrap - fi - - Echo_breakage "Running ${LB_BOOTSTRAP}... " - ${LB_ROOT_COMMAND} ${LB_BOOTSTRAP} ${CDEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" - - if [ -n "${LB_ROOT_COMMAND}" ] - then - ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot - fi - - # 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 .build/bootstrap -else - Echo_error "Can't process file /usr/bin/${LB_BOOTSTRAP} (FIXME)" - exit 1 -fi diff --git a/scripts/build/lb_bootstrap_copy b/scripts/build/lb_bootstrap_copy deleted file mode 100755 index 1028342c6..000000000 --- a/scripts/build/lb_bootstrap_copy +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTSTRAP}" != "copy" ] -then - exit 0 -fi - -# Check architecture -Check_crossarchitectures - -Echo_message "Begin bootstrapping system..." - -# Ensure that a system is built as root -lb testroot - -# Checking stage file -Check_stagefile .build/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 .build/bootstrap diff --git a/scripts/build/lb_bootstrap_debootstrap b/scripts/build/lb_bootstrap_debootstrap deleted file mode 100755 index b0fa09fa1..000000000 --- a/scripts/build/lb_bootstrap_debootstrap +++ /dev/null @@ -1,158 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_BOOTSTRAP}" != "debootstrap" ] -then - exit 0 -fi - -if [ ! -x "$(which debootstrap 2>/dev/null)" ] -then - echo "E: debootstrap - command not found"; \ - echo "I: debootstrap can be optained from http://ftp.debian.org/debian/pool/main/d/debootstrap/"; \ - echo "I: On Debian based systems, debootstrap can be installed with 'apt-get install debootstrap'."; \ - exit 1 -fi - -# Check architecture -Check_crossarchitectures - -Echo_message "Begin bootstrapping system..." - -Check_package /usr/sbin/debootstrap debootstrap - -# Ensure that a system is built as root -lb testroot - -# Checking stage file -Check_stagefile .build/bootstrap -Check_stagefile .build/bootstrap_cache.restore - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Creating chroot directory -mkdir -p chroot - -# Temporarily including bzip2 manually until #657560 has been fixed in unstable -DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --include=bzip2" - -# Setting debootstrap options -if [ -n "${LB_ARCHITECTURES}" ] -then - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --arch=${LB_ARCHITECTURES}" -fi - -if [ "${LB_ARCHIVE_AREAS}" != "main" ] -then - # Modify archive areas to remove leading/trailing whitespaces and replace other whitepspace with commas - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --components=$(echo ${LB_ARCHIVE_AREAS} | sed -e 's| |,|g')" -fi - -case "${LB_USE_FAKEROOT}" in - true) - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --variant=fakechroot" - ;; -esac - -if [ "${_VERBOSE}" = "true" ] -then - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --verbose" -fi - -# If LB_APT_SECURE is false, do not check signatures of the Release file -# (requires debootstrap >= 1.0.30) -if [ "${LB_APT_SECURE}" = "false" ] && /usr/sbin/debootstrap --help | grep -qs '\-\-no-check-gpg' -then - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --no-check-gpg" -fi - -if [ -x "/usr/sbin/debootstrap" ] -then - if [ "${LB_CACHE_PACKAGES}" = "true" ] - then - if ls cache/packages.bootstrap/*.deb > /dev/null 2>&1 - 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)... " - ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" - - if [ -n "${LB_ROOT_COMMAND}" ] - then - ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot - fi - - # Removing old cache - rm -f cache/packages.bootstrap/*.deb - - # Saving new cache - mkdir -p cache/packages.bootstrap - cp chroot/var/cache/apt/archives/*.deb cache/packages.bootstrap - fi - - Echo_breakage "Running debootstrap... " - - # Run appropriate bootstrap, i.e. foreign or regular bootstrap - if [ "${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" = "${LB_ARCHITECTURES}" ]; then - - if [ -n "${LB_BOOTSTRAP_QEMU_EXCLUDE}" ] - then - DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --exclude=$(echo ${LB_BOOTSTRAP_QEMU_EXCLUDE} | sed 's| *|,|g')" - fi - - Echo_message "Bootstrap will be foreign" - ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} --foreign "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" - - Echo_message "Running debootstrap second stage under QEMU" - cp ${LB_BOOTSTRAP_QEMU_STATIC} chroot/usr/bin - Chroot chroot /bin/sh /debootstrap/debootstrap --second-stage - else - ${LB_ROOT_COMMAND} debootstrap ${DEBOOTSTRAP_OPTIONS} "${LB_PARENT_DISTRIBUTION}" chroot "${LB_PARENT_MIRROR_BOOTSTRAP}" - fi - - if [ -n "${LB_ROOT_COMMAND}" ] - then - ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot - fi - - # Deconfiguring debootstrap configurations - rm -f chroot/etc/hosts - - # Removing bootstrap cache - rm -f chroot/var/cache/apt/archives/*.deb - - # Creating stage file - Create_stagefile .build/bootstrap -else - Echo_error "Can't process file /usr/bin/debootstrap (FIXME)" - exit 1 -fi diff --git a/scripts/build/lb_build b/scripts/build/lb_build deleted file mode 100755 index d7b989dec..000000000 --- a/scripts/build/lb_build +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Automatically populating config tree -if [ -x auto/config ] && [ ! -e .build/config ] -then - Echo_message "Automatically populating config tree." - lb config -fi - -# Read meta config -if [ "${1}" != "noauto" ] && [ -x auto/build ] -then - Echo_message "Executing auto/build script." - ./auto/build "${@}" - exit ${?} -fi - -if [ "${1}" = "noauto" ] -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 -lb bootstrap ${@} - -# Customizing chroot -lb chroot ${@} - -# Building binary images -lb binary ${@} - -# Building source images -lb source ${@} diff --git a/scripts/build/lb_chroot b/scripts/build/lb_chroot deleted file mode 100755 index 1c6348293..000000000 --- a/scripts/build/lb_chroot +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Automatically populating config tree -if [ -x auto/config ] && [ ! -e .build/config ] -then - Echo_message "Automatically populating config tree." - lb config -fi - -# 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 -lb chroot_cache restore ${@} -lb chroot_devpts install ${@} -lb chroot_proc install ${@} -lb chroot_selinuxfs install ${@} -lb chroot_sysfs install ${@} -lb chroot_debianchroot install ${@} -lb chroot_dpkg install ${@} -lb chroot_tmpfs install ${@} -lb chroot_sysv-rc install ${@} -lb chroot_upstart install ${@} -lb chroot_hosts install ${@} -lb chroot_resolv install ${@} -lb chroot_hostname install ${@} -lb chroot_apt install ${@} -lb chroot_archives chroot install ${@} - -# Customizing chroot -lb chroot_linux-image ${@} -lb chroot_preseed ${@} - -for _PASS in install live -do - lb chroot_package-lists ${_PASS} ${@} - lb chroot_install-packages ${_PASS} ${@} - - if [ "${_PASS}" = install ] - then - Chroot chroot "dpkg-query -W" > chroot.packages.install - fi -done - -lb chroot_live-packages ${@} -lb chroot_includes ${@} -lb chroot_hooks ${@} -lb chroot_hacks ${@} -lb chroot_interactive ${@} - -Chroot chroot "dpkg-query -W" > chroot.packages.live - -# Deconfiguring chroot -lb chroot_archives chroot remove ${@} -lb chroot_apt remove ${@} -lb chroot_hostname remove ${@} -lb chroot_resolv remove ${@} -lb chroot_hosts remove ${@} -lb chroot_sysv-rc remove ${@} -lb chroot_upstart remove ${@} -lb chroot_tmpfs remove ${@} -lb chroot_dpkg remove ${@} -lb chroot_debianchroot remove ${@} -lb chroot_sysfs remove ${@} -lb chroot_selinuxfs remove ${@} -lb chroot_proc remove ${@} -lb chroot_devpts remove ${@} -lb chroot_cache save ${@} diff --git a/scripts/build/lb_chroot_apt b/scripts/build/lb_chroot_apt deleted file mode 100755 index 2e1bce289..000000000 --- a/scripts/build/lb_chroot_apt +++ /dev/null @@ -1,335 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap - -case "${1}" in - install|install-binary) - Echo_message "Configuring file /etc/apt/apt.conf" - - # Checking stage file - Check_stagefile .build/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 "${LB_APT_FTP_PROXY}" ] - then - echo "Acquire::ftp::Proxy \"${LB_APT_FTP_PROXY}\";" > chroot/etc/apt/apt.conf.d/00ftp-proxy - fi - - # Configuring apt http proxy - if [ -n "${LB_APT_HTTP_PROXY}" ] - then - echo "Acquire::http::Proxy \"${LB_APT_HTTP_PROXY}\";" > chroot/etc/apt/apt.conf.d/00http-proxy - fi - - # Configuring apt pipeline - if [ -n "${LB_APT_PIPELINE}" ] - then - echo "Acquire::http::Pipeline-Depth \"${LB_APT_PIPELINE}\";" > chroot/etc/apt/apt.conf.d/00pipeline - fi - - # Configuring apt recommends - case "${LB_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 "${LB_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_apt/*.pref - then - for _FILE in config/chroot_apt/*.pref - do - if [ -f chroot/etc/apt/preferences.d/$(basename ${_FILE}) ] - then - mv chroot/etc/apt/preferences.d/$(basename ${_FILE}) chroot/etc/apt/preferences.d/$(basename ${_FILE}).orig - fi - - cp -aL ${_FILE} chroot/etc/apt/preferences.d - done - fi - - if Find_files config/packages.chroot/*.deb || Find_files config/packages/*.deb - then - echo >> chroot/etc/apt/preferences - echo "# Added by lb_chroot_apt ${@}" >> chroot/etc/apt/preferences - echo "Package: *" >> chroot/etc/apt/preferences - echo "Pin: release o=config/packages.chroot" >> 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 lb_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 - - case "${LB_MODE}" in - progress) - if [ ! -e chroot/etc/apt/preferences.d/progress.pref ] - then - _DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | sed -e 's|-backports||')" - - _ENABLE_DISTRIBUTIONS="${_DISTRIBUTION}" - _DISABLE_DISTRIBUTIONS="" - - if [ "${LB_SECURITY}" = "true" ] - then - _ENABLE_DISTRIBUTIONS="${_ENABLE_DISTRIBUTIONS} ${_DISTRIBUTION}-security" - fi - - if [ "${LB_VOLATILE}" = "true" ] - then - _ENABLE_DISTRIBUTIONS="${_ENABLE_DISTRIBUTIONS} ${_DISTRIBUTION}-updates" - fi - - case "${LB_DISTRIBUTION}" in - *-backports) - if [ "${LB_BACKPORTS}" = "true" ] - then - _ENABLE_DISTRIBUTIONS="${_ENABLE_DISTRIBUTIONS} ${_DISTRIBUTION}-backports" - fi - ;; - - *) - if [ "${LB_BACKPORTS}" = "true" ] - then - _DISABLE_DISTRIBUTIONS="${_DISABLE_DISTRIBUTIONS} ${_DISTRIBUTION}-backports" - fi - ;; - esac - - for _DISTRIBUTION in ${_ENABLE_DISTRIBUTIONS} - do - -cat >> chroot/etc/apt/preferences.d/progress.pref << EOF - -Package: * -Pin: release n=${_DISTRIBUTION} -Pin-Priority: 999 -EOF - - done - - for _DISTRIBUTION in ${_DISABLE_DISTRIBUTIONS} - do - -cat >> chroot/etc/apt/preferences.d/progress.pref << EOF - -#Package: * -#Pin: release n=${_DISTRIBUTION} -#Pin-Priority: 999 -EOF - - done - - # Add temporary hack to avoid squashfs version mismatch - case "${LB_DISTRIBUTION}" in - artax-backports) - -cat >> chroot/etc/apt/preferences.d/progress.tmp.pref << EOF -Package: squashfs-tools -Pin: release n=squeeze -Pin-Priority: 1001 -EOF - - ;; - esac - fi - ;; - esac - - # Creating stage file - Create_stagefile .build/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 pipeline - rm -f chroot/etc/apt/apt.conf.d/00pipeline - - # Deconfiguring aptitude recommends - if [ "${LB_APT_RECOMMENDS}" = "true" ] - then - rm -f chroot/etc/apt/apt.conf.d/00recommends - fi - - # Deconfiguring aptitude secure - if [ "${LB_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_apt/*.pref - then - for _FILE in config/chroot_apt/*.pref - do - if [ -f chroot/etc/apt/preferences.d/$(basename ${_FILE}) ] - then - mv chroot/etc/apt/preferences.d/$(basename ${_FILE}) chroot/etc/apt/preferences.d/$(basename ${_FILE}).orig - fi - - cp -aL ${_FILE} chroot/etc/apt/preferences.d - - if [ -f chroot/etc/apt/preferences.d/$(basename ${_FILE}) ] - then - mv chroot/etc/apt/preferences.d/$(basename ${_FILE}).orig chroot/etc/apt/preferences.d/$(basename ${_FILE}) - fi - done - fi - - if Find_files config/packages.chroot/*.deb || Find_files config/packages/*.deb - then - if [ -f chroot/etc/apt/preferences ] - then - # delete additions from lb_chroot_apt install|install-binary to preferences - sed -i '/# Added by lb_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 - - # Remove temporary hack to avoid squashfs version mismatch for artax-backports - rm -f chroot/etc/apt/preferences.d/progress.tmp.pref - - # Removing stage file - rm -f .build/chroot_apt - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_chroot_archives b/scripts/build/lb_chroot_archives deleted file mode 100755 index d0033d29e..000000000 --- a/scripts/build/lb_chroot_archives +++ /dev/null @@ -1,901 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'manage /etc/apt/sources.list')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -_PASS="${1}" -shift - -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 .build/config .build/bootstrap - -_LB_LOCAL_KEY_EMAIL="live-build-local-key@invalid" - -# FIXME: this is ugly -if [ -n "${LIVE_BUILD}" ] -then - _BASE="${LIVE_BUILD}" -else - _BASE="/usr/share/live/build" -fi - -case "${LB_DERIVATIVE}" in - true) - _PARENT_FILE="sources.list.d/debian.list" - ;; - - false) - _PARENT_FILE="sources.list" - ;; -esac - -case "${1}" in - install) - Echo_message "Configuring file /etc/apt/sources.list" - - # Checking stage file - Check_stagefile .build/chroot_archives - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Restoring cache - Restore_cache cache/packages.chroot - - # Configure custom sources.list - -cat > chroot/etc/apt/${_PARENT_FILE} << EOF -deb ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS} -EOF - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_PARENT_MIRROR_CHROOT} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - fi - - if [ "${LB_DERIVATIVE}" = "true" ] - then - rm -f chroot/etc/apt/sources.list.d/${LB_MODE}.list - - _DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | sed -e 's|-backports||')" - - echo "deb ${LB_MIRROR_CHROOT} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_MIRROR_CHROOT} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - fi - fi - - if [ "${LB_SECURITY}" = "true" ] - then - case "${LB_MODE}" in - debian|progress) - case "${LB_PARENT_DISTRIBUTION}" in - sid) - - ;; - - *) - echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - fi - ;; - esac - - if [ "${LB_MODE}" = progress ] - then - echo "deb ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - fi - else - if [ "${LB_DERIVATIVE}" = "true" ] - then - echo "deb ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_MIRROR_CHROOT_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - fi - fi - fi - ;; - - ubuntu|kubuntu) - echo "deb ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_PARENT_MIRROR_CHROOT_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - fi - ;; - esac - fi - - if [ "${LB_VOLATILE}" = "true" ] - then - echo "deb ${LB_PARENT_MIRROR_CHROOT_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_PARENT_MIRROR_CHROOT_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - fi - - if [ "${LB_DERIVATIVE}" = "true" ] && [ "${LB_MIRROR_CHROOT_VOLATILE}" != "none" ] - then - echo "deb ${LB_MIRROR_CHROOT_VOLATILE} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_MIRROR_CHROOT_VOLATILE} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - fi - fi - fi - - if [ "${LB_BACKPORTS}" = "true" ] - then - case "${LB_MODE}" in - debian) - if [ "${LB_PARENT_DISTRIBUTION}" != "sid" ] - then - echo "deb ${LB_PARENT_MIRROR_CHROOT_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_PARENT_MIRROR_CHROOT_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - fi - fi - ;; - esac - - if [ "${LB_DERIVATIVE}" = "true" ] && [ "${LB_MIRROR_CHROOT_BACKPORTS}" != "none" ] - then - echo "deb ${LB_MIRROR_CHROOT_BACKPORTS} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_MIRROR_CHROOT_BACKPORTS} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - fi - fi - fi - - # probably too bold, needs refinment (FIXME) - rm -f chroot/etc/apt/preferences.d/* - - # Configure third-party archives - if [ -n "${LB_ARCHIVES}" ] - then - for REPOSITORY in ${LB_ARCHIVES} - do - # ubuntu workaround to allow using live.debian.net - case "${LB_MODE}" in - ubuntu|kubuntu) - if [ "${REPOSITORY}" = "live.debian.net" ] - then - _DISTRIBUTION="sid" - else - _DISTRIBUTION="${LB_PARENT_DISTRIBUTION}" - fi - ;; - - *) - _DISTRIBUTION="${LB_PARENT_DISTRIBUTION}" - ;; - esac - - # Prefer archives from the config tree - # over the global ones. - if ! ls "${_BASE}/archives/${REPOSITORY}"* > /dev/null 2>&1 - then - continue - fi - - # Adding sources.list entries (chroot) - if [ -e "${_BASE}/archives/${REPOSITORY}.chroot" ] - then - sed -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \ - -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ - "${_BASE}/archives/${REPOSITORY}.chroot" > \ - "chroot/etc/apt/sources.list.d/${REPOSITORY}.list" - elif [ -e "${_BASE}/archives/${REPOSITORY}" ] - then - sed -e "s|@DISTRIBUTION@|${_DISTRIBUTION}|g" \ - -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ - "${_BASE}/archives/${REPOSITORY}" > \ - "chroot/etc/apt/sources.list.d/${REPOSITORY}.list" - fi - - # Adding pinning preferences (chroot) - if [ -e "${_BASE}/archives/${REPOSITORY}.pref" ] - then - cp "${_BASE}/archives/${REPOSITORY}.pref" chroot/etc/apt/sources.list.d - elif [ -e "${_BASE}/archives/${REPOSITORY}.pref.chroot" ] - then - cp "${_BASE}/archives/${REPOSITORY}.pref.chroot" "chroot/etc/apt/sources.list.d/${REPOSITORY}.pref" - fi - - if [ "${LB_APT_SECURE}" != false ] - then - # Adding archive signing keys (chroot) - if [ -e "${_BASE}/archives/${REPOSITORY}.key.chroot" ] - then - cat "${_BASE}/archives/${REPOSITORY}.key.chroot" | Chroot chroot "apt-key add -" - elif [ -e "${_BASE}/archives/${REPOSITORY}.key" ] - then - cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -" - fi - fi - done - fi - - # Check local sources.list - if Find_files config/archives/*.list || \ - Find_files config/archives/*.list.chroot - then - for FILE in config/archives/*.list \ - config/archives/*.list.chroot - do - if [ -e "${FILE}" ] - then - sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \ - -e "s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \ - -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ - -e "s|@PARENT_ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ - "${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)" - - if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" = "false" ] - then - # Strip out source archives - sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .chroot)" - fi - fi - done - fi - - # Check local pinning preferences - if Find_files config/archives/*.pref || \ - Find_files config/archives/*.pref.chroot - then - for FILE in config/archives/*.pref \ - config/archives/*.pref.chroot - do - if [ -e "${FILE}" ] - then - cp config/archives/$(basename ${_FILE} .chroot) chroot/etc/apt/preferences.d - fi - done - fi - - # Configure local package repository - if Find_files config/packages.chroot/*.deb || Find_files config/packages/*.deb - then - rm -rf chroot/root/packages - mkdir -p chroot/root/packages - - if [ "$(stat --printf %d config/packages.chroot)" = "$(stat --printf %d chroot/root/packages)" ] || - [ "$(stat --printf %d config/packages)" = "$(stat --printf %d chroot/root/packages)" ] - then - CP_OPTIONS="-l" - fi - - # Copy packages - if Find_files config/packages.chroot/*_"${LB_ARCHITECTURES}".deb || Find_files config/packages/*_"${LB_ARCHITECTURES}".deb - then - for FILE in config/packages.chroot/*_"${LB_ARCHITECTURES}".deb config/packages/*_"${LB_ARCHITECTURES}".deb - do - if [ -L "${FILE}" ] - then - cp -L "${FILE}" chroot/root/packages - elif [ -e "${FILE}" ] - then - cp ${CP_OPTIONS} "${FILE}" chroot/root/packages - fi - done - fi - - if Find_files config/packages.chroot/*_all.deb || Find_files config/packages/*_all.deb - then - for FILE in config/packages.chroot/*_all.deb config/packages/*_all.deb - do - if [ -L "${FILE}" ] - then - cp -L "${FILE}" chroot/root/packages - elif [ -e "${FILE}" ] - then - cp ${CP_OPTIONS} "${FILE}" chroot/root/packages - fi - done - fi - - if Find_files chroot/root/packages/*.deb - then - # If we bootstrapped a minimal chroot, we need - # to install apt-utils before we have - # completed all the indices. - if [ ! -e chroot/usr/bin/apt-ftparchive ] - then - Apt chroot update - fi - - # Check depends - Check_package chroot/usr/bin/apt-ftparchive apt-utils - - # Installing depends - Install_package - - # Generate Packages and Packages.gz - echo "cd /root/packages && apt-ftparchive packages . > Packages" | Chroot chroot sh - gzip -9 -c chroot/root/packages/Packages > chroot/root/packages/Packages.gz - - # Generate Release - echo "cd /root/packages && apt-ftparchive \ - -o APT::FTPArchive::Release::Origin=config/packages.chroot \ - release . > Release" | Chroot chroot sh - - if [ "${LB_APT_SECURE}" = "true" ] - then - _LB_DOTGNUPG_EXISTED=0 - if [ -d chroot/root/.gnupg ] - then - _LB_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. - if [ -e chroot/dev/random ] - then - mv chroot/dev/random chroot/dev/random.orig - cp -a chroot/dev/urandom chroot/dev/random - fi - - 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-build local packages key - Name-Email: ${_LB_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" || _LB_RET=${?} - - case "${_LB_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" "${_LB_RET}" - exit ${_LB_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/packages/Release.gpg /root/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 ${_LB_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 - if [ -e chroot/dev/random.orig ] - then - mv chroot/dev/random.orig chroot/dev/random - fi - - # Remove /root/.gnupg if we created it during the signing process - if [ "${_LB_DOTGNUPG_EXISTED}" -eq 0 ] - then - rm -rf chroot/root/.gnupg - fi - fi - - # Add to sources.list.d - echo "deb file:/root/packages ./" > chroot/etc/apt/sources.list.d/packages.list - - # Move top-level sources away, otherwise apt always preferes it (#644148) - if [ -e chroot/etc/apt/sources.list ] - then - mv chroot/etc/apt/sources.list chroot/etc/apt/sources.list.d/zz-sources.list - fi - - # Removing depends - Remove_package - else - Echo_warning "Local packages must be named with suffix '_all.deb' or '_\$architecture.deb'." - fi - fi - - if Find_files chroot/root/packages/*.deb - then - gunzip < chroot/root/packages/Packages.gz | awk '/^Package: / { print $2 }' \ - >> chroot/root/packages.chroot - fi - - # Update indices from cache - if [ "${LB_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 -rf 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 [ "${LB_APT}" = "aptitude" ] && [ ! -x /usr/bin/aptitude ] - then - Chroot chroot "apt-get ${APT_OPTIONS} update" - Chroot chroot "apt-get ${APT_OPTIONS} install aptitude" - fi - else # Get fresh indices - # Check local archive keys - if Find_files config/archives/*.key || \ - Find_files config/archives/*.key.chroot - then - for FILE in config/archives/*.key \ - config/archives/*.key.chroot - do - if [ -e "${FILE}" ] - then - cp ${FILE} chroot/root - Chroot chroot "apt-key add /root/$(basename ${FILE})" - rm -f chroot/root/$(basename ${FILE}) - fi - done - fi - - # Check local keyring packages - if Find_files config/archives/*.deb - then - for PACKAGE in config/archives/*.deb - do - cp ${PACKAGE} chroot/root - Chroot chroot "dpkg -i /root/$(basename ${PACKAGE})" - rm -f chroot/root/$(basename ${PACKAGE}) - done - fi - - # Installing aptitude (FIXME) - if [ "${LB_APT}" = "aptitude" ] && [ ! -x /usr/bin/aptitude ] - then - Chroot chroot "apt-get ${APT_OPTIONS} update" - Chroot chroot "apt-get ${APT_OPTIONS} install aptitude" - fi - - # Rebuild apt indices from scratch. - # Due to the fact that apt doesn't understand - # pinning on the fly, we need to manually remove - # the cached indices and rebuild them again. - rm -rf chroot/var/cache/apt/*.bin - - Apt chroot update - - # Installing keyring packages - if [ -n "${LB_KEYRING_PACKAGES}" ] - then - if [ "${LB_DERIVATIVE}" = "true" ] - then - # Temporary hack (FIXME) - Chroot chroot "apt-get ${APT_OPTIONS} --force-yes install ${LB_KEYRING_PACKAGES}" - else - Apt chroot "install ${LB_KEYRING_PACKAGES}" - fi - fi - - rm -rf chroot/var/cache/apt/*.bin - - Apt chroot update - Apt chroot "upgrade" - Apt chroot "dist-upgrade" - - if [ "${LB_CACHE_INDICES}" = "true" ] - then - mkdir -p cache/indices.bootstrap - - if Find_files chroot/etc/apt/secring.gpg* - then - cp -f chroot/etc/apt/secring.gpg* cache/indices.bootstrap - fi - - cp -rf 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 - - # Saving cache - Save_cache cache/packages.chroot - - # Creating stage file - Create_stagefile .build/chroot_archives - ;; - - remove) - Echo_message "Deconfiguring file /etc/apt/sources.list" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Restore top-level sources - if [ -e chroot/etc/apt/sources.list.d/zz-sources.list ] - then - mv chroot/etc/apt/sources.list.d/zz-sources.list chroot/etc/apt/sources.list - fi - - # Configure generic indices - # Don't do anything if it's not required - if [ "${LB_PARENT_MIRROR_CHROOT}" = "${LB_PARENT_MIRROR_BINARY}" ] && \ - [ "${LB_PARENT_MIRROR_CHROOT_SECURITY}" = "${LB_PARENT_MIRROR_BINARY_SECURITY}" ] && \ - [ ! -d chroot/root/packages ] - then - # Removing stage file - rm -f .build/chroot_archives - - exit 0 - fi - - # Cleaning apt list cache - rm -rf chroot/var/lib/apt/lists - mkdir -p chroot/var/lib/apt/lists/partial - - # Configure custom sources.list - -cat > chroot/etc/apt/${_PARENT_FILE} << EOF -deb ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS} -EOF - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_PARENT_MIRROR_BINARY} ${LB_PARENT_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - fi - - if [ "${LB_DERIVATIVE}" = "true" ] - then - rm -f chroot/etc/apt/sources.list.d/${LB_MODE}.list - - _DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | sed -e 's|-backports||')" - - echo "deb ${LB_MIRROR_BINARY} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_MIRROR_BINARY} ${_DISTRIBUTION} ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - fi - fi - - if [ "${LB_SECURITY}" = "true" ] - then - case "${LB_MODE}" in - debian|progress) - case "${LB_PARENT_DISTRIBUTION}" in - sid) - - ;; - - *) - echo "deb ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}/updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - fi - ;; - esac - - if [ "${LB_MODE}" = progress ] - then - echo "deb ${LB_MIRROR_BINARY_SECURITY} ${_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_MIRROR_BINARY_SECURITY} ${_DISTRIBUTION}-security ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - fi - else - if [ "${LB_DERIVATIVE}" = "true" ] - then - echo "deb ${LB_MIRROR_BINARY_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_MIRROR_BINARY_SECURITY} ${_DISTRIBUTION}/updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - fi - fi - fi - ;; - - ubuntu|kubuntu) - echo "deb ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_PARENT_MIRROR_BINARY_SECURITY} ${LB_PARENT_DISTRIBUTION}-security ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - fi - ;; - esac - fi - - if [ "${LB_VOLATILE}" = "true" ] - then - echo "deb ${LB_PARENT_MIRROR_BINARY_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_PARENT_MIRROR_BINARY_VOLATILE} ${LB_PARENT_DISTRIBUTION}-updates ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - fi - - if [ "${LB_DERIVATIVE}" = "true" ] && [ "${LB_MIRROR_BINARY_VOLATILE}" != "none" ] - then - echo "deb ${LB_MIRROR_BINARY_VOLATILE} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_MIRROR_BINARY_VOLATILE} ${_DISTRIBUTION}-updates ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - fi - fi - fi - - if [ "${LB_BACKPORTS}" = "true" ] - then - case "${LB_MODE}" in - debian) - if [ "${LB_PARENT_DISTRIBUTION}" != "sid" ] - then - echo "deb ${LB_PARENT_MIRROR_BINARY_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_PARENT_MIRROR_BINARY_BACKPORTS} ${LB_PARENT_DISTRIBUTION}-backports ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/etc/apt/${_PARENT_FILE} - fi - fi - ;; - esac - - if [ "${LB_DERIVATIVE}" = "true" ] && [ "${LB_MIRROR_BINARY_BACKPORTS}" != "none" ] - then - echo "deb ${LB_MIRROR_BINARY_BACKPORTS} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - - if [ "${_PASS}" = "source" ] || [ "${LB_APT_SOURCE_ARCHIVES}" = "true" ] - then - echo "deb-src ${LB_MIRROR_BINARY_BACKPORTS} ${_DISTRIBUTION}-backports ${LB_ARCHIVE_AREAS}" >> chroot/etc/apt/sources.list.d/${LB_MODE}.list - fi - fi - fi - - # probably too bold, needs refinment (FIXME) - rm -f chroot/etc/apt/preferences.d/* - - # Configure third-party archives - if [ -n "${LB_ARCHIVES}" ] - then - for REPOSITORY in ${LB_ARCHIVES} - do - # Removing sources.list entries (chroot) - rm -f "chroot/etc/apt/sources.list.d/${REPOSITORY}.list" - - # Prefer archives from the config tree - # over the global ones. - if ! ls "${_BASE}/archives/${REPOSITORY}"* > /dev/null 2>&1 - then - continue - fi - - # Adding sources.list entries (binary) - if [ -e "${_BASE}/archives/${REPOSITORY}.binary" ] - then - sed -e "s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ - -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ - "${_BASE}/archives/${REPOSITORY}.binary" > \ - "chroot/etc/apt/sources.list.d/${REPOSITORY}.list" - elif [ -e "${_BASE}/archives/${REPOSITORY}" ] - then - sed -e "s|@DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ - -e "s|@ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ - "${_BASE}/archives/${REPOSITORY}" > \ - "chroot/etc/apt/sources.list.d/${REPOSITORY}.list" - fi - - # Adding pinning preferences (binary) - if [ -e "${_BASE}/archives/${REPOSITORY}.pref" ] - then - cp "${_BASE}/archives/${REPOSITORY}.pref" chroot/etc/apt/sources.list.d - elif [ -e "${_BASE}/archives/${REPOSITORY}.pref.binary" ] - then - cp "${_BASE}/archives/${REPOSITORY}.pref.binary" "chroot/etc/apt/sources.list.d/${REPOSITORY}.pref" - fi - - if [ "${LB_APT_SECURE}" != false ] - then - # Adding archive signing keys (binary) - if [ -e "${_BASE}/archives/${REPOSITORY}.key.binary" ] - then - cat "${_BASE}/archives/${REPOSITORY}.key.binary" | Chroot chroot "apt-key add -" - elif [ -e "${_BASE}/archives/${REPOSITORY}.key" ] - then - cat "${_BASE}/archives/${REPOSITORY}.key" | Chroot chroot "apt-key add -" - fi - fi - done - fi - - # Check local sources.list - if Find_files config/archives/*.list || \ - Find_files config/archives/*.list.binary - then - for FILE in config/archives/*.list \ - config/archives/*.list.binary - do - if [ -e "${FILE}" ] - then - sed -e "s|@DISTRIBUTION@|${LB_DISTRIBUTION}|g" \ - -e "s|@ARCHIVE_AREAS@|${LB_ARCHIVE_AREAS}|g" \ - -e "s|@PARENT_DISTRIBUTION@|${LB_PARENT_DISTRIBUTION}|g" \ - -e "s|@PARENT_ARCHIVE_AREAS@|${LB_PARENT_ARCHIVE_AREAS}|g" \ - "${FILE}" > "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)" - - if [ "${_PASS}" != "source" ] && [ "${LB_APT_SOURCE_ARCHIVES}" = "false" ] - then - # Strip out source archives - sed "/^deb-src /d" "chroot/etc/apt/sources.list.d/$(basename ${FILE} .binary)" - fi - fi - done - fi - - # Check local pinning preferences - if Find_files config/archives/*.pref || \ - Find_files config/archives/*.pref.binary - then - for FILE in config/archives/*.pref \ - config/archives/*.pref.binary - do - if [ -e "${FILE}" ] - then - cp config/archives/$(basename ${_FILE} .binary) chroot/etc/apt/preferences.d - fi - done - fi - - # Check local archive keys - if Find_files config/archives/*.key || \ - Find_files config/archives/*.key.binary - then - for FILE in config/archives/*.key \ - config/archives/*.key.binary - do - if [ -e "${FILE}" ] - then - cp ${FILE} chroot/root - Chroot chroot "apt-key add /root/$(basename ${FILE})" - rm -f chroot/root/$(basename ${FILE}) - fi - done - fi - - # Updating indices - Apt chroot update - - # Cleaning apt package cache - rm -rf chroot/var/cache/apt - mkdir -p chroot/var/cache/apt/archives/partial - - # Cleaning apt package lists - if [ "${LB_APT_INDICES}" = "false" ] - then - rm -rf chroot/var/lib/apt/lists - mkdir -p chroot/var/lib/apt/lists/partial - fi - - # Remove local package repository - rm -f chroot/etc/apt/sources.list.d/packages.list - rm -rf chroot/root/packages - - # Remove local packages key if it exists - if apt-key list | grep -q ${_LB_LOCAL_KEY_EMAIL} - then - apt-key del ${_LB_LOCAL_KEY_EMAIL} - fi - - # Removing stage file - rm -f .build/chroot_archives - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_chroot_cache b/scripts/build/lb_chroot_cache deleted file mode 100755 index 4c4b055bf..000000000 --- a/scripts/build/lb_chroot_cache +++ /dev/null @@ -1,92 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 - -for STAGE in ${LB_CACHE_STAGES} -do - if [ "${STAGE}" = "chroot" ] - then - case "${1}" in - restore) - Echo_message "Restoring chroot stage from cache..." - - # Checking stage file - Check_stagefile .build/chroot_cache.restore - - if [ -d cache/chroot ] - then - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Removing old chroot - rm -rf chroot - - # Restoring old cache - ${LB_ROOT_COMMAND} cp -a cache/chroot chroot - - if [ -n "${LB_ROOT_COMMAND}" ] - then - ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) chroot - fi - - # Creating stage file - Create_stagefile .build/chroot_cache.restore - - exit 0 - fi - ;; - - save) - Echo_message "Saving chroot stage to cache..." - - # Checking stage file - Check_stagefile .build/chroot_cache.save - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - rm -rf cache/chroot - - mkdir -p cache - - ${LB_ROOT_COMMAND} cp -a chroot cache/chroot - - if [ -n "${LB_ROOT_COMMAND}" ] - then - ${LB_ROOT_COMMAND} chown -R $(whoami):$(whoami) cache/chroot - fi - - # Creating stage file - Create_stagefile .build/chroot_cache.save - ;; - esac - fi -done diff --git a/scripts/build/lb_chroot_debianchroot b/scripts/build/lb_chroot_debianchroot deleted file mode 100755 index 7e07b3655..000000000 --- a/scripts/build/lb_chroot_debianchroot +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /etc/debian_chroot" - - # Checking stage file - Check_stagefile .build/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 .build/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 .build/chroot_debianchroot - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_chroot_devpts b/scripts/build/lb_chroot_devpts deleted file mode 100755 index 428927f06..000000000 --- a/scripts/build/lb_chroot_devpts +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'mount /dev/pts')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Ensure that a system is built as root -lb 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 .build/config .build/bootstrap - -case "${1}" in - install) - Echo_message "Begin mounting /dev/pts..." - - # Checking stage file - Check_stagefile .build/chroot_devpts - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LB_USE_FAKEROOT}" != "true" ] - then - # Creating mountpoint - mkdir -p chroot/dev/pts - - # Mounting /dev/pts - ${LB_ROOT_COMMAND} mount devpts-live -t devpts chroot/dev/pts || true - fi - - # Creating stage file - Create_stagefile .build/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 [ "${LB_USE_FAKEROOT}" != "true" ] - then - if grep -qs "$(pwd)/chroot/dev/pts" /proc/mounts || Find_files chroot/dev/pts/* - then - ${LB_ROOT_COMMAND} umount chroot/dev/pts - else - ${LB_ROOT_COMMAND} umount -f chroot/dev/pts > /dev/null 2>&1 || true - fi - fi - - # Removing stage file - rm -f .build/chroot_devpts - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_chroot_dpkg b/scripts/build/lb_chroot_dpkg deleted file mode 100755 index 9698f7923..000000000 --- a/scripts/build/lb_chroot_dpkg +++ /dev/null @@ -1,122 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /sbin/start-stop-daemon" - - # Checking stage file - Check_stagefile .build/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 - - # Disable dpkg syncing - -cat > chroot/etc/dpkg/dpkg.cfg.d/live-build << EOF -force-unsafe-io -EOF - - # Manual hacks for special packages - - # samhain - if [ -e /var/state/samhain/samhain_file ] - then - mv /var/state/samhain/samhain_file /var/state/samhain/samhain_file.orig - else - mkdir -p /var/state/samhain - touch /var/state/samhain/samhain_file - fi - - # flash-kernel - Chroot chroot dpkg-divert --rename --quiet --add /usr/sbin/flash-kernel - ln -s /bin/true chroot/usr/sbin/flash-kernel - - # Creating stage file - Create_stagefile .build/chroot_dpkg - ;; - - remove) - Echo_message "Deconfiguring file /sbin/start-stop-daemon" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Manual hacks for special packages - - # flash-kernel - rm -f chroot/usr/sbin/flash-kernel - Chroot chroot dpkg-divert --rename --quiet --remove /usr/sbin/flash-kernel - - # samhain - if [ -e /var/state/samhain/samhain_file.orig ] - then - mv /var/state/samhain/samhain_file.orig /var/state/samhain/samhain_file - elif [ -d /var/state/samhain ] - then - rm -f /var/state/samhain/samhain_file - rmdir --ignore-fail-on-non-empty /var/state/samhain || true - fi - - # 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 - - # Remove dpkg sync configuration - rm -f chroot/etc/dpkg/dpkg.cfg.d/live-build - - # Removing stage file - rm -f .build/chroot_dpkg - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_chroot_hacks b/scripts/build/lb_chroot_hacks deleted file mode 100755 index f0e885b08..000000000 --- a/scripts/build/lb_chroot_hacks +++ /dev/null @@ -1,309 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/chroot_hacks - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -case "${LB_PARENT_DISTRIBUTION}" in - squeeze) - if echo "${LB_TASKS}" | grep -qs lxde || - echo "${LB_TASKS}" | grep -qs xfce - then - GDM="gdm" - else - GDM="gdm3" - fi - ;; - - *) - GDM="gdm3" - ;; -esac - -# Handling default desktop configuration -case "${LB_MODE}" in - debian*) - # disable kexec-tools - if [ -e chroot/sbin/kexec ] - then - echo "kexec-tools kexec-tools/load_kexec boolean false" > chroot/root/preseed - Chroot chroot "debconf-set-selections /root/preseed" - rm -f chroot/root/preseed - Chroot chroot "dpkg-reconfigure kexec-tools" - fi - ;; -esac - -for TASK in ${LB_TASKS} -do - case "${TASK}" in - gnome-desktop) - # gnome is the only desktop environment in this image - if [ -z "$(echo ${LB_TASKS} | sed -e 's|gnome-desktop||' -e 's| desktop ||' | grep desktop)" ] - then - # set display manager - echo "${GDM} shared/default-x-display-manager select ${GDM}" > chroot/root/preseed - Chroot chroot "debconf-set-selections /root/preseed" - rm -f chroot/root/preseed - Chroot chroot "dpkg-reconfigure ${GDM}" - echo "/usr/bin/${GDM}" > chroot/etc/X11/default-display-manager - - # set session manager - Chroot chroot "update-alternatives --set x-session-manager /usr/bin/gnome-session" - fi - ;; - - kde-desktop) - # kde is the only desktop-environment in this image - if [ -z "$(echo ${LB_TASKS} | sed -e 's|kde-desktop||' -e 's| desktop ||' | grep desktop)" ] - then - # set display manager - echo "kdm shared/default-x-display-manager select kdm" > chroot/root/preseed - Chroot chroot "debconf-set-selections /root/preseed" - rm -f chroot/root/preseed - Chroot chroot "dpkg-reconfigure kdm" - echo "/usr/bin/kdm" > chroot/etc/X11/default-display-manager - - # set session manager - Chroot chroot "update-alternatives --set x-session-manager /usr/bin/startkde" - - # get rid of resolvconf - Chroot chroot "dpkg -P resolvconf" - fi - ;; - - lxde-desktop) - # lxde is the only desktop environment in this image - if [ -z "$(echo ${LB_TASKS} | sed -e 's|lxde-desktop||' -e 's| desktop ||' | grep desktop)" ] - then - # set display manager - echo "${GDM} shared/default-x-display-manager select ${GDM}" > chroot/root/preseed - Chroot chroot "debconf-set-selections /root/preseed" - rm -f chroot/root/preseed - Chroot chroot "dpkg-reconfigure ${GDM}" - echo "/usr/bin/${GDM}" > chroot/etc/X11/default-display-manager - - # set session manager - Chroot chroot "update-alternatives --set x-session-manager /usr/bin/startlxde" - fi - ;; - - xfce-desktop) - # xfce is the only desktop environment in this image - if [ -z "$(echo ${LB_TASKS} | sed -e 's|xfce-desktop||' -e 's| desktop ||' | grep desktop)" ] - then - # set display manager - echo "${GDM} shared/default-x-display-manager select ${GDM}" > chroot/root/preseed - Chroot chroot "debconf-set-selections /root/preseed" - rm -f chroot/root/preseed - Chroot chroot "dpkg-reconfigure ${GDM}" - echo "/usr/bin/${GDM}" > chroot/etc/X11/default-display-manager - - # set session manager - Chroot chroot "update-alternatives --set x-session-manager /usr/bin/xfce4-session" - fi - ;; - esac -done - -case "${LB_BINARY_IMAGES}" in - netboot) - if [ ! -f chroot/sbin/mount.cifs ] - then - Apt chroot install cifs-utils - fi - - if [ ! -d chroot/etc/initramfs-tools ] - then - mkdir chroot/etc/initramfs-tools - fi - - # Configuring initramfs for NFS - if ! grep -qs "BOOT=nfs" chroot/etc/initramfs-tools/initramfs.conf - then - echo "BOOT=nfs" >> chroot/etc/initramfs-tools/initramfs.conf - fi - - if ! grep -qs "NFSROOT=auto" chroot/etc/initramfs-tools/initramfs.conf - then - echo "NFSROOT=auto" >> chroot/etc/initramfs-tools/initramfs.conf - fi - ;; -esac - -# Update initramfs (always, because of udev rules in initrd) -case "${LB_INITRAMFS}" in - casper) - UPDATE_INITRAMFS_OPTIONS="CASPER_GENERATE_UUID=1" - ;; - - live-boot) - #UPDATE_INITRAMFS_OPTIONS="LIVE_GENERATE_UUID=1" - ;; -esac - -if [ "${LB_INITRAMFS}" != "none" ] -then - Chroot chroot "${UPDATE_INITRAMFS_OPTIONS} update-initramfs -k all -t -u" -fi - -# We probably ought to use COMPRESS= in a temporary file in -# /etc/initramfs-tools/conf.d/ instead, but it's hard to pass options that -# way. -case "${LB_INITRAMFS_COMPRESSION}" in - gzip) - ;; - - bzip2) - for INITRAMFS in $(find chroot/boot -name 'initrd*'); do - zcat "${INITRAMFS}" | bzip2 -c ${BZIP2_OPTIONS} > "${INITRAMFS}.new" - mv "${INITRAMFS}.new" "${INITRAMFS}" - done - ;; - - lzma) - # We probably ought to use COMPRESS= in a temporary file in - # /etc/initramfs-tools/conf.d/ instead, but it's hard to - # pass options that way. - for INITRAMFS in $(find chroot/boot -name 'initrd*'); do - zcat "${INITRAMFS}" | lzma -c ${LZMA_OPTIONS} > "${INITRAMFS}.new" - mv "${INITRAMFS}.new" "${INITRAMFS}" - done - ;; -esac - -# Ensure readable permissions on initramfs. loop-aes-utils sets umask to -# protect GPG keys, which live-build 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 -rm -f chroot/var/log/apt/term.log - -# Delete and re-create temporary directories -TEMP_DIRS="/tmp /var/tmp" -for DIR in ${TEMP_DIRS} -do - rm -rf "chroot/${DIR}" - install -d -m 1777 "chroot/${DIR}" -done - -if [ -n "${LB_ROOT_COMMAND}" ] -then - ${LB_ROOT_COMMAND} chown -R --quiet $(whoami):$(whoami) chroot -fi - -case "${LB_INITRAMFS}" in - casper) - ID="999" - ;; - - live-boot) - ID="1000" - ;; - - *) - ID="" - ;; -esac - -if [ "${LB_DEBIAN_INSTALLER}" = "live" ] -then - # This is a temporary hack to get rid of fstab; - # needs cleanup in live-boot first to proper fix. - rm -f chroot/etc/fstab - touch chroot/etc/fstab -fi - -if [ "${LB_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 - -if [ "${LB_SWAP_FILE_PATH}" ]; then - dd if=/dev/zero of="chroot/${LB_SWAP_FILE_PATH}" bs=1024k count="${LB_SWAP_FILE_SIZE}" - mkswap "chroot/${LB_SWAP_FILE_PATH}" -fi - -# Creating stage file -Create_stagefile .build/chroot_hacks diff --git a/scripts/build/lb_chroot_hooks b/scripts/build/lb_chroot_hooks deleted file mode 100755 index b81e3cb24..000000000 --- a/scripts/build/lb_chroot_hooks +++ /dev/null @@ -1,115 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/chroot_hooks - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -## Processing distribution hooks - -# Make build config available to chroot hooks. First, make the bind -# mount and then make it read-only. This can't happen in one mount -# command, then the resulting mount will be rw (see mount(8)). Making it -# ro prevents modifications and prevents accidentally removing the -# contents of the config directory when removing the chroot. -mkdir -p chroot/root/config -mount -o bind config chroot/root/config -mount -o remount,ro,bind config chroot/root/config - -# Copying hooks -for _HOOK in ${LB_CHROOT_HOOKS} -do - for LOCATION in "${LIVE_BUILD}/hooks" /usr/share/live/build/hooks - do - for FILE in "${LOCATION}"/???-"${_HOOK}".chroot - do - if [ -e "${FILE}" ] - then - mkdir -p chroot/root/lb_chroot_hooks - cp "${FILE}" chroot/root/lb_chroot_hooks - fi - done - done -done - -# Running hooks -if ls chroot/root/lb_chroot_hooks/* > /dev/null 2>&1 -then - for _HOOK in chroot/root/lb_chroot_hooks/* - do - Chroot chroot "/root/lb_chroot_hooks/$(basename ${_HOOK})" || { Echo_error "${_HOOK} failed (exit non-zero). You should check for errors."; exit 1 ;} - rm -f chroot/root/lb_chroot_hooks/"$(basename ${_HOOK})" - done - - rmdir chroot/root/lb_chroot_hooks -fi - -## Processing local hooks - -if Find_files config/hooks/*.chroot -then - # Restoring cache - Restore_cache cache/packages.chroot - - for _HOOK in config/hooks/*.chroot - 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 .build/chroot_hooks -fi - -# Remove bind mount of build config inside chroot. -umount chroot/root/config -rmdir chroot/root/config - diff --git a/scripts/build/lb_chroot_hostname b/scripts/build/lb_chroot_hostname deleted file mode 100755 index 9f56901e4..000000000 --- a/scripts/build/lb_chroot_hostname +++ /dev/null @@ -1,95 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /etc/hostname" - - # Checking stage file - Check_stagefile .build/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 .build/chroot_hostname - ;; - - remove) - Echo_message "Deconfiguring file /etc/hostname" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - # Copying hostname from includes, if existing - if [ -e config/includes.chroot/etc/hostname ] - then - cp -a config/includes.chroot/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 .build/chroot_hostname - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_chroot_hosts b/scripts/build/lb_chroot_hosts deleted file mode 100755 index 3adaebfe4..000000000 --- a/scripts/build/lb_chroot_hosts +++ /dev/null @@ -1,98 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /etc/hosts" - - # Checking stage file - Check_stagefile .build/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 .build/chroot_hosts - ;; - - remove) - Echo_message "Deconfiguring file /etc/hosts" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ -e config/includes.chroot/etc/hosts ] - then - # Copying local hosts - cp -a config/includes.chroot/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 .build/chroot_hosts - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_chroot_includes b/scripts/build/lb_chroot_includes deleted file mode 100755 index 8d3c75eee..000000000 --- a/scripts/build/lb_chroot_includes +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'copy 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 includes..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/includes.chroot - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if Find_files config/includes.chroot/ -then - # Copying includes - cd config/includes.chroot - find . | cpio -dmpu --no-preserve-owner "${OLDPWD}"/chroot - cd "${OLDPWD}" - - # Creating stage file - Create_stagefile .build/chroot_includes -fi diff --git a/scripts/build/lb_chroot_install-packages b/scripts/build/lb_chroot_install-packages deleted file mode 100755 index d7d916496..000000000 --- a/scripts/build/lb_chroot_install-packages +++ /dev/null @@ -1,70 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'install queued packages into chroot')" -HELP="" -USAGE="${PROGRAM} [--force]" -USAGE="${PROGRAM} {install|live} [--force]" - -_PASS="${1}" -shift - -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 (${_PASS} pass)..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/chroot_install-packages.${PASS} - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ -e chroot/root/packages.chroot ] && [ -s chroot/root/packages.chroot ] -then - # Restoring cache - Restore_cache cache/packages.chroot - - # Installing packages - case "${LB_APT}" in - apt|apt-get) - Chroot chroot "xargs --arg-file=/root/packages.chroot apt-get ${APT_OPTIONS} install" - ;; - - aptitude) - Chroot chroot "xargs --arg-file=/root/packages.chroot aptitude ${APTITUDE_OPTIONS} install" - ;; - esac - - # Tidying up - rm -f chroot/root/packages.chroot - - # Saving cache - Save_cache cache/packages.chroot - -fi - -# Creating stage file -Create_stagefile .build/chroot_install-packages.${_PASS} diff --git a/scripts/build/lb_chroot_interactive b/scripts/build/lb_chroot_interactive deleted file mode 100755 index 31a34fc8a..000000000 --- a/scripts/build/lb_chroot_interactive +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_INTERACTIVE}" = "false" ] -then - exit 0 -fi - -Echo_message "Begin interactive build..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/chroot_interactive - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -case "${LB_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 .build/chroot_interactive diff --git a/scripts/build/lb_chroot_linux-image b/scripts/build/lb_chroot_linux-image deleted file mode 100755 index bb672c1d2..000000000 --- a/scripts/build/lb_chroot_linux-image +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'schedule kernel packages for installation')" -HELP="" -USAGE="${PROGRAM} [--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 .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/chroot_linux-image - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Diverting update-initramfs -#case "${LB_INITRAMFS}" in -# live-boot) -# mv chroot/usr/sbin/update-initramfs chroot/usr/sbin/update-initramfs.live-build -# ;; -#esac - -if [ "${LB_LINUX_PACKAGES}" != "none" ] -then - for FLAVOUR in ${LB_LINUX_FLAVOURS} - do - for PACKAGE in ${LB_LINUX_PACKAGES} - do - echo ${PACKAGE}-${FLAVOUR} >> chroot/root/packages.chroot - done - done - - # Include firmware packages - if [ "${LB_FIRMWARE_CHROOT}" = "true" ] - then - # Assumption: firmware packages install files into /lib/firmware - - # Get all firmware packages names - mkdir -p cache/contents.chroot - wget ${WGET_OPTIONS} ${LB_PARENT_MIRROR_CHROOT}/dists/${LB_PARENT_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz -O - | gunzip -c > cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES} - - FIRMWARE_PACKAGES="" - FIRMWARE_PACKAGES="$(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_PARENT_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)" - - if [ "${LB_DERIVATIVE}" = "true" ] - then - wget {WGET_OPTIONS} ${LB_MIRROR_CHROOT}/dists/${LB_DISTRIBUTION}/Contents-${LB_ARCHITECTURES}.gz -O - | gunzip -c > cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES} - - FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} $(awk '/^lib\/firmware/ { print $2 }' cache/contents.chroot/contents.${LB_DISTRIBUTION}.${LB_ARCHITECTURES} | sort -u)" - fi - - # Filter out contrib packages if contrib is not enabled - if ! echo ${LB_ARCHIVE_AREAS} | grep -qs contrib - then - _FIRMWARE_PACKAGES="" - - for _PACKAGE in ${FIRMWARE_PACKAGES} - do - _FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | sed -e 's|^contrib/.*$||')" - done - - FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES}" - fi - - # Filter out non-free packages if non-free is not enabled - if ! echo ${LB_ARCHIVE_AREAS} | grep -qs non-free - then - _FIRMWARE_PACKAGES="" - - for _PACKAGE in ${FIRMWARE_PACKAGES} - do - _FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES} $(echo ${_PACKAGE} | sed -e 's|^non-free/.*$||')" - done - - FIRMWARE_PACKAGES="${_FIRMWARE_PACKAGES}" - else - # Manually add firmware-linux/non-free meta package - FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} firmware-linux" - - # Manually add intel-microcode - FIRMWARE_PACKAGES="${FIRMWARE_PACKAGES} intel-microcode" - fi - - # Drop section and keep package names only - for _PACKAGE in ${FIRMWARE_PACKAGES} - do - echo $(echo ${_PACKAGE} | awk -F/ '{ print $NF }') >> chroot/root/packages.chroot - done - -# Some known licenses required to be accepted -cat >> chroot/root/packages.chroot.cfg << EOF -firmware-ivtv firmware-ivtv/license/accepted boolean true -firmware-ipw2x00 firmware-ipw2x00/license/accepted boolean true -EOF - - fi - - # Creating stage file - Create_stagefile .build/chroot_linux-image -fi diff --git a/scripts/build/lb_chroot_live-packages b/scripts/build/lb_chroot_live-packages deleted file mode 100755 index 057e423f6..000000000 --- a/scripts/build/lb_chroot_live-packages +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'schedule live packages for installation')" -HELP="" -USAGE="${PROGRAM} [--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 .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/chroot_live-packages - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Queue installation of live-boot -if [ -n "${LB_INITRAMFS}" ] && [ "${LB_INITRAMFS}" != "none" ] -then - _PACKAGES="${LB_INITRAMFS}" -fi - -# Queue installation of live-config -if [ -n "${LB_INITSYSTEM}" ] && [ "${LB_INITSYSTEM}" != "none" ] -then - _PACKAGES="${_PACKAGES} live-config live-config-${LB_INITSYSTEM}" -fi - -# Do initsystem specific hacks -if [ -n "${LB_INITSYSTEM}" ] && [ "${LB_INITSYSTEM}" != "sysvinit" ] -then - # lets see if we still need the squeeze's "pre init system policy discussion" hack: - IS_SYSVINIT_ESSENTIAL="$(Chroot chroot dpkg-query --show --showformat='${Essential}\n' sysvinit)" - RC="$?" - - if [ "${IS_SYSVINIT_ESSENTIAL}" != "no" ] && [ "${RC}" = "0" ] - then - # sysvinit is both installed and essential, ugly hack to remove it - Chroot chroot dpkg --force-remove-essential --remove sysvinit || true - fi -fi - -# Install live packages -if [ -n "${_PACKAGES}" ] -then - case "${LB_APT}" in - apt|apt-get) - Chroot chroot "apt-get ${APT_OPTIONS} install ${_PACKAGES}" - ;; - - aptitude) - Chroot chroot "aptitude ${APTITUDE_OPTIONS} install ${_PACKAGES}" - ;; - esac - - # Creating stage file - Create_stagefile .build/chroot_live-packages -fi diff --git a/scripts/build/lb_chroot_package-lists b/scripts/build/lb_chroot_package-lists deleted file mode 100755 index b85c00059..000000000 --- a/scripts/build/lb_chroot_package-lists +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'queue install of package lists into chroot')" -HELP="" -USAGE="${PROGRAM} {install|live} [--force]" - -_PASS="${1}" -shift - -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 package lists (${_PASS} pass)..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/chroot_package-lists.${_PASS} - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Handling local package lists -if ls config/package-lists/*.list > /dev/null 2>&1 || \ - ls config/package-lists/*.list.chroot > /dev/null 2>&1 || \ - ls config/package-lists/*.list.chroot_${_PASS} > /dev/null 2>&1 -then - # Checking depends - Check_package chroot/usr/bin/grep-aptavail dctrl-tools - - # Restoring cache - Restore_cache cache/packages.chroot - - # Installing depends - Install_package - - if [ -e "${LIVE_BUILD}/share/bin/Packages" ] - then - cp "${LIVE_BUILD}/share/bin/Packages" chroot/bin - else - cp /usr/share/live/build/bin/Packages chroot/bin - fi - - for LIST in config/package-lists/*.list \ - config/package-lists/*.list.chroot \ - config/package-lists/*.list.chroot_${_PASS} - do - if [ -e "${LIST}" ] - then - # Generating package list - Expand_packagelist "$(basename ${LIST})" "config/package-lists" \ - >> chroot/root/packages.chroot - fi - done - - rm -f chroot/bin/Packages - - # Removing dctrl-tools again if the user has not installed it - if ! grep -qs dctrl-tools chroot/root/packages.chroot - then - # Removing depends - Remove_package - fi - - # Saving cache - Save_cache cache/packages.binary - - # Creating stage file - Create_stagefile .build/chroot_package-lists.${_PASS} -fi diff --git a/scripts/build/lb_chroot_preseed b/scripts/build/lb_chroot_preseed deleted file mode 100755 index 1a70340d8..000000000 --- a/scripts/build/lb_chroot_preseed +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/chroot_preseed - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if ls config/preseed/*.preseed > /dev/null 2>&1 || \ - ls config/preseed/*.preseed.chroot > /dev/null 2>&1 || \ - ls chroot/root/packages.chroot.cfg > /dev/null 2>&1 -then - # Check dependency - Check_package chroot/usr/bin/debconf-set-selections debconf - - # Install dependency - Install_package - - for PRESEED in config/preseed/*.preseed config/preseed/*.preseed.chroot chroot/root/packages.chroot.cfg - do - if [ -e "${PRESEED}" ] - then - # Copying local preseed - cp "${PRESEED}" chroot/root/preseed - - Chroot chroot "debconf-set-selections /root/preseed" - - # Removing local preseed file - rm -f chroot/root/preseed - fi - done - - rm -f chroot/root/packages.chroot.cfg - - # Remove dependency - Remove_package - - # Creating stage file - Create_stagefile .build/chroot_preseed -fi diff --git a/scripts/build/lb_chroot_proc b/scripts/build/lb_chroot_proc deleted file mode 100755 index 2c13fceb1..000000000 --- a/scripts/build/lb_chroot_proc +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'mount /proc')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Ensure that a system is built as root -lb 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 .build/config .build/bootstrap - -case "${1}" in - install) - Echo_message "Begin mounting /proc..." - - # Checking stage file - Check_stagefile .build/chroot_proc - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LB_USE_FAKEROOT}" != "true" ] - then - # Creating mountpoint - mkdir -p chroot/proc - - # Mounting /proc - ${LB_ROOT_COMMAND} mount proc-live -t proc chroot/proc - else - rm -rf chroot/proc - ln -s /proc chroot/ - fi - - # Creating stage file - Create_stagefile .build/chroot_proc - ;; - - remove) - Echo_message "Begin unmounting /proc..." - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LB_USE_FAKEROOT}" != "true" ] - then - # Workaround binfmt-support /proc locking - if [ -e chroot/proc/sys/fs/binfmt_misc/status ] - then - ${LB_ROOT_COMMAND} umount chroot/proc/sys/fs/binfmt_misc - fi - - # Unmounting /proc - #fuser -km chroot/proc - if [ -e chroot/proc/version ] - then - ${LB_ROOT_COMMAND} umount chroot/proc - fi - else - rm -rf chroot/proc - mkdir -p chroot/proc - fi - - # Removing stage file - rm -f .build/chroot_proc - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_chroot_resolv b/scripts/build/lb_chroot_resolv deleted file mode 100755 index b82e3667a..000000000 --- a/scripts/build/lb_chroot_resolv +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /etc/resolv.conf" - - # Checking stage file - Check_stagefile .build/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 - elif [ -L chroot/etc/resolv.conf ] - then - # Move resolv.conf aside if it's a symlink (likely resolvconf) - mv chroot/etc/resolv.conf 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 .build/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/includes.chroot/etc/resolv.conf ] - then - # Copying local resolv.conf - cp -a config/includes.chroot/etc/resolv.conf chroot/etc/resolv.conf - rm -f chroot/etc/resolv.conf.orig - elif [ -e chroot/etc/resolv.conf.orig ] || [ -L 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 .build/chroot_resolv - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_chroot_selinuxfs b/scripts/build/lb_chroot_selinuxfs deleted file mode 100755 index 20e30fb35..000000000 --- a/scripts/build/lb_chroot_selinuxfs +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'mount /selinux')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Ensure that a system is built as root -lb 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 .build/config .build/bootstrap - -case "${1}" in - install) - if [ -e /selinux/enforce ] && [ "$(cat /selinux/enforce)" = "1" ] - then - Echo_message "Begin mounting /selinux..." - - # Checking stage file - Check_stagefile .build/chroot_selinuxfs - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LB_USE_FAKEROOT}" != "true" ] - then - # Create mountpoint - mkdir -p chroot/selinux - - # Mounting /selinux - ${LB_ROOT_COMMAND} mount selinuxfs-live -t selinuxfs chroot/selinux - else - rm -rf chroot/selinux - ln -s /selinux chroot/ - fi - - # Creating stage file - Create_stagefile .build/chroot_selinuxfs - fi - ;; - - remove) - Echo_message "Begin unmounting /selinux..." - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LB_USE_FAKEROOT}" != "true" ] - then - # Unmounting /selinux - #fuser -km chroot/selinux - if [ -e chroot/selinux/enforce ] - then - ${LB_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 .build/chroot_selinux - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_chroot_sysfs b/scripts/build/lb_chroot_sysfs deleted file mode 100755 index 409728429..000000000 --- a/scripts/build/lb_chroot_sysfs +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'mount /sys')" -HELP="" -USAGE="${PROGRAM} {install|remove} [--force]" - -Arguments "${@}" - -# Ensure that a system is built as root -lb 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 .build/config .build/bootstrap - -case "${1}" in - install) - Echo_message "Begin mounting /sys..." - - # Checking stage file - Check_stagefile .build/chroot_sysfs - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LB_USE_FAKEROOT}" != "true" ] - then - # Create mountpoint - mkdir -p chroot/sys - - # Mounting /sys - ${LB_ROOT_COMMAND} mount sysfs-live -t sysfs chroot/sys - else - rm -rf chroot/sys - ln -s /sys chroot/ - fi - - # Creating stage file - Create_stagefile .build/chroot_sysfs - ;; - - remove) - Echo_message "Begin unmounting /sys..." - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ "${LB_USE_FAKEROOT}" != "true" ] - then - # Unmounting /sys - #fuser -km chroot/sys - if [ -e chroot/sys/class ] - then - ${LB_ROOT_COMMAND} umount chroot/sys - fi - else - rm -rf chroot/sys - mkdir -p chroot/sys - fi - - # Removing stage file - rm -f .build/chroot_sysfs - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_chroot_sysv-rc b/scripts/build/lb_chroot_sysv-rc deleted file mode 100755 index 4e1fc160e..000000000 --- a/scripts/build/lb_chroot_sysv-rc +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 .build/config .build/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /usr/sbin/policy-rc.d" - - # Checking stage file - Check_stagefile .build/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 .build/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 .build/chroot_sysv-rc - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_chroot_tmpfs b/scripts/build/lb_chroot_tmpfs deleted file mode 100755 index 80311f531..000000000 --- a/scripts/build/lb_chroot_tmpfs +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'use tmpfs to speedup the build')" -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 - -if [ "${LB_BUILD_WITH_TMPFS}" != "true" ] -then - exit 0 -fi - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -case "${1}" in - install) - Echo_message "Configuring tmpfs for /var/lib/dpkg" - - # Checking stage file - Check_stagefile .build/chroot_tmpfs - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - mv chroot/var/lib/dpkg chroot/var/lib/dpkg.tmp - mkdir chroot/var/lib/dpkg - mount -t tmpfs tmpfs chroot/var/lib/dpkg - mv chroot/var/lib/dpkg.tmp/* chroot/var/lib/dpkg - rm -rf chroot/var/lib/dpkg.tmp - - # Creating stage file - Create_stagefile .build/chroot_tmpfs - ;; - - remove) - Echo_message "Deconfiguring tmpfs for /var/lib/dpkg" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - mkdir -p chroot/var/lib/dpkg.tmp - mv chroot/var/lib/dpkg/* chroot/var/lib/dpkg.tmp - umount chroot/var/lib/dpkg - rm -rf chroot/var/lib/dpkg - mv chroot/var/lib/dpkg.tmp chroot/var/lib/dpkg - - # Removing stage file - rm -f .build/chroot_tmpfs - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_chroot_upstart b/scripts/build/lb_chroot_upstart deleted file mode 100755 index fd7c72f75..000000000 --- a/scripts/build/lb_chroot_upstart +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'manage /sbin/initctl')" -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 .build/config .build/bootstrap - -case "${1}" in - install) - Echo_message "Configuring file /sbin/initctl" - - # Checking stage file - Check_stagefile .build/chroot_upstart - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ -f chroot/sbin/initctl ] - then - # Save initctl file - mv chroot/sbin/initctl chroot/sbin/initctl.orig - fi - - # Create initctl file -cat > chroot/sbin/initctl << EOF -#!/bin/sh -echo "All runlevel operations denied by policy" >&2 -exit 101 -EOF - - chmod 0755 chroot/sbin/initctl - - # Creating stage file - Create_stagefile .build/chroot_upstart - ;; - - remove) - Echo_message "Deconfiguring file /sbin/initctl" - - # Checking lock file - Check_lockfile .lock - - # Creating lock file - Create_lockfile .lock - - if [ -f chroot/sbin/initctl.orig ] - then - # Restore initctl file - mv chroot/sbin/initctl.orig chroot/sbin/initctl - else - # Remove initctl file - rm -f chroot/sbin/initctl - fi - - # Removing stage file - rm -f .build/chroot_upstart - ;; - - *) - Usage - ;; -esac diff --git a/scripts/build/lb_clean b/scripts/build/lb_clean deleted file mode 100755 index 4104e5256..000000000 --- a/scripts/build/lb_clean +++ /dev/null @@ -1,161 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Read meta config -if [ "${1}" != "noauto" ] && [ -x auto/clean ] -then - Echo_message "Executing auto/clean script." - ./auto/clean "${@}" - exit ${?} -fi - -if [ "${1}" = "noauto" ] -then - shift -fi - -# 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) - "${0}" noauto --chroot - "${0}" noauto --binary - "${0}" noauto --stage - "${0}" noauto --source - - rmdir --ignore-fail-on-non-empty auto > /dev/null 2>&1 || true - ;; - - --cache) - ${LB_ROOT_COMMAND} rm -rf cache - ;; - - --chroot) - Echo_message "Cleaning chroot" - ${LB_ROOT_COMMAND} umount -f chroot/run > /dev/null 2>&1 || true - ${LB_ROOT_COMMAND} umount -f chroot/sys > /dev/null 2>&1 || true - ${LB_ROOT_COMMAND} umount -f chroot/proc/sys/fs/binfmt_misc > /dev/null 2>&1 || true - ${LB_ROOT_COMMAND} umount -f chroot/proc > /dev/null 2>&1 || true - ${LB_ROOT_COMMAND} umount -f chroot/lib/init/rw > /dev/null 2>&1 || true - ${LB_ROOT_COMMAND} umount -f chroot/dev/shm > /dev/null 2>&1 || true - ${LB_ROOT_COMMAND} umount -f chroot/dev/pts > /dev/null 2>&1 || true - ${LB_ROOT_COMMAND} umount -f chroot/dev > /dev/null 2>&1 || true - ${LB_ROOT_COMMAND} umount -f chroot/var/lib/dpkg > /dev/null 2>&1 || true - ${LB_ROOT_COMMAND} umount -f chroot/root/config > /dev/null 2>&1 || true - - ${LB_ROOT_COMMAND} umount -f chroot/binary.tmp > /dev/null 2>&1 || true - ${LB_ROOT_COMMAND} umount -f chroot/dev.tmp/pts > /dev/null 2>&1 || true - - ${LB_ROOT_COMMAND} rm -rf chroot chroot.tmp - - rm -f chroot.packages.live chroot.packages.install - - rm -f .build/chroot* - ;; - - --binary) - ${LB_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*.zsync* - rm -f binary.sh - rm -f binary.contents binary.packages md5sum.txt - - rm -rf binary - rm -rf tftpboot - - rm -f .build/binary* - ;; - - --remove) - "${0}" --all - rm -rf cache/packages.* - ;; - - --purge) - "${0}" --all - "${0}" --cache - - if [ -e auto/config ] - then - rm -f .build/config - fi - ;; - - --stage) - rm -rf .build - ;; - - --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 .build/source* - ;; - - -h|--help) - Help - ;; - - -u|--usage) - Usage - ;; - - -v|--version) - echo "${VERSION}" - exit 0 - ;; - - *) - Usage - exit 1 - ;; - esac -done diff --git a/scripts/build/lb_config b/scripts/build/lb_config deleted file mode 100755 index 2a1ae567b..000000000 --- a/scripts/build/lb_config +++ /dev/null @@ -1,1494 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -PROGRAM="lb config" -DESCRIPTION="$(Echo 'create configuration for live-build(7)')" -USAGE="${PROGRAM} [--apt apt|aptitude]\n\ -\t [--apt-ftp-proxy URL]\n\ -\t [--apt-http-proxy URL]\n\ -\t [--apt-indices true|false|none]\n\ -\t [--apt-options OPTION|\"OPTIONS\"]\n\ -\t [--aptitude-options OPTION|\"OPTIONS\"]\n\ -\t [--apt-pipeline DEPTH]\n\ -\t [--apt-recommends true|false]\n\ -\t [--apt-secure true|false]\n\ -\t [--apt-source-archives true|false]\n\ -\t [-a|--architectures ARCHITECTURE]\n\ -\t [-b|--binary-images iso|iso-hybrid|netboot|tar|hdd]\n\ -\t [--binary-filesystem fat16|fat32|ext2|ext3|ext4|ntfs]\n\ -\t [--bootappend-install PARAMETER|\"PARAMETERS\"]\n\ -\t [--bootappend-live PARAMETER|\"PARAMETERS\"]\n\ -\t [--bootappend-failsafe PARAMETER|\"PARAMETERS\"]\n\ -\t [--bootloader grub|syslinux|yaboot]\n\ -\t [--bootstrap cdebootstrap|cdebootstrap-static|debootstrap|copy]\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 md5|sha1|sha256|none]\n\ -\t [--compression bzip2|gzip|lzip|xz|none]\n\ -\t [--config GIT_URL::GIT_BRANCH]\n\ -\t [--zsync true|false]\n\ -\t [--build-with-chroot true|false]\n\ -\t [--chroot-filesystem ext2|ext3|ext4|squashfs|jffs2|none]\n\ -\t [--clean\n\ -\t [-c|--conffile FILE]\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 daily|CODENAME]\n\ -\t [--debian-installer-preseedfile FILE|URL]\n\ -\t [--debian-installer-gui true|false]\n\ -\t [--debug]\n\ -\t [-d|--distribution CODENAME]\n\ -\t [--parent-distribution CODENAME]\n\ -\t [--parent-debian-installer-distribution CODENAME]\n\ -\t [--dump]\n\ -\t [--fdisk fdisk|fdisk.dist]\n\ -\t [--force]\n\ -\t [--grub-splash FILE]\n\ -\t [--gzip-options OPTION|\"OPTIONS\"]\n\ -\t [--hooks FILE]\n\ -\t [--ignore-system-defaults]\n\ -\t [--initramfs auto|none|live-boot|casper]\n\ -\t [--initramfs-compression bzip2|gzip|lzma]\n\ -\t [--initsystem sysvinit|runit|systemd|upstart|none]\n\ -\t [--interactive shell]\n\ -\t [--isohybrid-options OPTION|\"OPTIONS\"]\n\ -\t [--hdd-label LABEL]\n\ -\t [--hdd-size MB]\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 [-k|--linux-flavours FLAVOUR|\"FLAVOURS\"]\n\ -\t [--linux-packages \"PACKAGES\"]\n\ -\t [--losetup losetup|losetup.orig]\n\ -\t [--memtest memtest86+|memtest86|none]\n\ -\t [-m|--parent-mirror-bootstrap URL]\n\ -\t [--parent-mirror-chroot URL]\n\ -\t [--parent-mirror-chroot-security URL]\n\ -\t [--parent-mirror-chroot-volatile URL]\n\ -\t [--parent-mirror-chroot-backports URL]\n\ -\t [--parent-mirror-binary URL]\n\ -\t [--parent-mirror-binary-security URL]\n\ -\t [--parent-mirror-binary-volatile URL]\n\ -\t [--parent-mirror-binary-backports URL]\n\ -\t [--parent-mirror-debian-installer URL]\n\ -\t [--mirror-bootstrap URL]\n\ -\t [--mirror-chroot URL]\n\ -\t [--mirror-chroot-security URL]\n\ -\t [--mirror-chroot-volatile URL]\n\ -\t [--mirror-chroot-backports URL]\n\ -\t [--mirror-binary URL]\n\ -\t [--mirror-binary-security URL]\n\ -\t [--mirror-binary-volatile URL]\n\ -\t [--mirror-binary-backports URL]\n\ -\t [--mirror-debian-installer URL]\n\ -\t [--mode debian|emdebian|ubuntu|kubuntu]\n\ -\t [--system live|normal]\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 true|false]\n\ -\t [--quiet]\n\ -\t [--root-command sudo]\n\ -\t [--use-fakeroot true|false]\n\ -\t [--archives ARCHIVE|\"ARCHIVES\"]\n\ -\t [--archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\ -\t [--parent-archive-areas ARCHIVE_AREA|\"ARCHIVE_AREAS\"]\n\ -\t [--security true|false]\n\ -\t [--source true|false]\n\ -\t [-s|--source-images iso|netboot|tar|hdd]\n\ -\t [--firmware-binary true|false]\n\ -\t [--firmware-chroot true|false]\n\ -\t [--swap-file-path PATH]\n\ -\t [--swap-file-size MB]\n\ -\t [--syslinux-theme THEME_SUFFIX]\n\ -\t [--tasksel apt|aptitude|tasksel]\n\ -\t [--templates PATH]\n\ -\t [--volatile true|false]\n\ -\t [--backports true|false]\n\ -\t [--exposed-root true|false]\n\ -\t [--verbose]\n\ -\t [--win32-loader true|false]\n\ -\t [--bootstrap-qemu-exclude PACKAGES]\n\ -\t [--bootstrap-qemu-static PATH]\n\ -\t [--bootstrap-qemu-arch ARCH]" - - -Local_arguments () -{ - LONG_OPTIONS="apt:,apt-ftp-proxy:,apt-http-proxy:,apt-options:,aptitute-options:debootstrap-options:,cdebootstrap-ptions, - apt-pipeline:,apt-recommends:,apt-secure:,apt-source-archives:,bootstrap:,cache:,cache-indices:,cache-packages:, - cache-stages:,debconf-frontend:,debconf-nowarnings:,debconf-priority:,dump, - initramfs:,initramfs-compression:,initsystem:,fdisk:,losetup:,mode:,system:,root-command:,use-fakeroot:,tasksel:, - templates:,architectures:,clean, - distribution:,parent-distribution:,parent-debian-installer-distribution:,parent-mirror-bootstrap:,parent-mirror-chroot:,parent-mirror-chroot-security:,parent-mirror-chroot-volatile:,parent-mirror-chroot-backports:,parent-mirror-binary:, - parent-mirror-binary-security:,parent-mirror-binary-volatile:,parent-mirror-binary-backports:,parent-mirror-debian-installer:, - mirror-bootstrap:,mirror-chroot:,mirror-chroot-security:,mirror-chroot-volatile:,mirror-chroot-backports:,mirror-binary:, - mirror-binary-security:,mirror-binary-volatile:,mirror-binary-backports:,mirror-debian-installer:, - archives:,archive-areas:,parent-archive-areas:,chroot-filesystem:,exposed-root:, - gzip-options:,hooks:,interactive:,keyring-packages:,linux-flavours:,linux-packages:, - security:,volatile:,backports:,binary-filesystem:,binary-images:, - apt-indices:,bootappend-install:,bootappend-live:,bootappend-failsafe:,bootloader:,checksums:,compression:,config:,zsync:,build-with-chroot:, - debian-installer:,debian-installer-distribution:,debian-installer-preseedfile:,debian-installer-gui:, - grub-splash:,isohybrid-options:,hdd-label:,hdd-size:,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:,firmware-binary:,firmware-chroot:,swap-file-path:,swap-file-size:,syslinux-theme:, - win32-loader:,source:,source-images:,breakpoints,conffile:,debug,force, - help,ignore-system-defaults,quiet,usage,verbose,version,bootstrap-qemu-static:,bootstrap-qemu-arch:, - bootstrap-qemu-exclude:" - # 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-build)" - fi - - Echo "%s: This is live-build 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/package-lists config/chroot_apt config/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) - _CLEAN="true" - shift - ;; - - # config/common - --apt) - LB_APT="${2}" - shift 2 - ;; - - --apt-ftp-proxy) - LB_APT_FTP_PROXY="${2}" - shift 2 - ;; - - --apt-http-proxy) - LB_APT_HTTP_PROXY="${2}" - shift 2 - ;; - - --apt-indices) - LB_APT_INDICES="${2}" - shift 2 - ;; - - --apt-options) - APT_OPTIONS="${2}" - shift 2 - ;; - - --aptitude-options) - LB_APTITUDE_OPTIONS="${2}" - shift 2 - ;; - - --apt-pipeline) - LB_APT_PIPELINE="${2}" - shift 2 - ;; - - --apt-recommends) - LB_APT_RECOMMENDS="${2}" - shift 2 - ;; - - --apt-secure) - LB_APT_SECURE="${2}" - shift 2 - ;; - - --apt-source-archives) - LB_APT_SOURCE_ARCHIVES="${2}" - shift 2 - ;; - - --bootstrap) - LB_BOOTSTRAP="${2}" - shift 2 - ;; - - --debootstrap-options) - DEBOOTSTRAP_OPTIONS="${2}" - shift 2 - ;; - - --cdebootstrap-options) - CDEBOOTSTRAP_OPTIONS="${2}" - shift 2 - ;; - - --cache) - LB_CACHE="${2}" - shift 2 - ;; - - --cache-indices) - LB_CACHE_INDICES="${2}" - shift 2 - ;; - - --cache-packages) - LB_CACHE_PACKAGES="${2}" - shift 2 - ;; - - --cache-stages) - LB_CACHE_STAGES="${2}" - shift 2 - ;; - - --debconf-frontend) - LB_DEBCONF_FRONTEND="${2}" - shift 2 - ;; - - --debconf-nowarnings) - LB_DEBCONF_NOWARNINGS="${2}" - shift 2 - ;; - - --debconf-priority) - LB_DEBCONF_PRIORITY="${2}" - shift 2 - ;; - - --initramfs) - LB_INITRAMFS="${2}" - shift 2 - ;; - - --initramfs-compression) - LB_INITRAMFS_COMPRESSION="${2}" - shift 2 - ;; - - --initsystem) - LB_INITSYSTEM="${2}" - shift 2 - ;; - - --fdisk) - LB_FDISK="${2}" - shift 2 - ;; - - --losetup) - LB_LOSETUP="${2}" - shift 2 - ;; - - --mode) - LB_MODE="${2}" - shift 2 - ;; - - --system) - LB_SYSTEM="${2}" - shift 2 - ;; - - --root-command) - LB_ROOT_COMMAND="${2}" - shift 2 - ;; - - --use-fakeroot) - LB_USE_FAKEROOT="${2}" - shift 2 - ;; - - --tasksel) - LB_TASKSEL="${2}" - shift 2 - ;; - - --templates) - LB_TEMPLATES="${2}" - shift 2 - ;; - - # config/bootstrap - -a|--architectures) - LB_ARCHITECTURES="${2}" - shift 2 - ;; - - -d|--distribution) - LB_DISTRIBUTION="${2}" - shift 2 - ;; - - --parent-distribution) - LB_PARENT_DISTRIBUTION="${2}" - shift 2 - ;; - - -m|--parent-mirror-bootstrap) - LB_PARENT_MIRROR_BOOTSTRAP="${2}" - shift 2 - ;; - - --parent-mirror-chroot) - LB_PARENT_MIRROR_CHROOT="${2}" - shift 2 - ;; - - --parent-mirror-chroot-security) - LB_PARENT_MIRROR_CHROOT_SECURITY="${2}" - shift 2 - ;; - - --parent-mirror-chroot-volatile) - LB_PARENT_MIRROR_CHROOT_VOLATILE="${2}" - shift 2 - ;; - - --parent-mirror-chroot-backports) - LB_PARENT_MIRROR_CHROOT_BACKPORTS="${2}" - shift 2 - ;; - - --parent-mirror-binary) - LB_PARENT_MIRROR_BINARY="${2}" - shift 2 - ;; - - --parent-mirror-binary-security) - LB_PARENT_MIRROR_BINARY_SECURITY="${2}" - shift 2 - ;; - - --parent-mirror-binary-volatile) - LB_PARENT_MIRROR_BINARY_VOLATILE="${2}" - shift 2 - ;; - - --parent-mirror-binary-backports) - LB_PARENT_MIRROR_BINARY_BACKPORTS="${2}" - shift 2 - ;; - - --parent-mirror-debian-installer) - LB_PARENT_MIRROR_DEBIAN_INSTALLER="${2}" - shift 2 - ;; - - --mirror-bootstrap) - LB_MIRROR_BOOTSTRAP="${2}" - shift 2 - ;; - - --mirror-chroot) - LB_MIRROR_CHROOT="${2}" - shift 2 - ;; - - --mirror-chroot-security) - LB_MIRROR_CHROOT_SECURITY="${2}" - shift 2 - ;; - - --mirror-chroot-volatile) - LB_MIRROR_CHROOT_VOLATILE="${2}" - shift 2 - ;; - - --mirror-chroot-backports) - LB_MIRROR_CHROOT_BACKPORTS="${2}" - shift 2 - ;; - - --mirror-binary) - LB_MIRROR_BINARY="${2}" - shift 2 - ;; - - --mirror-binary-security) - LB_MIRROR_BINARY_SECURITY="${2}" - shift 2 - ;; - - --mirror-binary-volatile) - LB_MIRROR_BINARY_VOLATILE="${2}" - shift 2 - ;; - - --mirror-binary-backports) - LB_MIRROR_BINARY_BACKPORTS="${2}" - shift 2 - ;; - - --mirror-debian-installer) - LB_MIRROR_DEBIAN_INSTALLER="${2}" - shift 2 - ;; - - --archives) - LB_ARCHIVES="${2}" - shift 2 - ;; - - --archive-areas) - LB_ARCHIVE_AREAS="${2}" - shift 2 - ;; - - --parent-archive-areas) - LB_PARENT_ARCHIVE_AREAS="${2}" - shift 2 - ;; - - # config/chroot - --chroot-filesystem) - LB_CHROOT_FILESYSTEM="${2}" - shift 2 - ;; - - --exposed-root) - LB_EXPOSED_ROOT="${2}" - shift 2 - ;; - - --gzip-options) - GZIP_OPTIONS="${2}" - shift 2 - ;; - - --hooks) - LB_HOOKS="${2}" - shift 2 - ;; - - --interactive) - LB_INTERACTIVE="${2}" - shift 2 - ;; - - --keyring-packages) - LB_KEYRING_PACKAGES="${2}" - shift 2 - ;; - - -k|--linux-flavours) - LB_LINUX_FLAVOURS="${2}" - shift 2 - ;; - - --linux-packages) - LB_LINUX_PACKAGES="${2}" - shift 2 - ;; - - --security) - LB_SECURITY="${2}" - shift 2 - ;; - - --volatile) - LB_VOLATILE="${2}" - shift 2 - ;; - - --backports) - LB_BACKPORTS="${2}" - shift 2 - ;; - - # config/binary - --binary-filesystem) - LB_BINARY_FILESYSTEM="${2}" - shift 2 - ;; - - -b|--binary-images) - LB_BINARY_IMAGES="${2}" - shift 2 - ;; - - --bootappend-live) - LB_BOOTAPPEND_LIVE="${2}" - shift 2 - ;; - - --bootappend-install) - LB_BOOTAPPEND_INSTALL="${2}" - shift 2 - ;; - - --bootappend-failsafe) - LB_BOOTAPPEND_FAILSAFE="${2}" - shift 2 - ;; - - --bootloader) - LB_BOOTLOADER="${2}" - shift 2 - ;; - - --checksums) - LB_CHECKSUMS="${2}" - shift 2 - ;; - - --compression) - LB_COMPRESSION="${2}" - shift 2 - ;; - - --config) - _CONFIG="${2}" - shift 2 - ;; - - --zsync) - LB_ZSYNC="${2}" - shift 2 - ;; - - --build-with-chroot) - LB_BUILD_WITH_CHROOT="${2}" - shift 2 - ;; - - --debian-installer) - LB_DEBIAN_INSTALLER="${2}" - shift 2 - ;; - - --debian-installer-distribution) - LB_DEBIAN_INSTALLER_DISTRIBUTION="${2}" - shift 2 - ;; - - --parent-debian-installer-distribution) - LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${2}" - shift 2 - ;; - - --debian-installer-preseedfile) - LB_DEBIAN_INSTALLER_PRESEEDFILE="${2}" - shift 2 - ;; - - --debian-installer-gui) - LB_DEBIAN_INSTALLER_GUI="${2}" - shift 2 - ;; - - --grub-splash) - LB_GRUB_SPLASH="${2}" - shift 2 - ;; - - --isohybrid-options) - LB_ISOHYBRID_OPTIONS="${2}" - shift 2 - ;; - - --hdd-label) - LB_HDD_LABEL="${2}" - shift 2 - ;; - - --hdd-size) - LB_HDD_SIZE="${2}" - shift 2 - ;; - - --iso-application) - LB_ISO_APPLICATION="${2}" - shift 2 - ;; - - --iso-preparer) - LB_ISO_PREPARER="${2}" - shift 2 - ;; - - --iso-publisher) - LB_ISO_PUBLISHER="${2}" - shift 2 - ;; - - --iso-volume) - LB_ISO_VOLUME="${2}" - shift 2 - ;; - - --jffs2-eraseblock) - LB_JFFS2_ERASEBLOCK="${2}" - shift 2 - ;; - - --memtest) - LB_MEMTEST="${2}" - shift 2 - ;; - - --net-root-filesystem) - LB_NET_ROOT_FILESYSTEM="${2}" - shift 2 - ;; - - --net-root-mountoptions) - LB_NET_ROOT_MOUNTOPTIONS="${2}" - shift 2 - ;; - - --net-root-path) - LB_NET_ROOT_PATH="${2}" - shift 2 - ;; - - --net-root-server) - LB_NET_ROOT_SERVER="${2}" - shift 2 - ;; - - --net-cow-filesystem) - LB_NET_COW_FILESYSTEM="${2}" - shift 2 - ;; - - --net-cow-mountoptions) - LB_NET_COW_MOUNTOPTIONS="${2}" - shift 2 - ;; - - --net-cow-path) - LB_NET_COW_PATH="${2}" - shift 2 - ;; - - --net-cow-server) - LB_NET_COW_SERVER="${2}" - shift 2 - ;; - - --net-tarball) - LB_NET_TARBALL="${2}" - shift 2 - ;; - - --firmware-binary) - LB_FIRMWARE_BINARY="${2}" - shift 2 - ;; - - --firmware-chroot) - LB_FIRMWARE_CHROOT="${2}" - shift 2 - ;; - - --swap-file-path) - LB_SWAP_FILE_PATH="${2}" - shift 2 - ;; - - --swap-file-size) - LB_SWAP_FILE_SIZE="${2}" - shift 2 - ;; - - --syslinux-theme) - LB_SYSLINUX_THEME="${2}" - shift 2 - ;; - - --win32-loader) - LB_WIN32_LOADER="${2}" - shift 2 - ;; - - --bootstrap-qemu-arch) - LB_BOOTSTRAP_QEMU_ARCHITECTURES="${2}" - shift 2 - ;; - - --bootstrap-qemu-exclude) - LB_BOOTSTRAP_QEMU_EXCLUDE="${2}" - shift 2 - ;; - - --bootstrap-qemu-static) - LB_BOOTSTRAP_QEMU_STATIC="${2}" - shift 2 - ;; - - # config/source - --source) - LB_SOURCE="${2}" - shift 2 - ;; - - -s|--source-images) - LB_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) - echo "${VERSION}" - exit 0 - ;; - - --) - shift - break - ;; - - *) - Echo_error "internal error %s" "${0}" - exit 1 - ;; - esac - done -} - -Local_arguments "${@}" - -if [ -e .git ] && [ -n "${_CONFIG}" ] -then - if [ "${1}" != "noauto" ] - then - Echo_message "Ignoring --config ${_CONFIG}: ${PWD} is already a git repository" - fi - - _CONFIG="" -fi - -if [ -n "${_CONFIG}" ] -then - _GIT_REPOSITORY="$(echo ${_CONFIG} | sed -e 's|::.*$||')" - - Echo_message "Cloning ${_GIT_REPOSITORY}" - git clone ${_GIT_REPOSITORY} ./ - - if [ "${_GIT_REPOSITORY}" != "${_CONFIG}" ] - then - _GIT_BRANCH="$(echo ${_CONFIG} | awk -F\:\: '{ print $NF }')" - - Echo_message "Checking out ${_GIT_BRANCH}" - git checkout ${_GIT_BRANCH} - fi - - if [ -e auto/config ] - then - _EXTRA_OPTIONS="$(echo ${@} | sed -e "s|--config ${_GIT_REPOSITORY}::${_GIT_BRANCH}||g" -e "s|--config ${_GIT_REPOSITORY}||g")" - - Echo_message "The following extra options specified to lb config are going to be added to auto/config: ${_EXTRA_OPTIONS}" - sed -i -e "s|\"\${@}\"|${_EXTRA_OPTIONS} \"\${@}\"|" auto/config - fi -fi - -# Read meta config -if [ "${1}" != "noauto" ] && [ -x auto/config ] -then - Echo_message "Executing auto/config script." - ./auto/config "${@}" - exit ${?} -fi - -if [ "${1}" = "noauto" ] -then - shift -fi - -# Reading system configuration -if ! In_list "--ignore-system-defaults" "${@}" -then - Echo_message "Considering defaults defined in %s" "/etc/live/build.conf" - - Read_conffiles /etc/live/build.conf /etc/live/build/* -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 for a ${LB_MODE}/${LB_ARCHITECTURES} system" -else - Echo_message "Updating config tree for a ${LB_MODE}/${LB_ARCHITECTURES} system" -fi - -# Creating bootstrap configuration -mkdir -p config -mkdir -p config/includes -mkdir -p config/templates - -# Creating live-build configuration -cat > config/common << EOF -# config/common - common options for live-build(7) - -# LB_CONFIG_VERSION: internal version of the configuration file format -LB_CONFIG_VERSION="${CONFIG_VERSION}" - -# \$LB_APT: set package manager -# (Default: ${LB_APT}) -LB_APT="${LB_APT}" - -# \$LB_APT_FTP_PROXY: set apt/aptitude ftp proxy -# (Default: autodetected or empty) -LB_APT_FTP_PROXY="${LB_APT_FTP_PROXY}" - -# \$LB_APT_HTTP_PROXY: set apt/aptitude http proxy -# (Default: autodetected or empty) -LB_APT_HTTP_PROXY="${LB_APT_HTTP_PROXY}" - -# \$LB_APT_PIPELINE: set apt/aptitude pipeline depth -# (Default: ${LB_APT_PIPELINE}) -LB_APT_PIPELINE="${LB_APT_PIPELINE}" - -# \$LB_APT_RECOMMENDS: set apt/aptitude recommends -# (Default: ${LB_APT_RECOMMENDS}) -LB_APT_RECOMMENDS="${LB_APT_RECOMMENDS}" - -# \$LB_APT_SECURE: set apt/aptitude security -# (Default: ${LB_APT_SECURE}) -LB_APT_SECURE="${LB_APT_SECURE}" - -# \$LB_APT_SOURCE_ARCHIVES: set apt/aptitude source entries in sources.list -# (Default: ${LB_APT_SOURCE_ARCHIVES}) -LB_APT_SOURCE_ARCHIVES="${LB_APT_SOURCE_ARCHIVES}" - -# \$LB_BOOTSTRAP: set bootstrap program -# (Default: ${LB_BOOTSTRAP}) -LB_BOOTSTRAP="${LB_BOOTSTRAP}" - -# \$LB_CACHE: control cache -# (Default: ${LB_CACHE}) -LB_CACHE="${LB_CACHE}" - -# \$LB_CACHE_INDICES: control if downloaded package indices should be cached -# (Default: ${LB_CACHE_INDICES}) -LB_CACHE_INDICES="${LB_CACHE_INDICES}" - -# \$LB_CACHE_PACKAGES: control if downloaded packages files should be cached -# (Default: ${LB_CACHE_PACKAGES}) -LB_CACHE_PACKAGES="${LB_CACHE_PACKAGES}" - -# \$LB_CACHE_STAGES: control if completed stages should be cached -# (Default: ${LB_CACHE_STAGES}) -LB_CACHE_STAGES="${LB_CACHE_STAGES}" - -# \$LB_DEBCONF_FRONTEND: set debconf(1) frontend to use -# (Default: ${LB_DEBCONF_FRONTEND}) -LB_DEBCONF_FRONTEND="${LB_DEBCONF_FRONTEND}" - -# \$LB_DEBCONF_NOWARNINGS: set debconf(1) warnings -# (Default: ${LB_DEBCONF_NOWARNINGS}) -LB_DEBCONF_NOWARNINGS="${LB_DEBCONF_NOWARNINGS}" - -# \$LB_DEBCONF_PRIORITY: set debconf(1) priority to use -# (Default: ${LB_DEBCONF_PRIORITY}) -LB_DEBCONF_PRIORITY="${LB_DEBCONF_PRIORITY}" - -# \$LB_INITRAMFS: set initramfs hook -# (Default: ${LB_INITRAMFS}) -LB_INITRAMFS="${LB_INITRAMFS}" - -# \$LB_INITRAMFS_COMPRESSION: set initramfs compression -# (Default: ${LB_INITRAMFS_COMPRESSION}) -LB_INITRAMFS_COMPRESSION="${LB_INITRAMFS_COMPRESSION}" - -# \$LB_INITSYSTEM: set init system -# (Default: ${LB_INITSYSTEM}) -LB_INITSYSTEM="${LB_INITSYSTEM}" - -# \$LB_FDISK: set fdisk program -# (Default: autodetected) -LB_FDISK="${LB_FDISK}" - -# \$LB_LOSETUP: set losetup program -# (Default: autodetected) -LB_LOSETUP="${LB_LOSETUP}" - -# \$LB_MODE: set distribution mode -# (Default: ${LB_MODE}) -LB_MODE="${LB_MODE}" - -# \$LB_SYSTEM: set system type -# (Default: ${LB_SYSTEM}) -LB_SYSTEM="${LB_SYSTEM}" - -# \$LB_ROOT_COMMAND: use sudo or equivalent -# (Default: empty) -#LB_ROOT_COMMAND="sudo" - -# \$LB_USE_FAKEROOT: use fakeroot/fakechroot -# (Default: ${LB_USE_FAKEROOT}) -LB_USE_FAKEROOT="${LB_USE_FAKEROOT}" - -# \$LB_TASKSEL: set tasksel program -# (Default: ${LB_TASKSEL}) -LB_TASKSEL="${LB_TASKSEL}" - -# \$LB_TEMPLATES: set templates -# (Default: ${LB_TEMPLATES}) -LB_TEMPLATES="${LB_TEMPLATES}" - -# live-build 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}" -DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS}" -CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS}" -GZIP_OPTIONS="${GZIP_OPTIONS}" -ISOHYBRID_OPTIONS="${ISOHYBRID_OPTIONS}" -EOF - -# Creating lb_bootstrap_* configuration -cat > config/bootstrap << EOF -# config/bootstrap - options for live-build(7), bootstrap stage - -# \$LB_ARCHITECTURES: select chroot architectures -# (Default: autodetected) -LB_ARCHITECTURES="${LB_ARCHITECTURES}" - -# \$LB_DISTRIBUTION: select distribution to use -# (Default: ${LB_DISTRIBUTION}) -LB_DISTRIBUTION="${LB_DISTRIBUTION}" - -# \$LB_PARENT_DISTRIBUTION: select parent distribution to use -# (Default: ${LB_PARENT_DISTRIBUTION}) -LB_PARENT_DISTRIBUTION="${LB_PARENT_DISTRIBUTION}" - -# \$LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION: select parent distribution for debian-installer to use -# (Default: ${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}) -LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION="${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}" - -# \$LB_PARENT_MIRROR_BOOTSTRAP: set parent mirror to bootstrap from -# (Default: ${LB_PARENT_MIRROR_BOOTSTRAP}) -LB_PARENT_MIRROR_BOOTSTRAP="${LB_PARENT_MIRROR_BOOTSTRAP}" - -# \$LB_PARENT_MIRROR_CHROOT: set parent mirror to fetch packages from -# (Default: ${LB_PARENT_MIRROR_CHROOT}) -LB_PARENT_MIRROR_CHROOT="${LB_PARENT_MIRROR_CHROOT}" - -# \$LB_PARENT_MIRROR_CHROOT_SECURITY: set security parent mirror to fetch packages from -# (Default: ${LB_PARENT_MIRROR_CHROOT_SECURITY}) -LB_PARENT_MIRROR_CHROOT_SECURITY="${LB_PARENT_MIRROR_CHROOT_SECURITY}" - -# \$LB_PARENT_MIRROR_CHROOT_VOLATILE: set volatile parent mirror to fetch packages from -# (Default: ${LB_PARENT_MIRROR_CHROOT_VOLATILE}) -LB_PARENT_MIRROR_CHROOT_VOLATILE="${LB_PARENT_MIRROR_CHROOT_VOLATILE}" - -# \$LB_PARENT_MIRROR_CHROOT_BACKPORTS: set backports parent mirror to fetch packages from -# (Default: ${LB_PARENT_MIRROR_CHROOT_BACKPORTS}) -LB_PARENT_MIRROR_CHROOT_BACKPORTS="${LB_PARENT_MIRROR_CHROOT_BACKPORTS}" - -# \$LB_PARENT_MIRROR_BINARY: set parent mirror which ends up in the image -# (Default: ${LB_PARENT_MIRROR_BINARY}) -LB_PARENT_MIRROR_BINARY="${LB_PARENT_MIRROR_BINARY}" - -# \$LB_PARENT_MIRROR_BINARY_SECURITY: set security parent mirror which ends up in the image -# (Default: ${LB_PARENT_MIRROR_BINARY_SECURITY}) -LB_PARENT_MIRROR_BINARY_SECURITY="${LB_PARENT_MIRROR_BINARY_SECURITY}" - -# \$LB_PARENT_MIRROR_BINARY_VOLATILE: set volatile parent mirror which ends up in the image -# (Default: ${LB_PARENT_MIRROR_BINARY_VOLATILE}) -LB_PARENT_MIRROR_BINARY_VOLATILE="${LB_PARENT_MIRROR_BINARY_VOLATILE}" - -# \$LB_PARENT_MIRROR_BINARY_BACKPORTS: set backports parent mirror which ends up in the image -# (Default: ${LB_PARENT_MIRROR_BINARY_BACKPORTS}) -LB_PARENT_MIRROR_BINARY_BACKPORTS="${LB_PARENT_MIRROR_BINARY_BACKPORTS}" - -# \$LB_PARENT_MIRROR_DEBIAN_INSTALLER: set debian-installer parent mirror -# (Default: ${LB_PARENT_MIRROR_BOOTSTRAP}) -LB_PARENT_MIRROR_DEBIAN_INSTALLER="${LB_PARENT_MIRROR_DEBIAN_INSTALLER}" - -# \$LB_MIRROR_BOOTSTRAP: set mirror to bootstrap from -# (Default: ${LB_MIRROR_BOOTSTRAP}) -LB_MIRROR_BOOTSTRAP="${LB_MIRROR_BOOTSTRAP}" - -# \$LB_MIRROR_CHROOT: set mirror to fetch packages from -# (Default: ${LB_MIRROR_CHROOT}) -LB_MIRROR_CHROOT="${LB_MIRROR_CHROOT}" - -# \$LB_MIRROR_CHROOT_SECURITY: set security mirror to fetch packages from -# (Default: ${LB_MIRROR_CHROOT_SECURITY}) -LB_MIRROR_CHROOT_SECURITY="${LB_MIRROR_CHROOT_SECURITY}" - -# \$LB_MIRROR_CHROOT_VOLATILE: set volatile mirror to fetch packages from -# (Default: ${LB_MIRROR_CHROOT_VOLATILE}) -LB_MIRROR_CHROOT_VOLATILE="${LB_MIRROR_CHROOT_VOLATILE}" - -# \$LB_MIRROR_CHROOT_BACKPORTS: set backports mirror to fetch packages from -# (Default: ${LB_MIRROR_CHROOT_BACKPORTS}) -LB_MIRROR_CHROOT_BACKPORTS="${LB_MIRROR_CHROOT_BACKPORTS}" - -# \$LB_MIRROR_BINARY: set mirror which ends up in the image -# (Default: ${LB_MIRROR_BINARY}) -LB_MIRROR_BINARY="${LB_MIRROR_BINARY}" - -# \$LB_MIRROR_BINARY_SECURITY: set security mirror which ends up in the image -# (Default: ${LB_MIRROR_BINARY_SECURITY}) -LB_MIRROR_BINARY_SECURITY="${LB_MIRROR_BINARY_SECURITY}" - -# \$LB_MIRROR_BINARY_VOLATILE: set volatile mirror which ends up in the image -# (Default: ${LB_MIRROR_BINARY_VOLATILE}) -LB_MIRROR_BINARY_VOLATILE="${LB_MIRROR_BINARY_VOLATILE}" - -# \$LB_MIRROR_BINARY_BACKPORTS: set backports mirror which ends up in the image -# (Default: ${LB_MIRROR_BINARY_BACKPORTS}) -LB_MIRROR_BINARY_BACKPORTS="${LB_MIRROR_BINARY_BACKPORTS}" - -# \$LB_MIRROR_DEBIAN_INSTALLER: set debian-installer mirror -# (Default: ${LB_MIRROR_BOOTSTRAP}) -LB_MIRROR_DEBIAN_INSTALLER="${LB_MIRROR_DEBIAN_INSTALLER}" - -# \$LB_ARCHIVES: enable available third-party archives -# (Default: empty) -LB_ARCHIVES="${LB_ARCHIVES}" - -# \$LB_ARCHIVE_AREAS: select archive areas to use -# (Default: ${LB_ARCHIVE_AREAS}) -LB_ARCHIVE_AREAS="${LB_ARCHIVE_AREAS}" - -# \$LB_PARENT_ARCHIVE_AREAS: select archive areas to use -# (Default: ${LB_PARENT_ARCHIVE_AREAS}) -LB_PARENT_ARCHIVE_AREAS="${LB_PARENT_ARCHIVE_AREAS}" - -# \$LB_BOOTSTRAP_QEMU_ARCHITECTURES: architectures to use foreign bootstrap -# (Default: ${LB_BOOTSTRAP_QEMU_ARCHITECTURES}) -LB_BOOTSTRAP_QEMU_ARCHITECTURES="${LB_BOOTSTRAP_QEMU_ARCHITECTURES}" - -# \$LB_BOOTSTRAP_QEMU_EXCLUDE: packages to exclude during foreign bootstrap -# (Default: ${LB_BOOTSTRAP_QEMU_EXCLUDE}) -LB_BOOTSTRAP_QEMU_EXCLUDE="${LB_BOOTSTRAP_QEMU_EXCLUDE}" - -# \$LB_BOOTSTRAP_QEMU_STATIC: static qemu binary for foreign bootstrap -# (Default: ${LB_BOOTSTRAP_QEMU_STATIC}) -LB_BOOTSTRAP_QEMU_STATIC="${LB_BOOTSTRAP_QEMU_STATIC}" -EOF - -# Creating lb_chroot_* configuration -mkdir -p config/archives -mkdir -p config/chroot_apt -mkdir -p config/hooks -mkdir -p config/includes.chroot -mkdir -p config/packages -mkdir -p config/packages.chroot -mkdir -p config/package-lists -mkdir -p config/preseed - -cat > config/chroot << EOF -# config/chroot - options for live-build(7), chroot stage - -# \$LB_CHROOT_FILESYSTEM: set chroot filesystem -# (Default: ${LB_CHROOT_FILESYSTEM}) -LB_CHROOT_FILESYSTEM="${LB_CHROOT_FILESYSTEM}" - -# \$LB_UNION_FILESYSTEM: set union filesystem -# (Default: ${LB_UNION_FILESYSTEM}) -LB_UNION_FILESYSTEM="${LB_UNION_FILESYSTEM}" - -# \$LB_EXPOSED_ROOT: expose root as read only -# (Default: ${LB_EXPOSED_ROOT}) -LB_EXPOSED_ROOT="${LB_EXPOSED_ROOT}" - -# \$LB_HOOKS: set hook commands -# (Default: empty) -LB_HOOKS="${LB_HOOKS}" - -# \$LB_INTERACTIVE: set interactive build -# (Default: ${LB_INTERACTIVE}) -LB_INTERACTIVE="${LB_INTERACTIVE}" - -# \$LB_KEYRING_PACKAGES: set keyring packages -# (Default: empty) -LB_KEYRING_PACKAGES="${LB_KEYRING_PACKAGES}" - -# \$LB_LINUX_FLAVOURS: set kernel flavour to use -# (Default: autodetected) -LB_LINUX_FLAVOURS="${LB_LINUX_FLAVOURS}" - -# \$LB_LINUX_PACKAGES: set kernel packages to use -# (Default: autodetected) -LB_LINUX_PACKAGES="${LB_LINUX_PACKAGES}" - -# \$LB_SECURITY: enable security updates -# (Default: ${LB_SECURITY}) -LB_SECURITY="${LB_SECURITY}" - -# \$LB_VOLATILE: enable volatile updates -# (Default: ${LB_VOLATILE}) -LB_VOLATILE="${LB_VOLATILE}" - -# \$LB_BACKPORTS: enable backports updates -# (Default: ${LB_BACKPORTS}) -LB_BACKPORTS="${LB_BACKPORTS}" -EOF - -# Creating lb_binary_* configuration -mkdir -p config/binary_debian-installer -mkdir -p config/binary_grub -mkdir -p config/includes.binary -mkdir -p config/includes.binary_debian-installer -mkdir -p config/packages.binary -mkdir -p config/package-lists -mkdir -p config/binary_rootfs -mkdir -p config/binary_syslinux - -cat > config/binary << EOF -# config/binary - options for live-build(7), binary stage - -# \$LB_BINARY_FILESYSTEM: set image filesystem -# (Default: ${LB_BINARY_FILESYSTEM}) -LB_BINARY_FILESYSTEM="${LB_BINARY_FILESYSTEM}" - -# \$LB_BINARY_IMAGES: set image type -# (Default: ${LB_BINARY_IMAGES}) -LB_BINARY_IMAGES="${LB_BINARY_IMAGES}" - -# \$LB_APT_INDICES: set apt/aptitude generic indices -# (Default: ${LB_APT_INDICES}) -LB_APT_INDICES="${LB_APT_INDICES}" - -# \$LB_BOOTAPPEND_LIVE: set boot parameters -# (Default: empty) -LB_BOOTAPPEND_LIVE="${LB_BOOTAPPEND_LIVE}" - -# \$LB_BOOTAPPEND_INSTALL: set boot parameters -# (Default: empty) -LB_BOOTAPPEND_INSTALL="${LB_BOOTAPPEND_INSTALL}" - -# \$LB_BOOTAPPEND_FAILSAFE: set boot parameters -# (Default: empty) -LB_BOOTAPPEND_FAILSAFE="${LB_BOOTAPPEND_FAILSAFE}" - -# \$LB_BOOTLOADER: set bootloader -# (Default: ${LB_BOOTLOADER}) -LB_BOOTLOADER="${LB_BOOTLOADER}" - -# \$LB_CHECKSUMS: set checksums -# (Default: ${LB_CHECKSUMS}) -LB_CHECKSUMS="${LB_CHECKSUMS}" - -# \$LB_COMPRESSION: set compression -# (Default: ${LB_COMPRESSION}) -LB_COMPRESSION="${LB_COMPRESSION}" - -# \$LB_ZSYNC: set zsync -# (Default: ${LB_ZSYNC}) -LB_ZSYNC="${LB_ZSYNC}" - -# \${LB_BUILD_WITH_CHROOT: control if we build binary images chrooted -# (Default: ${LB_BUILD_WITH_CHROOT}) -# DO NEVER, *NEVER*, *N*E*V*E*R* SET THIS OPTION to false. -LB_BUILD_WITH_CHROOT="${LB_BUILD_WITH_CHROOT}" - -# \$LB_DEBIAN_INSTALLER: set debian-installer -# (Default: ${LB_DEBIAN_INSTALLER}) -LB_DEBIAN_INSTALLER="${LB_DEBIAN_INSTALLER}" - -# \$LB_DEBIAN_INSTALLER_DISTRIBUTION: set debian-installer suite -# (Default: empty) -LB_DEBIAN_INSTALLER_DISTRIBUTION="${LB_DEBIAN_INSTALLER_DISTRIBUTION}" - -# \$LB_DEBIAN_INSTALLER_PRESEEDFILE: set debian-installer preseed filename/url -# (Default: ${LB_DEBIAN_INSTALLER_PRESEEDFILE}) -LB_DEBIAN_INSTALLER_PRESEEDFILE="${LB_DEBIAN_INSTALLER_PRESEEDFILE}" - -# \$LB_DEBIAN_INSTALLER_GUI: toggle use of GUI debian-installer -# (Default: ${LB_DEBIAN_INSTALLER_GUI}) -LB_DEBIAN_INSTALLER_GUI="${LB_DEBIAN_INSTALLER_GUI}" - -# \$LB_GRUB_SPLASH: set custom grub splash -# (Default: empty) -LB_GRUB_SPLASH="${LB_GRUB_SPLASH}" - -# \$LB_HDD_LABEL: set hdd label -# (Default: ${LB_HDD_LABEL}) -LB_HDD_LABEL="${LB_HDD_LABEL}" - -# \$LB_HDD_SIZE: set hdd filesystem size -# (Default: ${LB_HDD_SIZE}) -LB_HDD_SIZE="${LB_HDD_SIZE}" - -# \$LB_ISO_APPLICATION: set iso author -# (Default: ${LB_ISO_APPLICATION}) -LB_ISO_APPLICATION="${LB_ISO_APPLICATION}" - -# \$LB_ISO_PREPARER: set iso preparer -# (Default: ${LB_ISO_PREPARER}) -LB_ISO_PREPARER="${LB_ISO_PREPARER}" - -# \$LB_ISO_PUBLISHER: set iso publisher -# (Default: ${LB_ISO_PUBLISHER}) -LB_ISO_PUBLISHER="${LB_ISO_PUBLISHER}" - -# \$LB_ISO_VOLUME: set iso volume (max 32 chars) -# (Default: ${LB_ISO_VOLUME}) -LB_ISO_VOLUME="${LB_ISO_VOLUME}" - -# \$LB_JFFS2_ERASEBLOCK: set jffs2 eraseblock size -# (Default: unset) -LB_JFFS2_ERASEBLOCK="" - -# \$LB_MEMTEST: set memtest -# (Default: ${LB_MEMTEST}) -LB_MEMTEST="${LB_MEMTEST}" - -# \$LB_WIN32_LOADER: set win32-loader -# (Default: ${LB_WIN32_LOADER}) -LB_WIN32_LOADER="${LB_WIN32_LOADER}" - -# \$LB_NET_ROOT_FILESYSTEM: set netboot filesystem -# (Default: ${LB_NET_ROOT_FILESYSTEM}) -LB_NET_ROOT_FILESYSTEM="${LB_NET_ROOT_FILESYSTEM}" - -# \$LB_NET_ROOT_MOUNTOPTIONS: set nfsopts -# (Default: empty) -LB_NET_ROOT_MOUNTOPTIONS="${LB_NET_ROOT_MOUNTOPTIONS}" - -# \$LB_NET_ROOT_PATH: set netboot server directory -# (Default: ${LB_NET_ROOT_PATH}) -LB_NET_ROOT_PATH="${LB_NET_ROOT_PATH}" - -# \$LB_NET_ROOT_SERVER: set netboot server address -# (Default: ${LB_NET_ROOT_SERVER}) -LB_NET_ROOT_SERVER="${LB_NET_ROOT_SERVER}" - -# \$LB_NET_COW_FILESYSTEM: set net client cow filesystem -# (Default: ${LB_NET_COW_FILESYSTEM}) -LB_NET_COW_FILESYSTEM="${LB_NET_COW_FILESYSTEM}" - -# \$LB_NET_COW_MOUNTOPTIONS: set cow mount options -# (Default: empty) -LB_NET_COW_MOUNTOPTIONS="${LB_NET_COW_MOUNTOPTIONS}" - -# \$LB_NET_COW_PATH: set cow directory -# (Default: ${LB_NET_COW_PATH}) -LB_NET_COW_PATH="${LB_NET_COW_PATH}" - -# \$LB_NET_COW_SERVER: set cow server -# (Default: ${LB_NET_COW_SERVER}) -LB_NET_COW_SERVER="${LB_NET_COW_SERVER}" - -# \$LB_NET_TARBALL: set net tarball -# (Default: ${LB_NET_TARBALL}) -LB_NET_TARBALL="${LB_NET_TARBALL}" - -# \$LB_FIRMWARE_BINARY: include firmware packages in debian-installer -# (Default: ${LB_FIRMWARE_BINARY}) -LB_FIRMWARE_BINARY="${LB_FIRMWARE_BINARY}" - -# \$LB_FIRMWARE_CHROOT: include firmware packages in debian-installer -# (Default: ${LB_FIRMWARE_CHROOT}) -LB_FIRMWARE_CHROOT="${LB_FIRMWARE_CHROOT}" - -# \$LB_SWAP_FILE_PATH: set swap file path -# (Default: ${LB_SWAP_FILE_PATH}) -LB_SWAP_FILE_PATH="${LB_SWAP_FILE_PATH}" - -# \$LB_SWAP_FILE_SIZE: set swap file size -# (Default: ${LB_SWAP_FILE_SIZE}) -LB_SWAP_FILE_SIZE="${LB_SWAP_FILE_SIZE}" - -# \$LB_SYSLINUX_THEME: set syslinux theme package -# (Default: ${LB_SYSLINUX_THEME}) -LB_SYSLINUX_THEME="${LB_SYSLINUX_THEME}" -EOF - -# Creating lb_source_* configuration -cat > config/source << EOF -# config/source - options for live-build(7), source stage - -# \$LB_SOURCE: set source option -# (Default: ${LB_SOURCE}) -LB_SOURCE="${LB_SOURCE}" - -# \$LB_SOURCE_IMAGES: set image type -# (Default: ${LB_SOURCE_IMAGES}) -LB_SOURCE_IMAGES="${LB_SOURCE_IMAGES}" -EOF - -mkdir -p auto -mkdir -p local/functions -mkdir -p local/scripts - -if [ "${CONFIG}" = "clone" ] # FIXME -then - # Read package selection - echo $(dpkg --get-selections | awk '{ print $1 }') > config/package-lists/local.list.chroot - - # 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/preseed/local.preseed.chroot - fi -fi - -# Checking defaults again -Check_defaults - -if [ "${_CLEAN}" = "true" ] -then - # Remove empty directories in config tree - rmdir --ignore-fail-on-non-empty config/*/ > /dev/null 2>&1 || true - rmdir --ignore-fail-on-non-empty config > /dev/null 2>&1 || true - rmdir --ignore-fail-on-non-empty auto > /dev/null 2>&1 || true - rmdir --ignore-fail-on-non-empty local/functions > /dev/null 2>&1 || true - rmdir --ignore-fail-on-non-empty local/scripts > /dev/null 2>&1 || true - rmdir --ignore-fail-on-non-empty local > /dev/null 2>&1 || true -fi - -# Creating stage file -Create_stagefile .build/config diff --git a/scripts/build/lb_source b/scripts/build/lb_source deleted file mode 100755 index d52e8d41f..000000000 --- a/scripts/build/lb_source +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Automatically populating config tree -if [ -x auto/config ] && [ ! -e .build/config ] -then - Echo_message "Automatically populating config tree." - lb config -fi - -# 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 - -if [ "${LB_SOURCE}" != "true" ] -then - exit 0 -fi - -#Require_stagefile - -# Setup cleanup function -Setup_cleanup - -# Enabling network in chroot -lb chroot_hosts install ${@} -lb chroot_resolv install ${@} -lb chroot_hostname install ${@} -lb chroot_archives source install ${@} - -# Preparing images -lb source_debian-live ${@} -lb source_debian ${@} -lb source_disk ${@} -lb source_checksums ${@} - -# Building images -lb source_iso ${@} -lb source_tar ${@} -lb source_hdd ${@} -lb source_virtual-hdd ${@} - -# Deconfiguring chroot -lb chroot_archives chroot remove ${@} -lb chroot_hostname remove ${@} -lb chroot_resolv remove ${@} -lb chroot_hosts remove ${@} diff --git a/scripts/build/lb_source_checksums b/scripts/build/lb_source_checksums deleted file mode 100755 index cf9cce0dc..000000000 --- a/scripts/build/lb_source_checksums +++ /dev/null @@ -1,91 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh - -# Setting static variables -DESCRIPTION="$(Echo 'create source checksums')" -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 [ "${LB_CHECKSUMS}" = "none" ] || [ "${LB_SOURCE}" != "true" ] -then - exit 0 -fi - -# Requiring stage file -Require_stagefile .build/config .build/source_debian - -# Checking stage file -Check_stagefile .build/source_checksums - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -for DIRECTORY in source/debian source/debian-live -do - if [ ! -d ${DIRECTORY} ] - then - continue - fi - - for CHECKSUM in ${LB_CHECKSUMS} - do - CHECKSUMS="$(echo ${CHECKSUM} | tr [a-z] [A-Z])SUMS" - - Echo_message "Begin creating source ${CHECKSUMS}..." - - # Remove old checksums - if [ -f ${DIRECTORY}/${CHECKSUMS} ] - then - rm -f ${DIRECTORY}/${CHECKSUMS} - fi - - # Calculating checksums - cd ${DIRECTORY} - find . -type f \ - \! -path './*SUMS' \ - -print0 | sort -z | xargs -0 ${CHECKSUM}sum > ../${CHECKSUMS} - -cat > ${CHECKSUMS} << EOF -This file contains the list of ${CHECKSUM} checksums of all files on this medium. - -You can verify them automatically with the 'integrity-check' boot parameter, -or, manually with: '${CHECKSUM}sum -c ${CHECKSUMS}'. - - -EOF - - cat ../${CHECKSUMS} >> ${CHECKSUMS} - rm -f ../${CHECKSUMS} - - cd "${OLDPWD}" - done - - # File list - cd ${DIRECTORY} - find . | sed -e 's|^.||g' | grep "^/" | sort > ../../$(echo ${DIRECTORY} | sed -e 's|/|.|').list - cd "${OLDPWD}" -done - -# Creating stage file -Create_stagefile .build/source_checksums diff --git a/scripts/build/lb_source_debian b/scripts/build/lb_source_debian deleted file mode 100755 index 95a155d88..000000000 --- a/scripts/build/lb_source_debian +++ /dev/null @@ -1,169 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_SOURCE}" != "true" ] -then - exit 0 -fi - -Echo_message "Begin downloading sources..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/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 -${LB_BOOTLOADER} -live-build -genisoimage -parted -squashfs-tools -mtd-tools -EOF - -case "${LB_BINARY_FILESYSTEM}" in - fat*) - echo "dosfstools" >> source-selection.txt - ;; - - ntfs) - case "${LB_PARENT_DISTRIBUTION}" in - squeeze) - echo "ntfsprogs" >> source-selection.txt - ;; - - *) - echo "ntfs-3g" >> source-selection.txt - ;; - esac - ;; -esac - -case "${LB_ARCHITECTURES}" in - amd64|i386) - -cat >> source-selection.txt << EOF -mtools -syslinux -grub -EOF - - if [ "${LB_MEMTEST}" != "false" ] && [ "${LB_MEMTEST}" != "none" ] - then - echo "${LB_MEMTEST}" >> source-selection.txt - fi - ;; - - powerpc) - echo "yaboot" >> source-selection.txt - ;; - - sparc) - -cat >> source-selection.txt << EOF -silo -sparc-utils -EOF - - ;; -esac - -if [ -n "${LB_TASKS}" ] -then - echo "${LB_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 .build/source_debian diff --git a/scripts/build/lb_source_debian-live b/scripts/build/lb_source_debian-live deleted file mode 100755 index 868d9d972..000000000 --- a/scripts/build/lb_source_debian-live +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_SOURCE}" != "true" ] -then - exit 0 -fi - -Echo_message "Begin copying live-build configuration..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/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 - -# Creating stage file -Create_stagefile .build/source_debian-live diff --git a/scripts/build/lb_source_disk b/scripts/build/lb_source_disk deleted file mode 100755 index e51b74df3..000000000 --- a/scripts/build/lb_source_disk +++ /dev/null @@ -1,129 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 - -case "${LB_SOURCE_IMAGES}" in - iso*|hdd*) - ;; - - *) - exit 0 - ;; -esac - -Echo_message "Begin installing disk information..." - -# Requiring stage file -Require_stagefile .build/config .build/bootstrap - -# Checking stage file -Check_stagefile .build/source_disk - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -mkdir -p source/.disk - -DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')" -DISTRIBUTION="${DISTRIBUTION}$(echo ${LB_DISTRIBUTION} | cut -b 2-)" -eval VERSION="$`echo RELEASE_${LB_DISTRIBUTION}`" - -case "${LB_MODE}" in - debian) - TITLE="Debian GNU/Linux" - STRING="Official Snapshot ${ARCHITECTURE}" - TRACE="project/trace/ftp-master.debian.org" - ;; - - ubuntu) - TITLE="Ubuntu" - STRING="Build ${ARCHITECTURE}" - TRACE="" - ;; - - kubuntu) - TITLE="Kubuntu" - STRING="Build ${ARCHITECTURE}" - TRACE="" - ;; - - progress) - TITLE="Progress Linux" - STRING="${VERSION} (${DISTRIBUTION}) - ${ARCHITECTURE}" - TRACE="project/trace/archive-master.progress-linux.org" - ;; - - *) - TITLE="Debian GNU/Linux" - STRING="Snapshot ${ARCHITECTURE}" - TRACE="" - ;; -esac - -if [ -n "${TRACE}" ] -then - case "${LB_DERIVATIVE}" in - true) - echo "$(echo ${LB_PARENT_MIRROR_BOOTSTRAP} | awk -F:// '{ print $2 }'): $(wget -q ${LB_PARENT_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \ - > source/.disk/archive_trace - - echo "$(echo ${LB_MIRROR_BOOTSTRAP} | awk -F:// '{ print $2 }'): $(wget -q ${LB_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \ - >> source/.disk/archive_trace - ;; - - false) - echo "$(wget -q ${LB_PARENT_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \ - > source/.disk/archive_trace - ;; - esac -fi - -case "${LB_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 .build/source_disk diff --git a/scripts/build/lb_source_hdd b/scripts/build/lb_source_hdd deleted file mode 100755 index 0d764079c..000000000 --- a/scripts/build/lb_source_hdd +++ /dev/null @@ -1,151 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_SOURCE}" != "true" ] -then - exit 0 -fi - -if ! In_list hdd "${LB_SOURCE_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building source hdd image..." - -# Requiring stage file -Require_stagefile .build/config .build/source_debian - -# Checking stage file -Check_stagefile .build/source_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} ${LB_BINARY_FILESYSTEM})" -dd if=/dev/zero of=source.img bs=1024k count=0 seek=${REAL_DIM} -FREELO="$(${LB_LOSETUP} -f)" -if [ ! -b chroot/${FREELO} ] -then - MAKEDEV="true" - - mv chroot/dev chroot/dev.tmp - find /dev | cpio -dmpu chroot -fi - -case "${LB_BINARY_FILESYSTEM}" in - ext2|ext3|ext4) - PARTITION_TYPE="ext2" - ;; - - fat16|fat32) - PARTITION_TYPE="${LB_BINARY_FILESYSTEM}" - ;; - - ntfs) - PARTITION_TYPE="NTFS" - ;; - - *) - Echo_error "Unsupported binary filesystem %s" "${LB_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 -Lodetach ${FREELO} - -Losetup $FREELO source.img 1 - -case "${LB_BINARY_FILESYSTEM}" in - ext2|ext3|ext4) - MKFS="${LB_BINARY_FILESYSTEM}" - MKFS_OPTIONS="-L ${LB_HDD_LABEL} -m 0" - ;; - - fat16) - MKFS="vfat" - MKFS_OPTIONS="-F 16 -n ${LB_HDD_LABEL}" - ;; - - fat32) - MKFS="vfat" - MKFS_OPTIONS="-F 32 -n ${LB_HDD_LABEL}" - ;; - - ntfs) - MKFS="ntfs" - MKFS_OPTIONS="-L ${LB_HDD_LABEL}" - ;; -esac - -Chroot chroot "mkfs.${MKFS} ${MKFS_OPTIONS} ${FREELO}" - -mkdir -p source.tmp -${LB_ROOT_COMMAND} mount ${FREELO} source.tmp -cp -r source/* source.tmp -${LB_ROOT_COMMAND} umount source.tmp -rmdir source.tmp -Lodetach ${FREELO} -Echo_warning "!!! The above error/warning messages can be ignored !!!" - -FREELO="$(${LB_LOSETUP} -f)" -Losetup "$FREELO" source.img 0 -Chroot chroot "parted -s ${FREELO} set 1 lba off" || true -Lodetach ${FREELO} - -if [ -n "${MAKEDEV}" ] -then - rm -rf chroot/dev - mv chroot/dev.tmp chroot/dev -fi - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .build/source_hdd diff --git a/scripts/build/lb_source_iso b/scripts/build/lb_source_iso deleted file mode 100755 index a9f0c281f..000000000 --- a/scripts/build/lb_source_iso +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_SOURCE}" != "true" ] -then - exit 0 -fi - -case "${LB_SOURCE_IMAGES}" in - iso*) - ;; - - *) - exit 0 - ;; -esac - -Echo_message "Begin building source iso image..." - -# Requiring stage file -Require_stagefile .build/config .build/source_debian - -# Checking stage file -Check_stagefile .build/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 "${LB_ISO_APPLICATION}" ] && [ "${LB_ISO_APPLICATION}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LB_ISO_APPLICATION}\"" -fi - -if [ -n "${LB_ISO_PREPARER}" ] && [ "${LB_ISO_PREPARER}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LB_ISO_PREPARER}\"" -fi - -if [ -n "${LB_ISO_PUBLISHER}" ] && [ "${LB_ISO_PUBLISHER}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LB_ISO_PUBLISHER}\"" -fi - -if [ -n "${LB_ISO_VOLUME}" ] && [ "${LB_ISO_VOLUME}" != "none" ] -then - GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LB_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 .build/source_iso diff --git a/scripts/build/lb_source_tar b/scripts/build/lb_source_tar deleted file mode 100755 index 0ef302e44..000000000 --- a/scripts/build/lb_source_tar +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_SOURCE}" != "true" ] -then - exit 0 -fi - -if ! In_list tar "${LB_SOURCE_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building source tarball..." -Echo_message "This may take a while." - -# Requiring stage file -Require_stagefile .build/config .build/source_debian - -# Checking stage file -Check_stagefile .build/source_tar - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -# Remove old source -rm -f source.debian.tar.bz2 source.debian.tar.gz source.debian.tar.lz source.debian.tar -rm -f source.debian-live.tar.bz2 source.debian-live.tar.gz source.debian-live.tar.lz source.debian-live.tar - -tar cf source.debian.tar source/debian -tar cf source.debian-live.tar source/debian-live - -case "${LB_COMPRESSION}" in - bzip2) - bzip2 ${BZIP2_OPTIONS} source.debian.tar - bzip2 ${BZIP2_OPTIONS} source.debian-live.tar - ;; - - gzip) - gzip ${GZIP_OPTIONS} source.debian.tar - gzip ${GZIP_OPTIONS} source.debian-live.tar - ;; - - lzip) - lzip ${LZIP_OPTIONS} source.debian.tar - lzip ${LZIP_OPTIONS} source.debian-live.tar - ;; - - xz) - xz ${XZ_OPTIONS} source.debian.tar - xz ${XZ_OPTIONS} source.debian-live.tar - ;; - - none) - ;; -esac - -# Creating stage file -Create_stagefile .build/source_tar diff --git a/scripts/build/lb_source_virtual-hdd b/scripts/build/lb_source_virtual-hdd deleted file mode 100755 index d37fa9aa0..000000000 --- a/scripts/build/lb_source_virtual-hdd +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_SOURCE}" != "true" ] -then - exit 0 -fi - -if ! In_list virtual-hdd "${LB_SOURCE_IMAGES}" -then - exit 0 -fi - -Echo_message "Begin building source virtual-hdd image..." - -# Requiring stage file -Require_stagefile .build/config .build/source_debian - -# Checking stage file -Check_stagefile .build/source_virtual-hdd - -# Checking lock file -Check_lockfile .lock - -# Creating lock file -Create_lockfile .lock - -if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] -then - case "${LB_BINARY_FILESYSTEM}" in - ext2|ext3|ext4) - Check_package chroot/sbin/mkfs.${LB_BINARY_FILESYSTEM} 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} ${LB_BINARY_FILESYSTEM})" -dd if=/dev/zero of=source-virtual.img bs=1024k count=0 seek=${REAL_DIM} - -if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] -then - mv source-virtual.img chroot - - case "${LB_BINARY_FILESYSTEM}" in - ext2|ext3|ext4) - Chroot chroot "mkfs.${LB_BINARY_FILESYSTEM} -F -m 0 source-virtual.img" - esac - - mv chroot/source-virtual.img ./ -else - case "${LB_BINARY_FILESYSTEM}" in - ext2|ext3|ext4) - mkfs.${LB_BINARY_FILESYSTEM} -F -m 0 source-virtual.img - ;; - esac -fi - -mkdir -p source.tmp -${LB_ROOT_COMMAND} mount -o loop source-virtual.img source.tmp -cp -r source/* source.tmp - -${LB_ROOT_COMMAND} umount source.tmp -rmdir source.tmp - -# Saving cache -Save_cache cache/packages.binary - -# Removing depends -Remove_package - -# Creating stage file -Create_stagefile .build/source_virtual-hdd diff --git a/scripts/build/lb_testroot b/scripts/build/lb_testroot deleted file mode 100755 index 9ded104c9..000000000 --- a/scripts/build/lb_testroot +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -## live-build(7) - System Build Scripts -## Copyright (C) 2006-2012 Daniel Baumann -## -## This program 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 -[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "$(${LB_ROOT_COMMAND} id -u)" -ne "0" ] -then - Echo_error "need root privileges" - exit 1 -fi diff --git a/scripts/build/source b/scripts/build/source new file mode 100755 index 000000000..d52e8d41f --- /dev/null +++ b/scripts/build/source @@ -0,0 +1,66 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Automatically populating config tree +if [ -x auto/config ] && [ ! -e .build/config ] +then + Echo_message "Automatically populating config tree." + lb config +fi + +# 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 + +if [ "${LB_SOURCE}" != "true" ] +then + exit 0 +fi + +#Require_stagefile + +# Setup cleanup function +Setup_cleanup + +# Enabling network in chroot +lb chroot_hosts install ${@} +lb chroot_resolv install ${@} +lb chroot_hostname install ${@} +lb chroot_archives source install ${@} + +# Preparing images +lb source_debian-live ${@} +lb source_debian ${@} +lb source_disk ${@} +lb source_checksums ${@} + +# Building images +lb source_iso ${@} +lb source_tar ${@} +lb source_hdd ${@} +lb source_virtual-hdd ${@} + +# Deconfiguring chroot +lb chroot_archives chroot remove ${@} +lb chroot_hostname remove ${@} +lb chroot_resolv remove ${@} +lb chroot_hosts remove ${@} diff --git a/scripts/build/source_checksums b/scripts/build/source_checksums new file mode 100755 index 000000000..cf9cce0dc --- /dev/null +++ b/scripts/build/source_checksums @@ -0,0 +1,91 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh + +# Setting static variables +DESCRIPTION="$(Echo 'create source checksums')" +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 [ "${LB_CHECKSUMS}" = "none" ] || [ "${LB_SOURCE}" != "true" ] +then + exit 0 +fi + +# Requiring stage file +Require_stagefile .build/config .build/source_debian + +# Checking stage file +Check_stagefile .build/source_checksums + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +for DIRECTORY in source/debian source/debian-live +do + if [ ! -d ${DIRECTORY} ] + then + continue + fi + + for CHECKSUM in ${LB_CHECKSUMS} + do + CHECKSUMS="$(echo ${CHECKSUM} | tr [a-z] [A-Z])SUMS" + + Echo_message "Begin creating source ${CHECKSUMS}..." + + # Remove old checksums + if [ -f ${DIRECTORY}/${CHECKSUMS} ] + then + rm -f ${DIRECTORY}/${CHECKSUMS} + fi + + # Calculating checksums + cd ${DIRECTORY} + find . -type f \ + \! -path './*SUMS' \ + -print0 | sort -z | xargs -0 ${CHECKSUM}sum > ../${CHECKSUMS} + +cat > ${CHECKSUMS} << EOF +This file contains the list of ${CHECKSUM} checksums of all files on this medium. + +You can verify them automatically with the 'integrity-check' boot parameter, +or, manually with: '${CHECKSUM}sum -c ${CHECKSUMS}'. + + +EOF + + cat ../${CHECKSUMS} >> ${CHECKSUMS} + rm -f ../${CHECKSUMS} + + cd "${OLDPWD}" + done + + # File list + cd ${DIRECTORY} + find . | sed -e 's|^.||g' | grep "^/" | sort > ../../$(echo ${DIRECTORY} | sed -e 's|/|.|').list + cd "${OLDPWD}" +done + +# Creating stage file +Create_stagefile .build/source_checksums diff --git a/scripts/build/source_debian b/scripts/build/source_debian new file mode 100755 index 000000000..95a155d88 --- /dev/null +++ b/scripts/build/source_debian @@ -0,0 +1,169 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_SOURCE}" != "true" ] +then + exit 0 +fi + +Echo_message "Begin downloading sources..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/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 +${LB_BOOTLOADER} +live-build +genisoimage +parted +squashfs-tools +mtd-tools +EOF + +case "${LB_BINARY_FILESYSTEM}" in + fat*) + echo "dosfstools" >> source-selection.txt + ;; + + ntfs) + case "${LB_PARENT_DISTRIBUTION}" in + squeeze) + echo "ntfsprogs" >> source-selection.txt + ;; + + *) + echo "ntfs-3g" >> source-selection.txt + ;; + esac + ;; +esac + +case "${LB_ARCHITECTURES}" in + amd64|i386) + +cat >> source-selection.txt << EOF +mtools +syslinux +grub +EOF + + if [ "${LB_MEMTEST}" != "false" ] && [ "${LB_MEMTEST}" != "none" ] + then + echo "${LB_MEMTEST}" >> source-selection.txt + fi + ;; + + powerpc) + echo "yaboot" >> source-selection.txt + ;; + + sparc) + +cat >> source-selection.txt << EOF +silo +sparc-utils +EOF + + ;; +esac + +if [ -n "${LB_TASKS}" ] +then + echo "${LB_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 .build/source_debian diff --git a/scripts/build/source_debian-live b/scripts/build/source_debian-live new file mode 100755 index 000000000..868d9d972 --- /dev/null +++ b/scripts/build/source_debian-live @@ -0,0 +1,62 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_SOURCE}" != "true" ] +then + exit 0 +fi + +Echo_message "Begin copying live-build configuration..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/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 + +# Creating stage file +Create_stagefile .build/source_debian-live diff --git a/scripts/build/source_disk b/scripts/build/source_disk new file mode 100755 index 000000000..e51b74df3 --- /dev/null +++ b/scripts/build/source_disk @@ -0,0 +1,129 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 + +case "${LB_SOURCE_IMAGES}" in + iso*|hdd*) + ;; + + *) + exit 0 + ;; +esac + +Echo_message "Begin installing disk information..." + +# Requiring stage file +Require_stagefile .build/config .build/bootstrap + +# Checking stage file +Check_stagefile .build/source_disk + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +mkdir -p source/.disk + +DISTRIBUTION="$(echo ${LB_DISTRIBUTION} | cut -b 1 | tr '[a-z]' '[A-Z]')" +DISTRIBUTION="${DISTRIBUTION}$(echo ${LB_DISTRIBUTION} | cut -b 2-)" +eval VERSION="$`echo RELEASE_${LB_DISTRIBUTION}`" + +case "${LB_MODE}" in + debian) + TITLE="Debian GNU/Linux" + STRING="Official Snapshot ${ARCHITECTURE}" + TRACE="project/trace/ftp-master.debian.org" + ;; + + ubuntu) + TITLE="Ubuntu" + STRING="Build ${ARCHITECTURE}" + TRACE="" + ;; + + kubuntu) + TITLE="Kubuntu" + STRING="Build ${ARCHITECTURE}" + TRACE="" + ;; + + progress) + TITLE="Progress Linux" + STRING="${VERSION} (${DISTRIBUTION}) - ${ARCHITECTURE}" + TRACE="project/trace/archive-master.progress-linux.org" + ;; + + *) + TITLE="Debian GNU/Linux" + STRING="Snapshot ${ARCHITECTURE}" + TRACE="" + ;; +esac + +if [ -n "${TRACE}" ] +then + case "${LB_DERIVATIVE}" in + true) + echo "$(echo ${LB_PARENT_MIRROR_BOOTSTRAP} | awk -F:// '{ print $2 }'): $(wget -q ${LB_PARENT_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \ + > source/.disk/archive_trace + + echo "$(echo ${LB_MIRROR_BOOTSTRAP} | awk -F:// '{ print $2 }'): $(wget -q ${LB_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \ + >> source/.disk/archive_trace + ;; + + false) + echo "$(wget -q ${LB_PARENT_MIRROR_BOOTSTRAP}/${TRACE} -O - | head -n 1)" \ + > source/.disk/archive_trace + ;; + esac +fi + +case "${LB_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 .build/source_disk diff --git a/scripts/build/source_hdd b/scripts/build/source_hdd new file mode 100755 index 000000000..0d764079c --- /dev/null +++ b/scripts/build/source_hdd @@ -0,0 +1,151 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_SOURCE}" != "true" ] +then + exit 0 +fi + +if ! In_list hdd "${LB_SOURCE_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building source hdd image..." + +# Requiring stage file +Require_stagefile .build/config .build/source_debian + +# Checking stage file +Check_stagefile .build/source_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} ${LB_BINARY_FILESYSTEM})" +dd if=/dev/zero of=source.img bs=1024k count=0 seek=${REAL_DIM} +FREELO="$(${LB_LOSETUP} -f)" +if [ ! -b chroot/${FREELO} ] +then + MAKEDEV="true" + + mv chroot/dev chroot/dev.tmp + find /dev | cpio -dmpu chroot +fi + +case "${LB_BINARY_FILESYSTEM}" in + ext2|ext3|ext4) + PARTITION_TYPE="ext2" + ;; + + fat16|fat32) + PARTITION_TYPE="${LB_BINARY_FILESYSTEM}" + ;; + + ntfs) + PARTITION_TYPE="NTFS" + ;; + + *) + Echo_error "Unsupported binary filesystem %s" "${LB_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 +Lodetach ${FREELO} + +Losetup $FREELO source.img 1 + +case "${LB_BINARY_FILESYSTEM}" in + ext2|ext3|ext4) + MKFS="${LB_BINARY_FILESYSTEM}" + MKFS_OPTIONS="-L ${LB_HDD_LABEL} -m 0" + ;; + + fat16) + MKFS="vfat" + MKFS_OPTIONS="-F 16 -n ${LB_HDD_LABEL}" + ;; + + fat32) + MKFS="vfat" + MKFS_OPTIONS="-F 32 -n ${LB_HDD_LABEL}" + ;; + + ntfs) + MKFS="ntfs" + MKFS_OPTIONS="-L ${LB_HDD_LABEL}" + ;; +esac + +Chroot chroot "mkfs.${MKFS} ${MKFS_OPTIONS} ${FREELO}" + +mkdir -p source.tmp +${LB_ROOT_COMMAND} mount ${FREELO} source.tmp +cp -r source/* source.tmp +${LB_ROOT_COMMAND} umount source.tmp +rmdir source.tmp +Lodetach ${FREELO} +Echo_warning "!!! The above error/warning messages can be ignored !!!" + +FREELO="$(${LB_LOSETUP} -f)" +Losetup "$FREELO" source.img 0 +Chroot chroot "parted -s ${FREELO} set 1 lba off" || true +Lodetach ${FREELO} + +if [ -n "${MAKEDEV}" ] +then + rm -rf chroot/dev + mv chroot/dev.tmp chroot/dev +fi + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .build/source_hdd diff --git a/scripts/build/source_iso b/scripts/build/source_iso new file mode 100755 index 000000000..a9f0c281f --- /dev/null +++ b/scripts/build/source_iso @@ -0,0 +1,114 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_SOURCE}" != "true" ] +then + exit 0 +fi + +case "${LB_SOURCE_IMAGES}" in + iso*) + ;; + + *) + exit 0 + ;; +esac + +Echo_message "Begin building source iso image..." + +# Requiring stage file +Require_stagefile .build/config .build/source_debian + +# Checking stage file +Check_stagefile .build/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 "${LB_ISO_APPLICATION}" ] && [ "${LB_ISO_APPLICATION}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LB_ISO_APPLICATION}\"" +fi + +if [ -n "${LB_ISO_PREPARER}" ] && [ "${LB_ISO_PREPARER}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LB_ISO_PREPARER}\"" +fi + +if [ -n "${LB_ISO_PUBLISHER}" ] && [ "${LB_ISO_PUBLISHER}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LB_ISO_PUBLISHER}\"" +fi + +if [ -n "${LB_ISO_VOLUME}" ] && [ "${LB_ISO_VOLUME}" != "none" ] +then + GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LB_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 .build/source_iso diff --git a/scripts/build/source_tar b/scripts/build/source_tar new file mode 100755 index 000000000..0ef302e44 --- /dev/null +++ b/scripts/build/source_tar @@ -0,0 +1,85 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_SOURCE}" != "true" ] +then + exit 0 +fi + +if ! In_list tar "${LB_SOURCE_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building source tarball..." +Echo_message "This may take a while." + +# Requiring stage file +Require_stagefile .build/config .build/source_debian + +# Checking stage file +Check_stagefile .build/source_tar + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +# Remove old source +rm -f source.debian.tar.bz2 source.debian.tar.gz source.debian.tar.lz source.debian.tar +rm -f source.debian-live.tar.bz2 source.debian-live.tar.gz source.debian-live.tar.lz source.debian-live.tar + +tar cf source.debian.tar source/debian +tar cf source.debian-live.tar source/debian-live + +case "${LB_COMPRESSION}" in + bzip2) + bzip2 ${BZIP2_OPTIONS} source.debian.tar + bzip2 ${BZIP2_OPTIONS} source.debian-live.tar + ;; + + gzip) + gzip ${GZIP_OPTIONS} source.debian.tar + gzip ${GZIP_OPTIONS} source.debian-live.tar + ;; + + lzip) + lzip ${LZIP_OPTIONS} source.debian.tar + lzip ${LZIP_OPTIONS} source.debian-live.tar + ;; + + xz) + xz ${XZ_OPTIONS} source.debian.tar + xz ${XZ_OPTIONS} source.debian-live.tar + ;; + + none) + ;; +esac + +# Creating stage file +Create_stagefile .build/source_tar diff --git a/scripts/build/source_virtual-hdd b/scripts/build/source_virtual-hdd new file mode 100755 index 000000000..d37fa9aa0 --- /dev/null +++ b/scripts/build/source_virtual-hdd @@ -0,0 +1,106 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "${LB_SOURCE}" != "true" ] +then + exit 0 +fi + +if ! In_list virtual-hdd "${LB_SOURCE_IMAGES}" +then + exit 0 +fi + +Echo_message "Begin building source virtual-hdd image..." + +# Requiring stage file +Require_stagefile .build/config .build/source_debian + +# Checking stage file +Check_stagefile .build/source_virtual-hdd + +# Checking lock file +Check_lockfile .lock + +# Creating lock file +Create_lockfile .lock + +if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] +then + case "${LB_BINARY_FILESYSTEM}" in + ext2|ext3|ext4) + Check_package chroot/sbin/mkfs.${LB_BINARY_FILESYSTEM} 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} ${LB_BINARY_FILESYSTEM})" +dd if=/dev/zero of=source-virtual.img bs=1024k count=0 seek=${REAL_DIM} + +if [ "${LB_BUILD_WITH_CHROOT}" = "true" ] +then + mv source-virtual.img chroot + + case "${LB_BINARY_FILESYSTEM}" in + ext2|ext3|ext4) + Chroot chroot "mkfs.${LB_BINARY_FILESYSTEM} -F -m 0 source-virtual.img" + esac + + mv chroot/source-virtual.img ./ +else + case "${LB_BINARY_FILESYSTEM}" in + ext2|ext3|ext4) + mkfs.${LB_BINARY_FILESYSTEM} -F -m 0 source-virtual.img + ;; + esac +fi + +mkdir -p source.tmp +${LB_ROOT_COMMAND} mount -o loop source-virtual.img source.tmp +cp -r source/* source.tmp + +${LB_ROOT_COMMAND} umount source.tmp +rmdir source.tmp + +# Saving cache +Save_cache cache/packages.binary + +# Removing depends +Remove_package + +# Creating stage file +Create_stagefile .build/source_virtual-hdd diff --git a/scripts/build/testroot b/scripts/build/testroot new file mode 100755 index 000000000..9ded104c9 --- /dev/null +++ b/scripts/build/testroot @@ -0,0 +1,32 @@ +#!/bin/sh + +## live-build(7) - System Build Scripts +## Copyright (C) 2006-2012 Daniel Baumann +## +## This program 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 +[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.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 [ "$(${LB_ROOT_COMMAND} id -u)" -ne "0" ] +then + Echo_error "need root privileges" + exit 1 +fi -- cgit v1.2.3