summaryrefslogtreecommitdiff
path: root/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'helpers')
-rw-r--r--helpers/Makefile11
-rwxr-xr-xhelpers/lh_binary46
-rwxr-xr-xhelpers/lh_binary_encryption73
-rwxr-xr-xhelpers/lh_binary_includes42
-rwxr-xr-xhelpers/lh_binary_iso54
-rwxr-xr-xhelpers/lh_binary_linuximage59
-rwxr-xr-xhelpers/lh_binary_localincludes39
-rwxr-xr-xhelpers/lh_binary_manifest34
-rwxr-xr-xhelpers/lh_binary_md5sum51
-rwxr-xr-xhelpers/lh_binary_memtest8697
-rwxr-xr-xhelpers/lh_binary_net53
-rwxr-xr-xhelpers/lh_binary_rootfs76
-rwxr-xr-xhelpers/lh_binary_syslinux152
-rwxr-xr-xhelpers/lh_binary_usb128
-rwxr-xr-xhelpers/lh_bootstrap19
-rwxr-xr-xhelpers/lh_bootstrap_cdebootstrap103
-rwxr-xr-xhelpers/lh_bootstrap_debootstrap93
-rwxr-xr-xhelpers/lh_build17
-rwxr-xr-xhelpers/lh_buildbinary200
-rwxr-xr-xhelpers/lh_buildsource84
-rwxr-xr-xhelpers/lh_cdebootstrap33
-rwxr-xr-xhelpers/lh_chroot50
-rwxr-xr-xhelpers/lh_chroot_apt141
-rwxr-xr-xhelpers/lh_chroot_debianchroot63
-rwxr-xr-xhelpers/lh_chroot_hacks60
-rwxr-xr-xhelpers/lh_chroot_hooks50
-rwxr-xr-xhelpers/lh_chroot_hosts66
-rwxr-xr-xhelpers/lh_chroot_linuximage74
-rwxr-xr-xhelpers/lh_chroot_localhooks53
-rwxr-xr-xhelpers/lh_chroot_localincludes39
-rwxr-xr-xhelpers/lh_chroot_localization695
-rwxr-xr-xhelpers/lh_chroot_localpackages75
-rwxr-xr-xhelpers/lh_chroot_localpackageslist73
-rwxr-xr-xhelpers/lh_chroot_packages65
-rwxr-xr-xhelpers/lh_chroot_packageslist76
-rwxr-xr-xhelpers/lh_chroot_proc61
-rwxr-xr-xhelpers/lh_chroot_resolv66
-rwxr-xr-xhelpers/lh_chroot_sources131
-rwxr-xr-xhelpers/lh_chroot_symlinks70
-rwxr-xr-xhelpers/lh_chroot_sysfs58
-rwxr-xr-xhelpers/lh_chroot_sysvinit50
-rwxr-xr-xhelpers/lh_chroot_sysvrc72
-rwxr-xr-xhelpers/lh_chroot_tasks55
-rwxr-xr-xhelpers/lh_clean71
-rwxr-xr-xhelpers/lh_cleanapt17
-rwxr-xr-xhelpers/lh_clone25
-rwxr-xr-xhelpers/lh_config240
-rwxr-xr-xhelpers/lh_configapt56
-rwxr-xr-xhelpers/lh_confignetwork60
-rwxr-xr-xhelpers/lh_debootstrap25
-rwxr-xr-xhelpers/lh_depends86
-rwxr-xr-xhelpers/lh_genrootfs76
-rwxr-xr-xhelpers/lh_hook21
-rwxr-xr-xhelpers/lh_includechroot11
-rwxr-xr-xhelpers/lh_installapt35
-rwxr-xr-xhelpers/lh_installlinux25
-rwxr-xr-xhelpers/lh_installmemtest86+24
-rwxr-xr-xhelpers/lh_installpackagelists29
-rwxr-xr-xhelpers/lh_installpackages9
-rwxr-xr-xhelpers/lh_installsyslinux79
-rwxr-xr-xhelpers/lh_installtasks12
-rwxr-xr-xhelpers/lh_localdeb10
-rwxr-xr-xhelpers/lh_losetup10
-rwxr-xr-xhelpers/lh_manifest13
-rwxr-xr-xhelpers/lh_md5sums17
-rwxr-xr-xhelpers/lh_patchchroot18
-rwxr-xr-xhelpers/lh_patchlinux32
-rwxr-xr-xhelpers/lh_patchnetwork18
-rwxr-xr-xhelpers/lh_patchrunlevel27
-rwxr-xr-xhelpers/lh_preseed23
-rwxr-xr-xhelpers/lh_setupapt124
-rwxr-xr-xhelpers/lh_source33
-rwxr-xr-xhelpers/lh_source_download67
-rwxr-xr-xhelpers/lh_source_generic53
-rwxr-xr-xhelpers/lh_source_iso53
-rwxr-xr-xhelpers/lh_source_net53
-rwxr-xr-xhelpers/lh_source_usb121
-rwxr-xr-xhelpers/lh_testroot4
-rwxr-xr-xhelpers/make-live324
-rw-r--r--helpers/overview.txt51
80 files changed, 4278 insertions, 1281 deletions
diff --git a/helpers/Makefile b/helpers/Makefile
deleted file mode 100644
index f2f31d4..0000000
--- a/helpers/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# Makefile
-
-all: install
-
-install:
- install -d -m 0755 $(DESTDIR)/usr/sbin/
- install -m 0755 lh_* $(DESTDIR)/usr/sbin
-
-uninstall:
-
-reinstall: install
diff --git a/helpers/lh_binary b/helpers/lh_binary
new file mode 100755
index 0000000..36dc722
--- /dev/null
+++ b/helpers/lh_binary
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+# lh_image(1) - building the images
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/image
+Set_defaults
+
+# Building root filesystem
+lh_binary_rootfs
+lh_binary_manifest
+lh_binary_encryption
+
+# Configuring chroot
+lh_chroot_proc install
+lh_chroot_sysfs install
+lh_chroot_hosts install
+lh_chroot_resolv install
+lh_chroot_sources install
+
+# Prepare images
+lh_binary_linuximage
+lh_binary_memtest86
+lh_binary_syslinux
+lh_binary_includes
+lh_binary_localincludes
+lh_binary_md5sum
+
+# Building images
+lh_binary_iso
+lh_binary_net
+lh_binary_usb
+
+# Deconfiguring chroot
+rm -f .stage/chroot_sources
+lh_chroot_resolv remove
+lh_chroot_hosts remove
+lh_chroot_sysfs remove
+lh_chroot_proc remove
diff --git a/helpers/lh_binary_encryption b/helpers/lh_binary_encryption
new file mode 100755
index 0000000..9df73b2
--- /dev/null
+++ b/helpers/lh_binary_encryption
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+# lh_binary_encryption(1) - encrypts rootfs
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/image
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+Require_stagefile "${LIVE_ROOT}"/.stage/binary_rootfs
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/binary_encryption
+
+if [ -n "${LIVE_ENCRYPTION}" ]
+then
+ if [ ! -x /usr/bin/aespipe ]
+ then
+ echo "E: aespipe is missing (FIXME)."
+ exit 1
+ fi
+
+ case "${LIVE_FILESYSTEM}" in
+ ext2)
+ ROOTFS="ext2"
+ ;;
+
+ plain)
+ echo "W: encryption not supported on plain filesystem."
+ exit 0
+ ;;
+
+ squashfs)
+ ROOTFS="squashfs"
+ ;;
+ esac
+
+ echo "Encrypting ${LIVE_ROOT}/binary/casper/filesystem.${ROOTFS} with ${LIVE_ENCRYPTION}..."
+
+ while true
+ do
+ cat ${LIVE_ROOT}/binary/casper/filesystem.${ROOTFS} | aespipe -e "${LIVE_ENCRYPTION}" -T > "${LIVE_ROOT}"/binary/casper/filesystem.${ROOTFS} && break
+
+ echo -n "Something went wrong... Retry? [YES/no] "
+
+ read ANSWER
+
+ if [ 'no' = "${ANSWER}" ]
+ then
+ unset ANSWER
+ break
+ fi
+ done
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/binary_encryption
+fi
diff --git a/helpers/lh_binary_includes b/helpers/lh_binary_includes
new file mode 100755
index 0000000..b170514
--- /dev/null
+++ b/helpers/lh_binary_includes
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# lh_binary_includes(1) - copy files into binary
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Read_conffile config/image
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/binary_includes
+
+if ls /usr/share/live-helper/includes/common/* &> /dev/null
+then
+ cp -r /usr/share/live-helper/includes/common/* "${LIVE_ROOT}"/binary
+fi
+
+if ls /usr/share/live-helper/includes/"${LIVE_BINARY_IMAGE}"/* &> /dev/null
+then
+ cp -r /usr/share/live-helper/includes/"${LIVE_BINARY_IMAGE}"/* "${LIVE_ROOT}"/binary
+fi
+
+# Creating stage file
+Create_stagefile "${LIVE_ROOT}"/.stage/binary_includes
diff --git a/helpers/lh_binary_iso b/helpers/lh_binary_iso
new file mode 100755
index 0000000..d39313f
--- /dev/null
+++ b/helpers/lh_binary_iso
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# lh_binary_iso(1) - build iso binary image
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/bootstrap
+Read_conffile config/image
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/binary_iso
+
+for IMAGE in ${LIVE_BINARY_IMAGE}
+do
+ if [ "${IMAGE}" = "iso" ]
+ then
+ # Remove old binary
+ if [ -f "${LIVE_ROOT}"/binary.iso ]
+ then
+ rm -f "${LIVE_ROOT}"/binary.iso
+ fi
+
+ # Create image
+ if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
+ then
+ ${LH_GENISOIMAGE} -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o "${LIVE_ROOT}"/"${LIVE_IMAGE}"binary.iso -r -J -l -V "${LIVE_ISO_VOLUME}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${LIVE_ROOT}"/binary ${LIVE_INCLUDE_IMAGE}
+ else
+ echo "W: Bootloader on your architecture not yet supported (Continuing in 5 seconds)."
+ sleep 5
+ ${LH_GENISOIMAGE} -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o "${LIVE_ROOT}"/"${LIVE_IMAGE}"binary.iso -r -J -l -V "${LIVE_ISO_VOLUME}" "${LIVE_ROOT}"/binary ${LIVE_INCLUDE_IMAGE}
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/binary_iso
+ fi
+done
diff --git a/helpers/lh_binary_linuximage b/helpers/lh_binary_linuximage
new file mode 100755
index 0000000..d332c53
--- /dev/null
+++ b/helpers/lh_binary_linuximage
@@ -0,0 +1,59 @@
+#!/bin/sh
+
+# lh_binary_linuximage(1) - install linux-image into binary
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/image
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/binary_linuximage
+
+# Removing initrd backup files
+rm -f "${LIVE_CHROOT}"/boot/initrd*bak*
+
+# Setting destination directory
+case "${LIVE_BINARY_IMAGE}" in
+ iso)
+ DESTDIR="${LIVE_ROOT}/binary/isolinux"
+ ;;
+
+ net)
+ DESTDIR="${LIVE_ROOT}/tftpboot"
+ ;;
+
+ usb)
+ DESTDIR="${LIVE_ROOT}/binary"
+ ;;
+esac
+
+# Creating directory
+if [ ! -d "${DESTDIR}" ]
+then
+ mkdir -p "${DESTDIR}"
+fi
+
+# Installing linux-image
+cp "${LIVE_CHROOT}"/boot/vmlinuz* "${DESTDIR}"/vmlinuz
+cp "${LIVE_CHROOT}"/boot/initrd.img* "${DESTDIR}"/initrd.gz
+
+# Creating stage file
+Create_stagefile "${LIVE_ROOT}"/.stage/binary_linuximage
diff --git a/helpers/lh_binary_localincludes b/helpers/lh_binary_localincludes
new file mode 100755
index 0000000..2aa6547
--- /dev/null
+++ b/helpers/lh_binary_localincludes
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# lh_binary_localincludes(1) - copy files into binary
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/binary_localincludes
+
+if ls "${LIVE_ROOT}"/config/binary_localincludes/* &> /dev/null
+then
+ cd "${LIVE_ROOT}"/config/binary_localincludes
+
+ # Copying includes
+ find . | cpio -dmpu "${LIVE_ROOT}"/binary
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/binary_localincludes
+fi
diff --git a/helpers/lh_binary_manifest b/helpers/lh_binary_manifest
new file mode 100755
index 0000000..d109280
--- /dev/null
+++ b/helpers/lh_binary_manifest
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+# lh_binary_manifest(1) - create manifest
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/image
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/binary_manifest
+
+# Add filesystem.manifest
+Chroot "dpkg --get-selections" | awk '{ print $1 }' | sort -u > "${LIVE_ROOT}"/binary/casper/filesystem.manifest
+
+# Creating stage file
+Create_stagefile "${LIVE_ROOT}"/.stage/binary_manifest
diff --git a/helpers/lh_binary_md5sum b/helpers/lh_binary_md5sum
new file mode 100755
index 0000000..9ab3f35
--- /dev/null
+++ b/helpers/lh_binary_md5sum
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# lh_binary_md5sum(1) - create md5sum.txt
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/image
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/binary_md5sum
+
+# Remove old md5sums
+if [ -f "${LIVE_ROOT}"/binary/md5sum.txt ]
+then
+ rm -f "${LIVE_ROOT}"/binary/md5sum.txt
+fi
+
+# Calculating md5sums
+cd "${LIVE_ROOT}"/binary
+find . -type f -print0 | xargs -0 md5sum > "${LIVE_ROOT}"/md5sum.txt
+cd "${OLDPWD}"
+
+if [ -d "${LIVE_INCLUDE_IMAGE}" ]
+then
+ cd "${LIVE_INCLUDE_IMAGE}"
+ find . -type f -print0 | xargs -0 md5sum >> "${LIVE_ROOT}"/md5sum.txt
+ cd "${OLDPWD}"
+fi
+
+mv "${LIVE_ROOT}"/md5sum.txt "${LIVE_ROOT}"/binary
+
+# Creating stage file
+Create_stagefile "${LIVE_ROOT}"/.stage/binary_md5sum
diff --git a/helpers/lh_binary_memtest86 b/helpers/lh_binary_memtest86
new file mode 100755
index 0000000..95952af
--- /dev/null
+++ b/helpers/lh_binary_memtest86
@@ -0,0 +1,97 @@
+#!/bin/sh
+
+# lh_binary_memtest86(1) - installs memtest86+
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/bootstrap
+Read_conffile config/image
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/binary_memtest86
+
+if [ "${LIVE_ARCHITECTURE}" != "amd64" ] && [ "${LIVE_ARCHITECTURE}" != "i386" ]
+then
+ echo "W: skipping binary_memtest86, foreign architecture."
+ exit 0
+fi
+
+if [ "${LIVE_MEMTEST86}" = "enabled" ]
+then
+ if [ ! -f "${LIVE_CHROOT}"/boot/memtest86+.bin ]
+ then
+ PACKAGES="${PACKAGES} memtest86+"
+ fi
+
+ if [ -n "${PACKAGES}" ]
+ then
+ # Installing symlinks
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get install --yes ${PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude install --assume-yes ${PACKAGES}"
+ ;;
+ esac
+ fi
+
+ case "${LIVE_BINARY_IMAGE}" in
+ iso)
+ DESTDIR="${LIVE_ROOT}/binary/isolinux"
+ ;;
+
+ net)
+ DESTDIR="${LIVE_ROOT}/tftpboot"
+ ;;
+
+ usb)
+ DESTDIR="${LIVE_ROOT}/binary"
+ ;;
+ esac
+
+ # Creating directory
+ if [ ! -d "${DESTDIR}" ]
+ then
+ mkdir -p "${DESTDIR}"
+ fi
+
+ # Installing memtest86+
+ cp "${LIVE_ROOT}"/chroot/boot/memtest86+.bin "${DESTDIR}"/memtest
+
+ if [ -n "${PACKAGES}" ]
+ then
+ # Removing syslinux
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get remove --purge --yes ${PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude purge --assume-yes ${PACKAGES}"
+ ;;
+ esac
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/binary_memtest86
+fi
diff --git a/helpers/lh_binary_net b/helpers/lh_binary_net
new file mode 100755
index 0000000..6281448
--- /dev/null
+++ b/helpers/lh_binary_net
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# lh_binary_net(1) - build netboot binary image
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/bootstrap
+Read_conffile config/image
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/binary_net
+
+for IMAGE in ${LIVE_BINARY_IMAGE}
+do
+ if [ "${IMAGE}" = "net" ]
+ then
+ # Remove old binary
+ if [ -f "${LIVE_ROOT}"/binary.tar.gz ]
+ then
+ rm -f "${LIVE_ROOT}"/binary.tar.gz
+ fi
+
+ # Creating image file
+ cd "${LIVE_ROOT}" && \
+ mv binary "`basename ${LIVE_SERVER_PATH}`" && \
+ cd .. && \
+ tar cfz binary.tar.gz "`basename ${LIVE_ROOT}`/`basename ${LIVE_SERVER_PATH}`" "`basename ${LIVE_ROOT}`/tftpboot" && \
+ mv binary.tar.gz "${LIVE_ROOT}" && \
+ cd "${OLDPWD}" && \
+ mv "`basename ${LIVE_SERVER_PATH}`" binary
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/binary_net
+ fi
+done
diff --git a/helpers/lh_binary_rootfs b/helpers/lh_binary_rootfs
new file mode 100755
index 0000000..bbb2153
--- /dev/null
+++ b/helpers/lh_binary_rootfs
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+# lh_binary_rootfs(1) - build rootfs image
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/image
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/binary_rootfs
+
+# Creating directory
+if [ ! -d "${LIVE_ROOT}"/binary/casper ]
+then
+ mkdir -p "${LIVE_ROOT}"/binary/casper
+fi
+
+case "${LIVE_FILESYSTEM}" in
+ ext2)
+ if [ -f "${LIVE_ROOT}"/binary/casper/filesystem.ext2 ]
+ then
+ rm -f "${LIVE_ROOT}"/binary/casper/filesystem.ext2
+ fi
+
+ DU_DIM="`du -ks ${LIVE_CHROOT} | cut -f1`"
+ REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 20`" # Just 5% more to be sure, need something more sophistcated here...
+
+ genext2fs --size-in-blocks=${REAL_DIM} --reserved-blocks=0 --root="${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.ext2
+ ;;
+
+ plain)
+ if [ -d "${LIVE_ROOT}"/binary/casper/filesystem.dir ]
+ then
+ rm -rf "${LIVE_ROOT}"/binary/casper/filesystem.dir
+ fi
+
+ cd "${LIVE_CHROOT}"
+ find . | cpio -pumd "${LIVE_ROOT}"/binary/casper/filesystem.dir
+ cd "${OLDPWD}"
+ ;;
+
+ squashfs)
+ if [ -f "${LIVE_ROOT}"/binary/casper/filesystem.squashfs ]
+ then
+ rm "${LIVE_ROOT}"/binary/casper/filesystem.squashfs
+ fi
+
+ if [ "${LIVE_FLAVOUR}" = "minimal" ] || [ "${LIVE_FLAVOUR}" = "mini" ]
+ then
+ mksquashfs "${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.squashfs -e "${LIVE_CHROOT}"/boot/vmlinuz* "${LIVE_CHROOT}"/boot/initrd.img* "${LIVE_CHROOT}"/vmlinuz "${LIVE_CHROOT}"/initrd.img "${LIVE_CHROOT}"/boot/config-* "${LIVE_CHROOT}"/boot/System.map-*
+ else
+ mksquashfs "${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.squashfs
+ fi
+ ;;
+esac
+
+# Creating stage file
+Create_stagefile "${LIVE_ROOT}"/.stage/binary_rootfs
diff --git a/helpers/lh_binary_syslinux b/helpers/lh_binary_syslinux
new file mode 100755
index 0000000..5384232
--- /dev/null
+++ b/helpers/lh_binary_syslinux
@@ -0,0 +1,152 @@
+#!/bin/sh
+
+# lh_binary_syslinux(1) - installs syslinux
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/bootstrap
+Read_conffile config/image
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/binary_syslinux
+
+if [ "${LIVE_ARCHITECTURE}" != "amd64" ] && [ "${LIVE_ARCHITECTURE}" != "i386" ]
+then
+ echo "W: skipping binary_syslinux, foreign architecture."
+ exit 0
+fi
+
+if [ "${LIVE_SYSLINUX}" = "enabled" ]
+then
+ if [ ! -f "${LIVE_CHROOT}"/usr/bin/syslinux ]
+ then
+ PACKAGES="${PACKAGES} syslinux"
+ fi
+
+ if [ -n "${PACKAGES}" ]
+ then
+ # Installing symlinks
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get install --yes ${PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude install --assume-yes ${PACKAGES}"
+ ;;
+ esac
+ fi
+
+ if [ -n "${LIVE_ENCRYPTION}" ]
+ then
+ LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} encryption=${LIVE_ENCRYPTION}"
+ fi
+
+ case "${LIVE_BINARY_IMAGE}" in
+ iso)
+ # Copying syslinux
+ mkdir -p "${LIVE_ROOT}"/binary/isolinux
+ cp "${LIVE_CHROOT}"/usr/lib/syslinux/isolinux.bin "${LIVE_ROOT}"/binary/isolinux
+ cp -r "${LIVE_TEMPLATES}"/syslinux/* "${LIVE_ROOT}"/binary/isolinux
+
+ # Copying splash screen
+ if [ -n "${LIVE_SYSLINUX_SPLASH}" ]
+ then
+ cp "${LIVE_SYSLINUX_SPLASH}" "${LIVE_ROOT}/binary/isolinux/splash.rle"
+ fi
+
+ # Configure syslinux templates
+ sed -i -e "s#LIVE_BOOTAPPEND#${LIVE_BOOTAPPEND}#" "${LIVE_ROOT}"/binary/isolinux/isolinux.cfg
+ sed -i -e "s/LIVE_DATE/${DATE}/" "${LIVE_ROOT}"/binary/isolinux/f1.txt
+ sed -i -e "s/LIVE_VERSION/${VERSION}/" "${LIVE_ROOT}"/binary/isolinux/f10.txt
+
+ # Remove unused files
+ rm -f "${LIVE_ROOT}"/binary/isolinux/pxelinux.cfg
+ ;;
+
+ net)
+ # Copying syslinux
+ mkdir -p "${LIVE_ROOT}"/tftpboot
+ cp "${LIVE_CHROOT}"/usr/lib/syslinux/pxelinux.0 "${LIVE_ROOT}"/tftpboot
+
+ # Install syslinux templates
+ mkdir -p "${LIVE_ROOT}"/tftpboot/pxelinux.cfg
+ cp -r "${LIVE_TEMPLATES}"/syslinux/* "${LIVE_ROOT}"/tftpboot/pxelinux.cfg
+ mv "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/pxelinux.cfg "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/default
+ sed -i -e 's#splash.rle#pxelinux.cfg/splash.rle#' "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/isolinux.txt
+
+ # Copying splash screen
+ if [ -n "${LIVE_SYSLINUX_SPLASH}" ]
+ then
+ cp "${LIVE_SYSLINUX_SPLASH}" "${LIVE_ROOT}/tftpboot/pxelinux.cfg/splash.rle"
+ fi
+
+ # Configure syslinux templates
+ sed -i -e "s/LIVE_SERVER_ADDRESS/${LIVE_SERVER_ADDRESS}/" -e "s#LIVE_SERVER_PATH#${LIVE_SERVER_PATH}#" -e "s#LIVE_BOOTAPPEND#${LIVE_BOOTAPPEND}#" "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/default
+ sed -i -e "s/LIVE_DATE/${DATE}/" "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/f1.txt
+ sed -i -e "s/LIVE_VERSION/${VERSION}/" "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/f10.txt
+
+ # Remove unused files
+ rm -f "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/isolinux.cfg
+ ;;
+
+ usb)
+ # Copying syslinux
+ mkdir -p "${LIVE_ROOT}"/binary
+ cp "${LIVE_CHROOT}"/usr/lib/syslinux/isolinux.bin "${LIVE_ROOT}"/binary/syslinux.bin
+ cp -r "${LIVE_TEMPLATES}"/syslinux/* "${LIVE_ROOT}"/binary
+ mv "${LIVE_ROOT}"/binary/isolinux.cfg "${LIVE_ROOT}"/binary/syslinux.cfg
+ mv "${LIVE_ROOT}"/binary/isolinux.txt "${LIVE_ROOT}"/binary/syslinux.txt
+ sed -i -e "s/isolinux.txt/syslinux.txt/" "${LIVE_ROOT}"/binary/syslinux.cfg
+
+ # Copying splash screen
+ if [ -n "${LIVE_SYSLINUX_SPLASH}" ]
+ then
+ cp "${LIVE_SYSLINUX_SPLASH}" "${LIVE_ROOT}/binary/splash.rle"
+ fi
+
+ # Configure syslinux templates
+ sed -i -e "s#LIVE_BOOTAPPEND#${LIVE_BOOTAPPEND}#" "${LIVE_ROOT}"/binary/syslinux.cfg
+ sed -i -e "s/LIVE_DATE/${DATE}/" "${LIVE_ROOT}"/binary/f1.txt
+ sed -i -e "s/LIVE_VERSION/${VERSION}/" "${LIVE_ROOT}"/binary/f10.txt
+
+ # Remove unused files
+ rm -f "${LIVE_ROOT}"/binary/pxelinux.cfg
+ ;;
+ esac
+
+ if [ -n "${PACKAGES}" ]
+ then
+ # Removing syslinux
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get remove --purge --yes ${PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude purge --assume-yes ${PACKAGES}"
+ ;;
+ esac
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/binary_syslinux
+fi
diff --git a/helpers/lh_binary_usb b/helpers/lh_binary_usb
new file mode 100755
index 0000000..ec0d13f
--- /dev/null
+++ b/helpers/lh_binary_usb
@@ -0,0 +1,128 @@
+#!/bin/sh
+
+# lh_binary_usb(1) - build binary image
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/bootstrap
+Read_conffile config/image
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/binary_usb
+
+for IMAGE in ${LIVE_BINARY_IMAGE}
+do
+ if [ "${IMAGE}" = "usb" ]
+ then
+ if [ ! -f "${LIVE_CHROOT}"/sbin/mkdosfs ]
+ then
+ PACKAGES="${PACKAGES} dosfstools"
+ fi
+
+ if [ ! -f "${LIVE_CHROOT}"/usr/bin/mtools ]
+ then
+ PACKAGES="${PACKAGES} mtools"
+ fi
+
+ if [ ! -f "${LIVE_CHROOT}"/sbin/parted ]
+ then
+ PACKAGES="${PACKAGES} parted"
+ fi
+
+ if [ ! -f "${LIVE_CHROOT}"/usr/bin/syslinux ]
+ then
+ PACKAGES="${PACKAGES} syslinux"
+ fi
+
+ if [ -n "${PACKAGES}" ]
+ then
+ # Installing packages
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get install --yes ${PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude install --assume-yes ${PACKAGES}"
+ ;;
+ esac
+ fi
+
+ # Remove old binary
+ if [ -f "${LIVE_ROOT}"/binary.img ]
+ then
+ rm -f "${LIVE_ROOT}"/binary.img
+ fi
+
+ # Everything which comes here needs to be cleaned up,
+ DU_DIM="`du -ms ${LIVE_ROOT}/binary | cut -f1`"
+ REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 20`" # Just 5% more to be sure, need something more sophistcated here...
+ dd if=/dev/zero of="${LIVE_ROOT}"/binary.img bs=1024k count=${REAL_DIM}
+ FREELO="`losetup -f`"
+ if [ ! -b "${LIVE_CHROOT}"/${FREELO} ]
+ then
+ MAKEDEV="true"
+ Chroot "cd /dev && ./MAKEDEV ${FREELO}"
+ fi
+
+ echo "!!! The following error/warning messages can be ignored !!!"
+ lh_losetup $FREELO "${LIVE_ROOT}"/binary.img 0
+ Chroot "parted -s ${FREELO} mklabel msdos" || true
+ Chroot "parted -s ${FREELO} mkpartfs primary fat16 0.0 100%" || true
+ Chroot "parted -s ${FREELO} set 1 boot on" || true
+ Chroot "parted -s ${FREELO} set 1 lba off" || true
+ cat "${LIVE_CHROOT}"/usr/lib/syslinux/mbr.bin > ${FREELO}
+ losetup -d ${FREELO}
+
+ lh_losetup $FREELO "${LIVE_ROOT}"/binary.img 1
+ Chroot "mkfs.msdos -n DEBIAN_LIVE ${FREELO}"
+ mkdir -p "${LIVE_ROOT}"/binary.tmp
+ mount ${FREELO} "${LIVE_ROOT}"/binary.tmp
+ cp -r "${LIVE_ROOT}"/binary/* "${LIVE_ROOT}"/binary.tmp
+ umount "${LIVE_ROOT}"/binary.tmp
+ rmdir "${LIVE_ROOT}"/binary.tmp
+ Chroot "syslinux ${FREELO}"
+ losetup -d ${FREELO}
+ echo "!!! The above error/warning messages can be ignored !!!"
+
+ if [ -n "${MAKEDEV}" ]
+ then
+ rm -f "${LIVE_CHROOT}"/${FREELO}
+ fi
+
+ if [ -n "${PACKAGES}" ]
+ then
+ # Removing packages
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get remove --purge --yes ${PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude purge --assume-yes ${PACKAGES}"
+ ;;
+ esac
+ fi
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/binary_usb
+done
diff --git a/helpers/lh_bootstrap b/helpers/lh_bootstrap
new file mode 100755
index 0000000..9d1170d
--- /dev/null
+++ b/helpers/lh_bootstrap
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+# lh_bootstrap(1) - bootstrap a Debian system
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/bootstrap
+Set_defaults
+
+# Bootstrapping system
+lh_bootstrap_"${LH_BOOTSTRAP}"
diff --git a/helpers/lh_bootstrap_cdebootstrap b/helpers/lh_bootstrap_cdebootstrap
new file mode 100755
index 0000000..c5602a6
--- /dev/null
+++ b/helpers/lh_bootstrap_cdebootstrap
@@ -0,0 +1,103 @@
+#!/bin/sh
+
+# lh_bootstrap_cdebootstrap(1) - bootstrap a Debian system with cdebootstrap(1)
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Ensure that a system is built as root
+lh_testroot
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/bootstrap
+Set_defaults
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating root directory
+if [ ! -d "${LIVE_ROOT}" ]
+then
+ mkdir -p "${LIVE_ROOT}"
+fi
+
+# Creating chroot directory
+if [ ! -d "${LIVE_CHROOT}" ]
+then
+ mkdir -p "${LIVE_CHROOT}"
+fi
+
+# Setting cdebootstrap options
+if [ -n "${LIVE_ARCHITECTURE}" ]
+then
+ CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --arch=${LIVE_ARCHITECTURE}"
+fi
+
+if [ -n "${LIVE_DISTRIBUTION_CONFIG}" ]
+then
+ CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --suite-config=${LIVE_DISTRIBUTION_CONFIG}"
+fi
+
+if [ "${LIVE_FLAVOUR}" = "mini" ] || [ "${LIVE_FLAVOUR}" = "minimal" ] || [ "${LIVE_FLAVOUR}" = "minimal-net" ]
+then
+ CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=minimal"
+else
+ CDEBOOTSTRAP_OPTIONS="${CDEBOOTSTRAP_OPTIONS} --flavour=standard"
+fi
+
+if [ -x "/usr/bin/cdebootstrap" ]
+then
+ # Restore old cache
+ if [ -d "${LIVE_ROOT}"/cache/bootstrap ]
+ then
+ mkdir -p "${LIVE_CHROOT}"/var/cache/bootstrap
+ cp "${LIVE_ROOT}"/cache/bootstrap/*.deb "${LIVE_CHROOT}"/var/cache/bootstrap
+ fi
+
+ if [ "${LH_CACHE}" = "enabled" ]
+ then
+ # Executing cdebootstrap (download-only)
+ cdebootstrap ${CDEBOOTSTRAP_OPTIONS} --download-only "${LIVE_DISTRIBUTION}" "${LIVE_CHROOT}" "${LIVE_MIRROR}"
+
+ # Removing old cache
+ if [ -d "${LIVE_ROOT}"/cache/bootstrap ]
+ then
+ rm -f "${LIVE_ROOT}"/cache/bootstrap/*.deb
+ fi
+
+ # Saving new cache
+ if [ ! -d "${LIVE_ROOT}"/cache/bootstrap ]
+ then
+ mkdir -p "${LIVE_ROOT}"/cache/bootstrap
+ fi
+
+ cp "${LIVE_CHROOT}"/var/cache/bootstrap/*.deb "${LIVE_ROOT}"/cache/bootstrap
+ fi
+
+ # Executing cdebootstrap (regular run)
+ cdebootstrap ${CDEBOOTSTRAP_OPTIONS} "${LIVE_DISTRIBUTION}" "${LIVE_CHROOT}" "${LIVE_MIRROR}"
+else
+ echo "E: Can't process file /usr/bin/cdebootstrap (FIXME)"
+ exit 1
+fi
+
+# Removing bootstrap cache
+if [ -d "${LIVE_CHROOT}/var/cache/bootstrap" ]
+then
+ rm -rf "${LIVE_CHROOT}"/var/cache/bootstrap
+fi
+
+# Creating stage file
+Create_stagefile "${LIVE_ROOT}"/.stage/bootstrap
diff --git a/helpers/lh_bootstrap_debootstrap b/helpers/lh_bootstrap_debootstrap
new file mode 100755
index 0000000..42009cb
--- /dev/null
+++ b/helpers/lh_bootstrap_debootstrap
@@ -0,0 +1,93 @@
+#!/bin/sh
+
+# lh_bootstrap_debootstrap(1) - bootstrap a Debian system with debootstrap(8)
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Ensure that a system is built as root
+lh_testroot
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/bootstrap
+Set_defaults
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating root directory
+if [ ! -d "${LIVE_ROOT}" ]
+then
+ mkdir -p "${LIVE_ROOT}"
+fi
+
+# Creating chroot directory
+if [ ! -d "${LIVE_CHROOT}" ]
+then
+ mkdir -p "${LIVE_CHROOT}"
+fi
+
+# Setting debootstrap options
+if [ -n "${LIVE_ARCHITECTURE}" ]
+then
+ DEBOOTSTRAP_OPTIONS="${DEBOOTSTRAP_OPTIONS} --arch ${LIVE_ARCHITECTURE}"
+fi
+
+if [ -n "${LIVE_BOOTSTRAP_CONFIG}" ]
+then
+ LIVE_DEBOOTSTRAP_SCRIPT="/usr/lib/debootstrap/scripts/${LIVE_BOOTSTRAP_CONFIG}"
+fi
+
+if [ -x "/usr/sbin/debootstrap" ]
+then
+ # Restore old cache
+ if [ -d "${LIVE_ROOT}"/cache/bootstrap ]
+ then
+ mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives
+ cp "${LIVE_ROOT}"/cache/bootstrap/*.deb "${LIVE_CHROOT}"/var/cache/apt/archives
+ fi
+
+ if [ "${LH_CACHE}" = "enabled" ]
+ then
+ # Executing debootstrap (download-only)
+ debootstrap ${DEBOOTSTRAP_OPTIONS} --download-only "${LIVE_DISTRIBUTION}" "${LIVE_CHROOT}" "${LIVE_MIRROR}" "${LIVE_DEBOOTSTRAP_SCRIPT}"
+
+ # Removing old cache
+ if [ -d "${LIVE_ROOT}"/cache/bootstrap ]
+ then
+ rm -f "${LIVE_ROOT}"/cache/bootstrap/*.deb
+ fi
+
+ # Saving new cache
+ if [ ! -d "${LIVE_ROOT}"/cache/bootstrap ]
+ then
+ mkdir -p "${LIVE_ROOT}"/cache/bootstrap
+ fi
+
+ cp "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb "${LIVE_ROOT}"/cache/bootstrap
+ fi
+
+ # Executing debootstrap (regular run)
+ debootstrap ${DEBOOTSTRAP_OPTIONS} "${LIVE_DISTRIBUTION}" "${LIVE_CHROOT}" "${LIVE_MIRROR}" "${LIVE_DEBOOTSTRAP_SCRIPT}"
+else
+ echo "E: Can't process file /usr/bin/debootstrap (FIXME)"
+ exit 1
+fi
+
+# Removing bootstrap cache
+rm -rf "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb
+
+# Creating stage file
+Create_stagefile "${LIVE_ROOT}"/.stage/bootstrap
diff --git a/helpers/lh_build b/helpers/lh_build
new file mode 100755
index 0000000..1d839a9
--- /dev/null
+++ b/helpers/lh_build
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# lh_build(1) - build a Debian system
+
+set -e
+
+# Bootstrapping system
+lh_bootstrap
+
+# Customizing chroot
+lh_chroot
+
+# Building binary image
+lh_binary
+
+# Building source image
+lh_source
diff --git a/helpers/lh_buildbinary b/helpers/lh_buildbinary
deleted file mode 100755
index 2a11c9b..0000000
--- a/helpers/lh_buildbinary
+++ /dev/null
@@ -1,200 +0,0 @@
-#!/bin/sh
-
-# lh_buildbinary
-
-if [ ! -f "${LIVE_ROOT}"/.stage/image_binary ]
-then
- # Configure chroot
- lh_patchchroot apply
- lh_patchrunlevel apply
-
- # Configure network
- lh_patchnetwork apply
-
- mkdir -p "${LIVE_ROOT}"/binary/casper
- for MANIFEST in "${LIVE_ROOT}"/filesystem.manifest*
- do
- if [ -e "${MANIFEST}" ]; then
- mv "${MANIFEST}" "${LIVE_ROOT}"/binary/casper/
- fi
- done
-
- if [ "${LIVE_TYPE}" = "Net" ]
- then
- # Mount proc
- mount proc-live -t proc "${LIVE_CHROOT}"/proc
-
- # Installing smbfs
- lh_chroot "aptitude install --assume-yes smbfs"
-
- # Unmount proc
- umount "${LIVE_CHROOT}"/proc
-
- if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
- then
- if [ ! -d "${LIVE_CHROOT}"/etc/initramfs-tools ]
- then
- mkdir "${LIVE_CHROOT}"/etc/initramfs-tools
- fi
-
- # Configuring initramfs for NFS
-cat >> "${LIVE_CHROOT}"/etc/initramfs-tools/initramfs.conf << EOF
-MODULES=netboot
-BOOT=nfs
-NFSROOT=auto
-EOF
- lh_chroot "update-initramfs -tu"
- fi
- fi
-
- lh_cleanapt
-
- # Switching package indices to default
- if [ "${LIVE_GENERIC_INDICES}" = "yes" ]
- then
- lh_setupapt default
- lh_configapt deapply-proxy
- lh_configapt deapply-recommends
- fi
-
- # Deconfigure network
- lh_patchnetwork deapply
-
- # Deconfigure chroot
- lh_patchrunlevel deapply
- lh_patchchroot deapply
-
- # Generating rootfs image
- lh_genrootfs
-
- # Configure chroot
- lh_patchchroot apply
- lh_patchrunlevel apply
-
- # Configure network
- lh_patchnetwork apply
-
- lh_cleanapt
-
- # Switching package indices to custom
- lh_setupapt custom
- lh_configapt apply-proxy
- lh_configapt apply-recommends
-
- case "${LIVE_TYPE}" in
- Iso)
- TYPE=iso
- ;;
- Usb)
- TYPE=usb
- ;;
- Net)
- TYPE=net
- ;;
- esac
-
- # Mount proc
- mount proc-live -t proc "${LIVE_CHROOT}"/proc
-
- # Install depends
- lh_depends install $TYPE
-
- # Installing syslinux
- lh_installsyslinux $TYPE
-
- # Installing linux-image
- lh_installlinux $TYPE
-
- # Installing memtest
- lh_installmemtest86+ $TYPE
-
- # Deconfigure network
- lh_patchnetwork deapply
-
- # Deconfigure chroot
- lh_patchrunlevel deapply
- lh_patchchroot deapply
-
- # Installing templates
- if [ "${LIVE_FLAVOUR}" != "minimal" ] || [ "${LIVE_FLAVOUR}" != "mini" ]
- then
- if [ "${TYPE}" != "usb" ]
- then
- cp -r "${LIVE_TEMPLATES}"/common/* "${LIVE_ROOT}"/binary
- fi
-
- if [ "${TYPE}" = "iso" ] || [ "${TYPE}" = "usb" ]
- then
- cp -r "${LIVE_TEMPLATES}"/iso/* "${LIVE_ROOT}"/binary
- fi
- fi
-
- # Calculating md5sums
- lh_md5sums
-
- case "${TYPE}" in
- iso)
- if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
- then
- # Create image
- ${GENISOIMAGE} -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o "${LIVE_ROOT}"/"${LIVE_IMAGE}"binary.iso -r -J -l -V "${LIVE_DISK_VOLUME}" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table "${LIVE_ROOT}"/binary ${LIVE_INCLUDE_IMAGE}
- else
- echo "W: Bootloader on your architecture not yet supported (Continuing in 5 seconds)."
- sleep 5
- # Create image
- ${GENISOIMAGE} -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o "${LIVE_ROOT}"/"${LIVE_IMAGE}"binary.iso -r -J -l -V "${LIVE_DISK_VOLUME}" "${LIVE_ROOT}"/binary ${LIVE_INCLUDE_IMAGE}
- fi
- ;;
-
- net)
- cd "${LIVE_ROOT}" && \
- mv binary "`basename ${LIVE_SERVER_PATH}`" && \
- cd .. && \
- tar cfz binary.tar.gz "`basename ${LIVE_ROOT}`/`basename ${LIVE_SERVER_PATH}`" "`basename ${LIVE_ROOT}`/tftpboot" && \
- mv binary.tar.gz "${LIVE_ROOT}" && \
- cd "${OLDPWD}" && \
- mv "`basename ${LIVE_SERVER_PATH}`" binary
- ;;
-
- usb)
- # Everything which comes here needs to be cleaned up,
- DU_DIM="`du -ms ${LIVE_ROOT}/binary | cut -f1`"
- REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 20`" # Just 5% more to be sure, need something more sophistcated here...
- dd if=/dev/zero of="${LIVE_ROOT}"/binary.img bs=1024k count=${REAL_DIM}
-
- FREELO="`lh_chroot 'losetup -f'`"
-
- echo "!!! The following error/warning messages can be ignored !!!"
- lh_losetup $FREELO "${LIVE_ROOT}"/binary.img 0
- set +e
- lh_chroot "parted -s ${FREELO} mklabel msdos"
- lh_chroot "parted -s ${FREELO} mkpartfs primary fat16 0.0 100%"
- lh_chroot "parted -s ${FREELO} set 1 boot on"
- lh_chroot "parted -s ${FREELO} set 1 lba off"
- set -e
- cat "${LIVE_CHROOT}"/usr/lib/syslinux/mbr.bin > ${FREELO}
- losetup -d ${FREELO}
-
- lh_losetup $FREELO "${LIVE_ROOT}"/binary.img 1
- lh_chroot "mkfs.msdos -n DEBIAN_LIVE ${FREELO}"
- mkdir "${LIVE_ROOT}"/binary.tmp
- mount ${FREELO} "${LIVE_ROOT}"/binary.tmp
- cp -r "${LIVE_ROOT}"/binary/* "${LIVE_ROOT}"/binary.tmp
- umount "${LIVE_ROOT}"/binary.tmp
- rmdir "${LIVE_ROOT}"/binary.tmp
- lh_chroot "syslinux ${FREELO}"
- losetup -d ${FREELO}
-
- echo "!!! The above error/warning messages can be ignored !!!"
- ;;
- esac
-
- # Remove depends
- lh_depends remove $TYPE
-
- # Unmount proc
- umount "${LIVE_CHROOT}"/proc
-
- # Touching stage file
- touch "${LIVE_ROOT}"/.stage/image_binary
-fi
diff --git a/helpers/lh_buildsource b/helpers/lh_buildsource
deleted file mode 100755
index 836bd3c..0000000
--- a/helpers/lh_buildsource
+++ /dev/null
@@ -1,84 +0,0 @@
-#!/bin/sh
-
-# lh_buildsource.sh <type>
-
-if [ ! -f "${LIVE_ROOT}"/.stage/image_source ] && [ "${LIVE_SOURCE}" = "yes" ]
-then
- # Configure chroot
- lh_patchnetwork apply
-
- # Download sources
- lh_chroot "dpkg --get-selections" | awk '{ print $1 }' > "${LIVE_CHROOT}"/root/dpkg-selection.txt
- lh_chroot "xargs --arg-file=/root/dpkg-selection.txt apt-get source --download-only"
- rm -f "${LIVE_CHROOT}"/root/dpkg-selection.txt
-
- # Sort sources
- for DSC in "${LIVE_CHROOT}"/*.dsc
- do
- SOURCE="`awk '/Source:/ { print $2; }' ${DSC}`"
-
- if [ "`echo ${SOURCE} | cut -b 1-3`" == "lib" ]
- then
- LETTER="`echo ${SOURCE} | cut -b 1-4`"
- else
- LETTER="`echo ${SOURCE} | cut -b 1`"
- fi
-
- # Install directory
- install -d -m 0755 "${LIVE_ROOT}"/source/"${LETTER}"/"${SOURCE}"
-
- # Move files
- mv "${LIVE_CHROOT}"/"${SOURCE}"_* "${LIVE_ROOT}"/source/"${LETTER}"/"${SOURCE}"
- done
-
- case "${1}" in
- generic)
- # Create tarball
- tar cf source.tar "$LIVE_ROOT"/source
- ;;
-
- iso)
- # Create image
- ${GENISOIMAGE} -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o "${LIVE_ROOT}"/"${LIVE_IMAGE}"source.iso -r -J -l -V "${LIVE_DISK_VOLUME}" "${LIVE_ROOT}"/source
- ;;
-
- net)
- # Create tarball
- tar cfz source.tar.gz "${LIVE_ROOT}"/source
- ;;
-
- usb)
- # Create image
- DU_DIM="`du -ms ${LIVE_ROOT}/source | cut -f1`"
- REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 20`" # Just 5% more to be sure, need something more sophistcated here...
- dd if=/dev/zero of="${LIVE_ROOT}"/source.img bs=1024k count=${REAL_DIM}
- FREELO=`losetup -f`
-
- echo "!!! The following error/warning messages can be ignored !!!"
- lh_losetup $FREELO "${LIVE_ROOT}"/source.img 0
- set +e
- lh_chroot "parted -s ${FREELO} mklabel msdos"
- lh_chroot "parted -s ${FREELO} mkpartfs primary fat16 0.0 100%"
- lh_chroot "parted -s ${FREELO} set 1 lba off"
- set -e
- losetup -d ${FREELO}
-
- lh_losetup $FREELO "${LIVE_ROOT}"/source.img 1
- lh_chroot "mkfs.msdos -n DEBIAN_LIVE ${FREELO}"
- mkdir "${LIVE_ROOT}"/source.tmp
- mount ${FREELO} "${LIVE_ROOT}"/source.tmp
- cp -r "${LIVE_ROOT}"/source/* "${LIVE_ROOT}"/source.tmp
- umount "${LIVE_ROOT}"/source.tmp
- rmdir "${LIVE_ROOT}"/source.tmp
- losetup -d ${FREELO}
- echo "!!! The above error/warning messages can be ignored !!!"
- ;;
- esac
-
-
- # Deconfigure network
- lh_patchnetwork deapply
-
- # Touching stage file
- touch "${LIVE_ROOT}"/.stage/image_source
-fi
diff --git a/helpers/lh_cdebootstrap b/helpers/lh_cdebootstrap
deleted file mode 100755
index c1f0d7a..0000000
--- a/helpers/lh_cdebootstrap
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-if [ ! -f "${LIVE_ROOT}"/.stage/bootstrap ]
-then
- # Create chroot directory
- if [ ! -d "${LIVE_CHROOT}" ]
- then
- mkdir -p "${LIVE_CHROOT}"
- fi
-
- if [ -n "${LIVE_BOOTSTRAP_CONFIG}" ]; then
- SUITE_CONFIG="--suite-config ${LIVE_BOOTSTRAP_CONFIG}"
- fi
-
- # Bootstrap system
- if [ "${LIVE_FLAVOUR}" = "mini" ]
- then
- cdebootstrap --arch="${LIVE_ARCHITECTURE}" --flavour=minimal ${SUITE_CONFIG} "${LIVE_DISTRIBUTION}" "${LIVE_CHROOT}" "${LIVE_MIRROR}"
- else
- cdebootstrap --arch="${LIVE_ARCHITECTURE}" --flavour="${LIVE_FLAVOUR}" ${SUITE_CONFIG} "${LIVE_DISTRIBUTION}" "${LIVE_CHROOT}" "${LIVE_MIRROR}"
- fi
-
- # Remove package cache
- rm -rf "${LIVE_CHROOT}"/var/cache/bootstrap
-
- # Touching stage file
- if [ ! -d "${LIVE_ROOT}"/.stage ]
- then
- mkdir "${LIVE_ROOT}"/.stage
- fi
-
- touch "${LIVE_ROOT}"/.stage/bootstrap
-fi
diff --git a/helpers/lh_chroot b/helpers/lh_chroot
index 511cdca..75f3174 100755
--- a/helpers/lh_chroot
+++ b/helpers/lh_chroot
@@ -1,6 +1,50 @@
#!/bin/sh
-# lh_chroot.sh <command>
+# lh_chroot(1) - customize the Debian system
-# Execute commands chrooted
-chroot "${LIVE_CHROOT}" /usr/bin/env -i HOME="/root" PATH="/usr/sbin:/usr/bin:/sbin:/bin" TERM="${TERM}" ftp_proxy="${LIVE_PROXY_FTP}" http_proxy="${LIVE_PPROXY_HTTP}" DEBIAN_FRONTEND="${LIVE_DEBCONF_FRONTEND}" DEBIAN_PRIORITY="${LIVE_DEBCONF_PRIORITY}" ${1}
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Configuring chroot
+lh_chroot_proc install
+lh_chroot_sysfs install
+lh_chroot_debianchroot install
+lh_chroot_sysvrc install
+lh_chroot_hosts install
+lh_chroot_resolv install
+lh_chroot_apt install
+lh_chroot_sources install
+lh_chroot_linuximage install
+
+# Customizing chroot
+lh_chroot_tasks
+lh_chroot_packageslist
+lh_chroot_packages
+lh_chroot_localpackages
+lh_chroot_localpackageslist
+lh_chroot_localization
+lh_chroot_hacks
+lh_chroot_localincludes
+lh_chroot_sysvinit
+lh_chroot_hooks
+lh_chroot_localhooks
+lh_chroot_symlinks
+
+# Deconfiguring chroot
+lh_chroot_linuximage remove
+lh_chroot_sources remove
+lh_chroot_apt remove
+lh_chroot_resolv remove
+lh_chroot_hosts remove
+lh_chroot_sysvrc remove
+lh_chroot_debianchroot remove
+lh_chroot_sysfs remove
+lh_chroot_proc remove
diff --git a/helpers/lh_chroot_apt b/helpers/lh_chroot_apt
new file mode 100755
index 0000000..3983923
--- /dev/null
+++ b/helpers/lh_chroot_apt
@@ -0,0 +1,141 @@
+#!/bin/sh
+
+# lh_chroot_apt(1) - manage /etc/apt/apt.conf
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+case "${1}" in
+ install)
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/chroot_apt
+
+ if [ "${LH_APT}" = "aptitude" ] && [ ! -d "${LIVE_CHROOT}"/etc/apt/apt.conf.d ]
+ then
+ mkdir -p "${LIVE_CHROOT}"/etc/apt/apt.conf.d
+ fi
+
+ # Configuring apt ftp proxy
+ if [ -n "${LH_APT_FTPPROXY}" ]
+ then
+ case "${LH_APT}" in
+ apt)
+ echo "Acquire::ftp::Proxy \"${LH_APT_FTPPROXY}\";" >> "${LIVE_CHROOT}"/etc/apt/apt.conf
+ ;;
+
+ aptitude)
+ echo "Acquire::ftp::Proxy \"${LH_APT_FTPPROXY}\";" > "${LIVE_CHROOT}"/etc/apt/apt.conf.d/ftp-proxy
+ ;;
+ esac
+ fi
+
+ # Configuring apt http proxy
+ if [ -n "${LH_APT_HTTPPROXY}" ]
+ then
+ case "${LH_APT}" in
+ apt)
+ echo "Acquire::http::Proxy \"${LH_APT_HTTPPROXY}\";" >> "${LIVE_CHROOT}"/etc/apt/apt.conf
+ ;;
+
+ aptitude)
+ echo "Acquire::http::Proxy \"${LH_APT_HTTPPROXY}\";" > "${LIVE_CHROOT}"/etc/apt/apt.conf.d/http-proxy
+ ;;
+ esac
+ fi
+
+ # Configuring apt pdiffs
+ if [ "${LH_APT_PDIFFS}" = "enabled" ]
+ then
+ case "${LH_APT}" in
+ apt)
+ echo "Acquire::PDiffs \"true\";" >> "${LIVE_CHROOT}"/etc/apt/apt.conf
+ ;;
+
+ aptitude)
+ echo "Acquire::PDiffs \"true\";" > "${LIVE_CHROOT}"/etc/apt/apt.conf.d/pdiffs
+ ;;
+ esac
+ else
+ case "${LH_APT}" in
+ apt)
+ echo "Acquire::PDiffs \"false\";" >> "${LIVE_CHROOT}"/etc/apt/apt.conf
+ ;;
+
+ aptitude)
+ echo "Acquire::PDiffs \"false\";" > "${LIVE_CHROOT}"/etc/apt/apt.conf.d/pdiffs
+ ;;
+ esac
+ fi
+
+ # Configuring apt recommends
+ if [ "${LH_APT_RECOMMENDS}" = "enabled" ]
+ then
+ case "${LH_APT}" in
+ apt)
+ echo "Aptitude::Recommends-Important \"true\";" >> "${LIVE_CHROOT}"/etc/apt/apt.conf
+ ;;
+
+ aptitude)
+ echo "Aptitude::Recommends-Important \"true\";" > "${LIVE_CHROOT}"/etc/apt/apt.conf.d/recommends
+ ;;
+ esac
+ else
+ case "${LH_APT}" in
+ apt)
+ echo "Aptitude::Recommends-Important \"false\";" >> "${LIVE_CHROOT}"/etc/apt/apt.conf
+ ;;
+
+ aptitude)
+ echo "Aptitude::Recommends-Important \"false\";" > "${LIVE_CHROOT}"/etc/apt/apt.conf.d/recommends
+ ;;
+ esac
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_apt
+ ;;
+
+ remove)
+ # Deconfiguring apt settings
+ rm -f "${LIVE_CHROOT}"/etc/apt/apt.conf
+
+ # Deconfiguring aptitude ftp proxy
+ rm -f "${LIVE_CHROOT}"/etc/apt/apt.conf.d/ftp-proxy
+
+ # Deconfiguring aptitude http proxy
+ rm -f "${LIVE_CHROOT}"/etc/apt/apt.conf.d/http-proxy
+
+ # Deconfiguring aptitude pdiffs
+ rm -f "${LIVE_CHROOT}"/etc/apt/apt.conf.d/pdiffs
+
+ # Deconfiguring aptitude recommends
+ rm -f "${LIVE_CHROOT}"/etc/apt/apt.conf.d/recommends
+
+ # Removing stage file
+ rm -f "${LIVE_ROOT}"/.stage/chroot_apt
+ ;;
+
+ *)
+ echo "Usage: ${0} {install|remove}"
+ exit 1
+ ;;
+esac
diff --git a/helpers/lh_chroot_debianchroot b/helpers/lh_chroot_debianchroot
new file mode 100755
index 0000000..6272fe0
--- /dev/null
+++ b/helpers/lh_chroot_debianchroot
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+# lh_chroot_debianchroot(1) - manage /etc/debian_chroot
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+case "${1}" in
+ install)
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/chroot_debianchroot
+
+ if [ -f "${LIVE_CHROOT}"/etc/debian_chroot ]
+ then
+ # Save chroot file
+ mv "${LIVE_CHROOT}"/etc/debian_chroot "${LIVE_CHROOT}"/etc/debian_chroot.orig
+ fi
+
+ # Create chroot file
+ echo "live" > "${LIVE_CHROOT}"/etc/debian_chroot
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_debianchroot
+ ;;
+
+ remove)
+ if [ -f "${LIVE_CHROOT}"/etc/debian_chroot.orig ]
+ then
+ # Restore chroot file
+ mv "${LIVE_CHROOT}"/etc/debian_chroot.orig "${LIVE_CHROOT}"/etc/debian_chroot
+ else
+ # Remove chroot file
+ rm -f "${LIVE_CHROOT}"/etc/debian_chroot
+ fi
+
+ # Removing stage file
+ rm -f "${LIVE_ROOT}"/.stage/chroot_debianchroot
+ ;;
+
+ *)
+ echo "Usage: ${0} {install|remove}"
+ exit 1
+ ;;
+esac
diff --git a/helpers/lh_chroot_hacks b/helpers/lh_chroot_hacks
new file mode 100755
index 0000000..5535458
--- /dev/null
+++ b/helpers/lh_chroot_hacks
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+# lh_chroot_hacks(1) - execute hacks in chroot
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/chroot_hacks
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+case "${LIVE_BINARY_IMAGE}" in
+ net)
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get install --yes smbfs"
+ ;;
+
+ aptitude)
+ Chroot "aptitude install --assume-yes smbfs"
+ ;;
+ esac
+
+ if [ ! -d "${LIVE_CHROOT}"/etc/initramfs-tools ]
+ then
+ mkdir "${LIVE_CHROOT}"/etc/initramfs-tools
+ fi
+
+ # Configuring initramfs for NFS
+cat >> "${LIVE_CHROOT}"/etc/initramfs-tools/initramfs.conf << EOF
+MODULES=netboot
+BOOT=nfs
+NFSROOT=auto
+EOF
+ ;;
+esac
+
+# Update initramfs
+Chroot "update-initramfs -tu"
+
+# Creating stage file
+Create_stagefile "${LIVE_ROOT}"/.stage/chroot_hacks
diff --git a/helpers/lh_chroot_hooks b/helpers/lh_chroot_hooks
new file mode 100755
index 0000000..727eed9
--- /dev/null
+++ b/helpers/lh_chroot_hooks
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# lh_chroot_hooks(1) - execute hooks in chroot
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/chroot_hooks
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Processing hooks
+if [ -n "${LIVE_PACKAGES_LIST}" ] && [ -f /usr/share/live-helper/hooks/"${LIVE_PACKAGES_LIST}" ]
+then
+ # Copying hook
+ cp /usr/share/live-helper/hooks/"${LIVE_PACKAGES_LIST}" "${LIVE_CHROOT}"/root
+
+ # Making hook executable
+ if [ -x "${LIVE_CHROOT}"/root/${LIVE_PACKAGES_LIST} ]
+ then
+ chmod +x "${LIVE_CHROOT}"/root/${LIVE_PACKAGES_LIST}
+ fi
+
+ # Executing hook
+ Chroot "/root/${LIVE_PACKAGES_LIST}"
+
+ # Removing hook
+ rm -f "${LIVE_CHROOT}"/root/"${LIVE_PACKAGE_LIST}"
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_hooks
+fi
diff --git a/helpers/lh_chroot_hosts b/helpers/lh_chroot_hosts
new file mode 100755
index 0000000..d1c1607
--- /dev/null
+++ b/helpers/lh_chroot_hosts
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+# lh_chroot_hosts(1) - manage /etc/hosts
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+case "${1}" in
+ install)
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/chroot_hosts
+
+ if [ -f "${LIVE_CHROOT}"/etc/hosts ]
+ then
+ # Save hosts file
+ cp "${LIVE_CHROOT}"/etc/hosts "${LIVE_CHROOT}"/etc/hosts.orig
+ fi
+
+ if [ -f /etc/hosts ]
+ then
+ # Copy hosts file
+ cp /etc/hosts "${LIVE_CHROOT}"/etc/hosts
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_hosts
+ ;;
+
+ remove)
+ if [ -f "${LIVE_CHROOT}"/etc/hosts.orig ]
+ then
+ # Restore hosts file
+ mv "${LIVE_CHROOT}"/etc/hosts.orig "${LIVE_CHROOT}"/etc/hosts
+ else
+ # Remove hosts file
+ rm -f "${LIVE_CHROOT}"/etc/hosts
+ fi
+
+ # Removing stage file
+ rm -f "${LIVE_ROOT}"/.stage/chroot_hosts
+ ;;
+
+ *)
+ echo "Usage: ${0} {install|remove}"
+ exit 1
+ ;;
+esac
diff --git a/helpers/lh_chroot_linuximage b/helpers/lh_chroot_linuximage
new file mode 100755
index 0000000..354c507
--- /dev/null
+++ b/helpers/lh_chroot_linuximage
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+# lh_chroot_linuximage(1) - manage /etc/kernel-img.conf
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+case "${1}" in
+ install)
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/chroot_linuximage
+
+ if [ -f "${LIVE_CHROOT}"/etc/kernel-img.conf ]
+ then
+ # Saving kernel-img.conf
+ cp "${LIVE_CHROOT}"/etc/kernel-img.conf "${LIVE_CHROOT}"/etc/kernel-img.conf.old
+ fi
+
+ # Configuring kernel-img.conf
+ echo "do_initrd = Yes" >> "${LIVE_CHROOT}"/etc/kernel-img.conf
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_linuximage
+
+ # Installing linux-image, modules and casper
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get install --yes ${LIVE_KERNEL_PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude install --assume-yes ${LIVE_KERNEL_PACKAGES}"
+ ;;
+ esac
+ ;;
+
+ remove)
+ if [ -f "${LIVE_CHROOT}"/etc/kernel-img.conf.old ]
+ then
+ # Restoring kernel-img.conf file
+ mv "${LIVE_CHROOT}"/etc/kernel-img.conf.old "${LIVE_CHROOT}"/etc/kernel-img.conf
+ else
+ # Removing kernel-img.conf file
+ rm -f "${LIVE_CHROOT}"/etc/kernel-img.conf
+ fi
+
+ # Removing stage file
+ rm -f "${LIVE_ROOT}"/.stage/chroot_linuximage
+ ;;
+
+ *)
+ echo "Usage: ${0} {install|remove}"
+ exit 1
+ ;;
+esac
diff --git a/helpers/lh_chroot_localhooks b/helpers/lh_chroot_localhooks
new file mode 100755
index 0000000..4d0bf3b
--- /dev/null
+++ b/helpers/lh_chroot_localhooks
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# lh_chroot_localhooks(1) - execute hooks in chroot
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/chroot_localhooks
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Processing localhooks
+if ls "${LIVE_ROOT}"/config/chroot_localhooks/* &> /dev/null
+then
+ for HOOK in "${LIVE_ROOT}"/config/chroot_localhooks/*
+ do
+ # Copying hook
+ cp "${HOOK}" "${LIVE_CHROOT}"/root
+
+ # Making hook executable
+ if [ -x "${LIVE_CHROOT}"/root/"${HOOK}" ]
+ then
+ chmod +x "${LIVE_CHROOT}"/root/${HOOK}
+ fi
+
+ # Executing hook
+ Chroot "/root/`basename ${HOOK}`"
+
+ # Removing hook
+ rm -f "${LIVE_CHROOT}"/"`basename ${HOOK}`"
+ done
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_localhooks
+fi
diff --git a/helpers/lh_chroot_localincludes b/helpers/lh_chroot_localincludes
new file mode 100755
index 0000000..4c0957a
--- /dev/null
+++ b/helpers/lh_chroot_localincludes
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+# lh_chroot_localincludes(1) - copy files into chroot
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/chroot_localincludes
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+if ls "${LIVE_ROOT}"/config/chroot_localincludes/* &> /dev/null
+then
+ cd "${LIVE_ROOT}"/config/chroot_localincludes
+
+ # Copying includes
+ find . | cpio -dmpu "${LIVE_CHROOT}"
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_localincludes
+fi
diff --git a/helpers/lh_chroot_localization b/helpers/lh_chroot_localization
new file mode 100755
index 0000000..bbf05bf
--- /dev/null
+++ b/helpers/lh_chroot_localization
@@ -0,0 +1,695 @@
+#!/bin/sh
+
+# lh_chroot_localization(1) - install localization packages into chroot
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/chroot_localization
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Setting localizations
+if [ -n "${LIVE_LANGUAGE}" ]
+then
+ case "${LIVE_LANGUAGE}" in
+ af)
+ # Afrikaans
+ LOCALIZATIONS="iceweasel kde openoffice"
+ ;;
+
+ as-in)
+ # Assamese
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ ar)
+ # Arabic
+ LOCALIZATIONS="iceweasel kde openoffice"
+ ;;
+
+ az)
+ # Azerbaijani
+ LOCALIZATIONS="kde"
+ ;;
+
+ be)
+ # Belarusian
+ LOCALIZATIONS="iceape iceweasel openoffice"
+
+ # Overrides
+ OPENOFFICE="be-by"
+ ;;
+
+ bg)
+ # Bulgarian
+ LOCALIZATIONS="icedove iceweasel kde openoffice"
+ ;;
+
+ bn)
+ # Bengali
+ LOCALIZATIONS="kde openoffice"
+ ;;
+
+ br)
+ # Breton
+ LOCALIZATIONS="kde openoffice"
+ ;;
+
+ bs)
+ # Bosnian
+ LOCALIZATION="kde openoffice"
+ ;;
+
+ ca)
+ # Catalan
+ LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice"
+ ;;
+
+ cs)
+ # Czech
+ LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice"
+ ;;
+
+ cy-gb)
+ # Welsh
+ LOCALIZATIONS="iceweasel kde koffice openoffice"
+
+ # Overrides
+ KDE="cy"
+ KOFFICE="cy"
+ OPENOFFICE="cy"
+ ;;
+
+ da)
+ # Danish
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+ ;;
+
+ de)
+ # German
+ LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice"
+ ;;
+
+ dz-bt)
+ # Dzongkha
+ LOCALIZATIONS="iceweasel openoffice"
+
+ # Overrides
+ OPENOFFICE="dz"
+ ;;
+
+ el)
+ # Greek
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+ ;;
+
+ en-gb)
+ # English (Great Britain)
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+
+ # Overrides
+ KDE="engb"
+ KOFFICE="engb"
+ ;;
+
+ en-za)
+ # English (South Africa)
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ eo)
+ # Esperanto
+ LOCALIZATIONS="kde openoffice"
+ ;;
+
+ es-ar)
+ # Spanish (Argentina)
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+
+ # Overrides
+ KDE="es"
+ KOFFICE="es"
+ OPENOFFICE="es"
+ ;;
+
+ es-es)
+ # Spanish (Spain)
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+
+ # Overrides
+ KDE="es"
+ KOFFICE="es"
+ OPENOFFICE="es"
+ ;;
+
+ et-ee)
+ # Estonian
+ LOCALIZATIONS="iceweasel kde koffice openoffice"
+
+ # Overrides
+ KDE="et"
+ KOFFICE="et"
+ OPENOFFICE="et"
+ ;;
+
+ eu)
+ # Basque
+ LOCALIZATIONS="icedove iceweasel kde koffice"
+ ;;
+
+ fa-ir)
+ # Persian
+ LOCALIZATIONS="iceweasel kde openoffice"
+
+ # Overrides
+ KDE="fa"
+ OPENOFFICE="fa"
+ ;;
+
+ fi)
+ # Finnish
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+ ;;
+
+ fr)
+ # French
+ LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice"
+ ;;
+
+ fur-it)
+ # Furlan
+ LOCALIZATIONS="iceweasel"
+ ;;
+
+ fy-nl)
+ # Frisian
+ LOCALIZATIONS="iceweasel kde"
+
+ # Overrides
+ KDE="fy"
+ ;;
+
+ ga-ie)
+ # Irish (Ireland)
+ LOCALIZATIONS="icedove iceweasel kde openoffice"
+
+ # Overrides
+ ICEDOVE="ga"
+ KDE="ga"
+ OPENOFFICE="ga"
+ ;;
+
+ gl)
+ # Galician
+ LOCALIZATIONS="kde"
+ ;;
+
+ gu-in)
+ # Gujarati (India)
+ LOCALIZATIONS="icedove iceweasel openoffice"
+
+ # Overrides
+ ICEDOVE="gu"
+ ;;
+
+ he)
+ # Hebrew
+ LOCALIZATIONS="iceape icedove iceweasel kde openoffice"
+ ;;
+
+ hi)
+ # Hindi
+ LOCALIZATIONS="kde openoffice"
+ ;;
+
+ hr)
+ # Croatian
+ LOCALIZATIONS="kde koffice openoffice"
+ ;;
+
+ hu)
+ # Hungarian
+ LOCALIZATIONS="icedove iceweasel kde openoffice"
+ ;;
+
+ in)
+ # Indic
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ is)
+ # Icelandic
+ LOCALIZATIONS="kde"
+ ;;
+
+ it)
+ # Italian
+ LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice"
+ ;;
+
+ ja)
+ # Japanese
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+ ;;
+
+ ka)
+ # Georgian
+ LOCALIZATIONS="iceweasel openoffice"
+ ;;
+
+ km)
+ # Khmer
+ LOCALIZATIONS="kde openoffice"
+ ;;
+
+ ko)
+ # Korean
+ LOCALIZATIONS="icedove iceweasel kde openoffice"
+ ;;
+
+ ku)
+ # Kurdish
+ LOCALIZATIONS="iceweasel openoffice"
+ ;;
+
+ lo)
+ # Lao
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ lt)
+ # Lithuanian
+ LOCALIZATIONS="icedove iceweasel kde openoffice"
+ ;;
+
+ lv)
+ # Latvian
+ LOCALIZATIONS="kde koffice openoffice"
+ ;;
+
+ mk)
+ # Macedonian
+ LOCALIZATIONS="icedove iceweasel kde openoffice"
+ ;;
+
+ ml-in)
+ # Malayalam
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ mn)
+ # Mongolian
+ LOCALIZATIONS="iceweasel kde"
+ ;;
+
+ ms)
+ # Malay
+ LOCALIZATIONS="kde koffice"
+ ;;
+
+ nb-no)
+ # Bokmaal (Norway)
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+
+ # Overrides
+ ICEDOVE="nb"
+ KDE="nb"
+ KOFFICE="nb"
+ OPENOFFICE="nb"
+ ;;
+
+ nds)
+ # Low Saxon
+ LOCALIZATIONS="kde"
+ ;;
+
+ ne)
+ # Nepalese
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ nl)
+ # Dutch
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+ ;;
+
+ nn-no)
+ # Nynorsk (Norway)
+ LOCALIZATIONS="iceweasel kde openoffice"
+
+ # Overrides
+ KDE="nn"
+ OPENOFFICE="nn"
+ ;;
+
+ nr)
+ # Ndebele
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ ns)
+ # Northernsotho
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ or-in)
+ # Oriya
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ pa-in)
+ # Punjabi (India)
+ LOCALIZATIONS="icedove iceweasel kde openoffice"
+
+ # Overrides
+ ICEDOVE="pa"
+ KDE="pa"
+ ;;
+
+ pl)
+ # Polish
+ LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice"
+ ;;
+
+ pt-br)
+ # Portugese (Brazil)
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+
+ # Overrides
+ KDE="ptbr"
+ KOFFICE="ptbr"
+ ;;
+
+ pt-pt)
+ # Portugese (Portugal)
+ LOCALIZATIONS="iceweasel kde koffice openoffice"
+
+ # Overrides
+ KDE="pt"
+ KOFFICE="pt"
+ OPENOFFICE="pt"
+ ;;
+
+ ro)
+ # Romanian
+ LOCALIZATIONS="iceweasel kde"
+ ;;
+
+ roa-es-val)
+ # Valencian (Spain)
+ LOCALIZATIONS="iceweasel"
+ ;;
+
+ ru)
+ # Russian
+ LOCALIZATIONS="iceape icedove iceweasel kde koffice openoffice"
+ ;;
+
+ rw)
+ # Kinarwanda
+ LOCALIZATIONS="kde openoffice"
+ ;;
+
+ se)
+ # Northern Sami
+ LOCALIZATIONS="kde"
+ ;;
+
+ sk)
+ # Slovak
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+ ;;
+
+ sl)
+ # Slovenian
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+ ;;
+
+ sr-cs)
+ # Serbian
+ LOCALIZATIONS="kde koffice openoffice"
+
+ # Overrides
+ KDE="sr"
+ KOFFICE="sr"
+ ;;
+
+ sr-latin)
+ # Latin Serbian
+ LOCALIZATIONS="kde koffice"
+
+ # Overrides
+ KDE="srlatin"
+ KOFFICE="srlatin"
+ ;;
+
+ ss)
+ # Swazi
+ LOCALIZATIONS="kde openoffice"
+ ;;
+
+ st)
+ # Southern_sotho
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ sv-se)
+ # Swedish
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+
+ # Overrides
+ ICEDOVE="sv"
+ KDE="sv"
+ KOFFICE="sv"
+ OPENOFFICE="sv"
+ ;;
+
+ ta-in)
+ # Tamil
+ LOCALIZATIONS="kde openoffice"
+
+ # Overrides
+ KDE="ta"
+ ;;
+
+ te-in)
+ # Telugu
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ tg)
+ # Tajik
+ LOCALIZATIONS="kde openoffice"
+ ;;
+
+ th)
+ # Thai
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ tn)
+ # Tswana
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ tr)
+ # Turkish
+ LOCALIZATIONS="icedove iceweasel kde kofffice openoffice"
+ ;;
+
+ ts)
+ # Tsonga
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ uk-ua)
+ # Ukrainian
+ LOCALIZATIONS="icedove iceweasel kde kofffice openoffice"
+
+ # Overrides
+ ICEDOVE="uk"
+ KDE="uk"
+ KDE="uk"
+ OPENOFFICE="uk"
+ ;;
+
+ uz)
+ # Uzbek
+ LOCALIZATIONS="kde"
+ ;;
+
+ ve)
+ # Venda
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ vi)
+ # Vietnamese
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ xh)
+ # Xhosa
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ za)
+ # South African
+ LOCALIZATIONS="openoffice"
+ ;;
+
+ zh-cn)
+ # Chinese (China)
+ LOCALIZATIONS="icedove iceweasel kde koffice openoffice"
+
+ # Overrides
+ KDE="zhcn"
+ KOFFICE="zhcn"
+ ;;
+
+ zh-tw)
+ # Chinese (Taiwan)
+ LOCALIZATIONS="iceweasel kde koffice openoffice"
+
+ # Overrides
+ KDE="zhtw"
+ KOFFICE="zhtw"
+ ;;
+
+ zu)
+ # Zulu
+ LOCALIZATIONS="openoffice"
+ ;;
+ esac
+
+ # Setting languages
+ if [ -z "${ICEAPE}" ]
+ then
+ ICEAPE="${LIVE_LANGUAGE}"
+ fi
+
+ if [ -z "${ICEDOCE}" ]
+ then
+ ICEDOVE="${LIVE_LANGUAGE}"
+ fi
+
+ if [ -z "${ICEWEASEL}" ]
+ then
+ ICEWEASEL="${LIVE_LANGUAGE}"
+ fi
+
+ if [ -z "${KDE}" ]
+ then
+ KDE="${LIVE_LANGUAGE}"
+ fi
+
+ if [ -z "${KOFFICE}" ]
+ then
+ KOFFICE="${LIVE_LANGUAGE}"
+ fi
+
+ if [ -z "${OPENOFFICE}" ]
+ then
+ OPENOFFICE="${LIVE_LANGUAGE}"
+ fi
+
+ # Setting packages
+ for LOCALIZATION in ${LOCALIZATIONS}
+ do
+ case "${LOCALZATION}" in
+ iceape)
+ if [ -f "${LIVE_CHROOT}"/usr/bin/iceape ]
+ then
+ PACKAGES="${PACKAGES} iceweasel-l10n-${ICEAPE}"
+ fi
+ ;;
+
+ icedove)
+ if [ -f "${LIVE_CHROOT}"/usr/bin/icedove ]
+ then
+ PACKAGES="${PACKAGES} icedove-locale-${ICEDOVE}"
+ fi
+ ;;
+
+ iceweasel)
+ if [ -f "${LIVE_CHROOT}"/usr/bin/iceweasel ]
+ then
+ PACKAGES="${PACKAGES} iceweasel-l10n-${ICEWEASEL}"
+ fi
+ ;;
+
+ kde)
+ if [ -f "${LIVE_CHROOT}"/usr/bin/kstart ]
+ then
+ PACKAGES="${PACKAGES} kde-i18n-${KDE}"
+ fi
+ ;;
+
+ koffice)
+ if [ -f "${LIVE_CHROOT}" ]
+ then
+ PACKAGES="${PACKAGES} koffice-i18n-${KOFFICE}"
+ fi
+ ;;
+
+ openoffice)
+ if [ -f "${LIVE_CHROOT}"/usr/bin/ooffice ]
+ then
+ PACKAGES="${PACKAGES} openoffice.org-l10n-${OPENOFFICE}"
+ fi
+ ;;
+ esac
+ done
+
+ # Restore old cache
+ if [ -d "${LIVE_ROOT}"/cache/chroot_localization ]
+ then
+ cp "${LIVE_ROOT}"/cache/chroot_localization/*.deb "${LIVE_CHROOT}"/var/cache/apt/archives
+ fi
+
+ # Installing packages
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get install --yes ${PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "apt-get install --assume-yes ${PACKAGES}"
+ ;;
+ esac
+
+ # Saving new cache
+ Chroot "apt-get autoclean"
+
+ if ls "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb &> /dev/null
+ then
+ if [ ! -d "${LIVE_ROOT}"/cache/chroot_localization ]
+ then
+ mkdir -p "${LIVE_ROOT}"/cache/chroot_localization
+ fi
+
+ mv -f "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb "${LIVE_ROOT}"/cache/chroot_localization
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_localization
+fi
diff --git a/helpers/lh_chroot_localpackages b/helpers/lh_chroot_localpackages
new file mode 100755
index 0000000..1ed4339
--- /dev/null
+++ b/helpers/lh_chroot_localpackages
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+# lh_chroot_localpackages(1) - install local packages into chroot
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/chroot_localpackages
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+if ls "${LIVE_ROOT}"/config/chroot_localpackages/*.deb &> /dev/null
+then
+ # Restore old cache
+ if [ -d "${LIVE_ROOT}"/cache/chroot_localpackages ]
+ then
+ cp "${LIVE_ROOT}"/cache/chroot_localpackages/*.deb "${LIVE_CHROOT}"/var/cache/apt/archives
+ fi
+
+ # Copying packages
+ cp "${LIVE_ROOT}"/config/chroot_localpackages/*.deb "${LIVE_CHROOT}"/root
+
+ # Installing packages
+ Chroot "find /root -name *.deb" > "${LIVE_CHROOT}"/root/localpackages
+ Chroot "xargs --arg-file=/root/localpackages dpkg -i" || true
+
+ # Cleaning dependencies
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get install -f --yes"
+ ;;
+
+ aptitude)
+ Chroot "aptitude install -f --assume-yes"
+ ;;
+ esac
+
+ # Removing package files
+ rm -f "${LIVE_CHROOT}"/root/*.deb
+ rm -f "${LIVE_CHROOT}"/root/localpackages
+
+ # Saving new cache
+ Chroot "apt-get autoclean"
+
+ if ls "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb &> /dev/null
+ then
+ if [ ! -d "${LIVE_ROOT}"/cache/chroot_localpackages ]
+ then
+ mkdir -p "${LIVE_ROOT}"/cache/chroot_localpackages
+ fi
+
+ mv -f "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb "${LIVE_ROOT}"/cache/chroot_localpackages
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_localpackages
+fi
diff --git a/helpers/lh_chroot_localpackageslist b/helpers/lh_chroot_localpackageslist
new file mode 100755
index 0000000..a7313cb
--- /dev/null
+++ b/helpers/lh_chroot_localpackageslist
@@ -0,0 +1,73 @@
+#!/bin/sh
+
+# lh_chroot_localpackageslist(1) - install local packages into chroot
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/chroot_localpackageslist
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+if ls "${LIVE_ROOT}"/config/chroot_localpackageslist/* &> /dev/null
+then
+ # Restore old cache
+ if [ -d "${LIVE_ROOT}"/cache/chroot_localpackageslist ]
+ then
+ cp "${LIVE_ROOT}"/cache/chroot_localpackageslist/*.deb "${LIVE_CHROOT}"/var/cache/apt/archives
+ fi
+
+ for PACKAGESLIST in "${LIVE_ROOT}"/config/chroot_localpackageslist/*
+ do
+ # Copying package list
+ grep -v "^#" "${PACKAGESLIST}" > "${LIVE_CHROOT}"/root/"`basename ${PACKAGESLIST}`"
+
+ # Installing package list
+ case "${LH_APT}" in
+ apt)
+ Chroot "xargs --arg-file=/root/`basename ${PACKAGESLIST}` apt-get install --yes"
+ ;;
+
+ aptitude)
+ Chroot "xargs --arg-file=/root/`basename ${PACKAGESLIST}` aptitude install --assume-yes"
+ ;;
+ esac
+
+ # Removing package list
+ rm -f "${LIVE_CHROOT}"/root/"`basename ${PACKAGESLIST}`"
+ done
+
+ # Saving new cache
+ Chroot "apt-get autoclean"
+
+ if ls "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb &> /dev/null
+ then
+ if [ ! -d "${LIVE_ROOT}"/cache/chroot_localpackageslist ]
+ then
+ mkdir -p "${LIVE_ROOT}"/cache/chroot_localpackageslist
+ fi
+
+ mv -f "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb "${LIVE_ROOT}"/cache/chroot_localpackageslist
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_localpackageslist
+fi
diff --git a/helpers/lh_chroot_packages b/helpers/lh_chroot_packages
new file mode 100755
index 0000000..14e9659
--- /dev/null
+++ b/helpers/lh_chroot_packages
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+# lh_chroot_packages(1) - install packages into chroot
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/bootstrap
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/chroot_packages
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+if [ -n "${LIVE_PACKAGES}" ]
+then
+ # Restore old cache
+ if [ -d "${LIVE_ROOT}"/cache/chroot ]
+ then
+ cp "${LIVE_ROOT}"/cache/chroot_packages/*.deb "${LIVE_CHROOT}"/var/cache/apt/archives
+ fi
+
+ # Installing packages
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get install --yes ${LIVE_PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude install --assume-yes ${LIVE_PACKAGES}"
+ ;;
+ esac
+
+ # Saving new cache
+ Chroot "apt-get autoclean"
+
+ if ls "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb &> /dev/null
+ then
+ if [ ! -d "${LIVE_ROOT}"/cache/chroot_packages ]
+ then
+ mkdir -p "${LIVE_ROOT}"/cache/chroot_packages
+ fi
+
+ mv -f "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb "${LIVE_ROOT}"/cache/chroot_packages
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_packages
+fi
diff --git a/helpers/lh_chroot_packageslist b/helpers/lh_chroot_packageslist
new file mode 100755
index 0000000..c222d7d
--- /dev/null
+++ b/helpers/lh_chroot_packageslist
@@ -0,0 +1,76 @@
+#!/bin/sh
+
+# lh_chroot_packageslist(1) - install packages list into chroot
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/chroot_packageslist
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+if [ -n "${LIVE_PACKAGES_LIST}" ]
+then
+ # Restore old cache
+ if [ -d "${LIVE_ROOT}"/cache/chroot_packageslist ]
+ then
+ cp "${LIVE_ROOT}"/cache/chroot_packageslist/*.deb "${LIVE_CHROOT}"/var/cache/apt/archives
+ fi
+
+ for LIST in ${LIVE_PACKAGES_LIST}
+ do
+ if [ -f /usr/share/live-helper/lists/"${LIST}" ]
+ then
+ # Copying package list
+ grep -v "^#" /usr/share/live-helper/lists/"${LIST}" > "${LIVE_CHROOT}"/root/"${LIST}"
+
+ # Installing package list
+ case "${LH_APT}" in
+ apt)
+ Chroot "xargs --arg-file=/root/${LIST} apt-get install --yes"
+ ;;
+
+ aptitude)
+ Chroot "xargs --arg-file=/root/${LIST} aptitude install --assume-yes"
+ ;;
+ esac
+
+ # Removing package list
+ rm -f "${LIVE_CHROOT}"/root/"${LIST}"
+ fi
+ done
+
+ # Saving new cache
+ Chroot "apt-get autoclean"
+
+ if ls "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb &> /dev/null
+ then
+ if [ ! -d "${LIVE_ROOT}"/cache/chroot_packageslist ]
+ then
+ mkdir -p "${LIVE_ROOT}"/cache/chroot_packageslist
+ fi
+
+ mv -f "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb "${LIVE_ROOT}"/cache/chroot_packageslist
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_packageslist
+fi
diff --git a/helpers/lh_chroot_proc b/helpers/lh_chroot_proc
new file mode 100755
index 0000000..1b78ecf
--- /dev/null
+++ b/helpers/lh_chroot_proc
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+# lh_chroot_proc(1) - mount /proc
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+case "${1}" in
+ install)
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/chroot_proc
+
+ if [ ! -d "${LIVE_CHROOT}"/proc ]
+ then
+ # Creating mountpoint
+ mkdir -p "${LIVE_CHROOT}"/proc
+ fi
+
+ # Mounting /proc
+ mount proc-live -t proc "${LIVE_CHROOT}"/proc
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_proc
+ ;;
+
+ remove)
+ # Workaround binfmt-support /proc locking
+ umount "${LIVE_CHROOT}"/proc/sys/fs/binfmt_misc > /dev/null 2>&1 || true
+
+ # Unmounting /proc
+ #fuser -km "${LIVE_CHROOT}"/proc
+ umount "${LIVE_CHROOT}"/proc > /dev/null 2>&1
+
+ # Removing stage file
+ rm -f "${LIVE_ROOT}"/.stage/chroot_proc
+ ;;
+
+ *)
+ echo "Usage: ${0} {install|remove}"
+ exit 1
+ ;;
+esac
diff --git a/helpers/lh_chroot_resolv b/helpers/lh_chroot_resolv
new file mode 100755
index 0000000..b6a7948
--- /dev/null
+++ b/helpers/lh_chroot_resolv
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+# lh_chroot_resolv(1) - manage /etc/resolv.conf
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+case "${1}" in
+ install)
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/chroot_resolv
+
+ if [ -f "${LIVE_CHROOT}"/etc/resolv.conf ]
+ then
+ # Save resolv file
+ cp "${LIVE_CHROOT}"/etc/resolv.conf "${LIVE_CHROOT}"/etc/resolv.conf.orig
+ fi
+
+ if [ -f /etc/resolv.conf ]
+ then
+ # Copy resolv file
+ cp /etc/resolv.conf "${LIVE_CHROOT}"/etc/resolv.conf
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_resolv
+ ;;
+
+ remove)
+ if [ -f "${LIVE_CHROOT}"/etc/resolv.conf.orig ]
+ then
+ # Restore resolv file
+ mv "${LIVE_CHROOT}"/etc/resolv.conf.orig "${LIVE_CHROOT}"/etc/resolv.conf
+ else
+ # Remove resolv file
+ rm -f "${LIVE_CHROOT}"/etc/resolv.conf
+ fi
+
+ # Removing stage file
+ rm -f "${LIVE_ROOT}"/.stage/chroot_resolv
+ ;;
+
+ *)
+ echo "Usage: ${0} {install|remove}"
+ exit 1
+ ;;
+esac
diff --git a/helpers/lh_chroot_sources b/helpers/lh_chroot_sources
new file mode 100755
index 0000000..8d4ddbe
--- /dev/null
+++ b/helpers/lh_chroot_sources
@@ -0,0 +1,131 @@
+#!/bin/sh
+
+# lh_chroot_sources(1) - manage /etc/apt/sources.list
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Read_conffile config/bootstrap #FIXME
+Read_conffile config/image
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+case "${1}" in
+ install)
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/chroot_sources
+
+ # Configure custom sources.list
+ echo "deb ${LIVE_MIRROR} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" > "${LIVE_CHROOT}"/etc/apt/sources.list
+
+ if [ "${LIVE_SOURCE}" = "enabled" ]
+ then
+ echo "deb-src ${LIVE_MIRROR} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
+ fi
+
+ if [ "${LIVE_SECURITY}" = "enabled" ]
+ then
+ if [ "${LIVE_DISTRIBUTION}" = "etch" ] || [ "${LIVE_DISTRIBUTION}" = "testing" ]
+ then
+ echo "deb ${LIVE_MIRROR_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
+
+ if [ "${LIVE_SOURCE}" = "yes" ]
+ then
+ echo "deb-src ${LIVE_MIRROR_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
+ fi
+ fi
+ fi
+
+ # Installing aptitude
+ if [ "${LH_APT}" = "apt" ]
+ then
+ Chroot "apt-get update"
+ elif [ "${LH_APT}" = "aptitude" ]
+ then
+ if [ ! -x "${LH_CHROOT}"/usr/bin/aptitude ]
+ then
+ Chroot "apt-get update"
+ Chroot "apt-get install --yes --force-yes aptitude"
+ fi
+
+ Chroot "aptitude update"
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_sources
+ ;;
+
+ remove)
+ # Configure generic indices
+ if [ "${LH_APT_GENERIC}" = "enabled" ]
+ then
+ # Cleaning apt list cache
+ rm -rf "${LIVE_CHROOT}"/var/lib/apt/lists
+ mkdir -p "${LIVE_CHROOT}"/var/lib/apt/lists/partial
+
+ echo "deb ${LIVE_MIRROR_GENERIC} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" > "${LIVE_CHROOT}"/etc/apt/sources.list
+
+ if [ "${LIVE_SOURCE}" = "enabled" ]
+ then
+ echo "deb-src ${LIVE_MIRROR_GENERIC} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
+ fi
+
+ if [ "${LIVE_SECURITY}" = "enabled" ]
+ then
+ if [ "${LIVE_DISTRIBUTION}" = "etch" ] || [ "${LIVE_DISTRIBUTION}" = "testing" ]
+ then
+ echo "deb ${LIVE_MIRROR_GENERIC_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
+
+ if [ "${LIVE_SOURCE}" = "yes" ]
+ then
+ echo "deb-src ${LIVE_MIRROR_GENERIC_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
+ fi
+ fi
+ fi
+
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get update"
+ ;;
+
+ aptitude)
+ Chroot "aptitude update"
+ ;;
+ esac
+ fi
+
+ # Cleaning apt packages cache
+ rm -rf "${LIVE_CHROOT}"/var/cache/apt
+ mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial
+
+ # Removing old files
+ rm -f "${LIVE_CHROOT}"/var/lib/dpkg/available-old
+ rm -f "${LIVE_CHROOT}"/var/lib/dpkg/diversions-old
+ rm -f "${LIVE_CHROOT}"/var/lib/dpkg/statoverride-old
+ rm -f "${LIVE_CHROOT}"/var/lib/dpkg/status-old
+
+ # Removing stage file
+ rm -f "${LIVE_ROOT}"/.stage/chroot_sources
+ ;;
+
+ *)
+ echo "Usage: ${0} {install|remove}"
+ exit 1
+ ;;
+esac
diff --git a/helpers/lh_chroot_symlinks b/helpers/lh_chroot_symlinks
new file mode 100755
index 0000000..8da149f
--- /dev/null
+++ b/helpers/lh_chroot_symlinks
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# lh_chroot_symlinks(1) - convert symlinks
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/chroot_symlinks
+
+if [ "${LIVE_SYMLINKS}" = "enabled" ]
+then
+ if [ -f "${LIVE_CHROOT}"/usr/bin/symlinks ]
+ then
+ SYMLINKS="true"
+ fi
+
+ if [ -n "${SYMLINKS}" ]
+ then
+ # Installing symlinks
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get install --yes symlinks"
+ ;;
+
+ aptitude)
+ Chroot "aptitude install --assume-yes symlinks"
+ ;;
+ esac
+ fi
+
+ # Converting symlinks
+ Chroot "symlinks -c -r -s /"
+
+ if [ -n "${SYMLINKS}" ]
+ then
+ # Removing symlinks
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get remove --purge --yes symlinks"
+ ;;
+
+ aptitude)
+ Chroot "aptitude purge --assume-yes symlinks"
+ ;;
+ esac
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_symlinks
+fi
diff --git a/helpers/lh_chroot_sysfs b/helpers/lh_chroot_sysfs
new file mode 100755
index 0000000..421d993
--- /dev/null
+++ b/helpers/lh_chroot_sysfs
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# lh_chroot_sysfs(1) - mount /sys
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+case "${1}" in
+ install)
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/chroot_sysfs
+
+ if [ ! -d "${LIVE_CHROOT}"/sys ]
+ then
+ # Create mountpoint
+ mkdir -p "${LIVE_CHROOT}"/sys
+ fi
+
+ # Mounting /sys
+ mount sys-live -t sysfs "${LIVE_CHROOT}"/sys
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_sysfs
+ ;;
+
+ remove)
+ # Unmounting /sys
+ #fuser -km "${LIVE_CHROOT}"/sys
+ umount "${LIVE_CHROOT}"/sys > /dev/null 2>&1
+
+ # Removing stage file
+ rm -f "${LIVE_ROOT}"/.stage/chroot_sysfs
+ ;;
+
+ *)
+ echo "Usage: ${0} {install|remove}"
+ exit 1
+ ;;
+esac
diff --git a/helpers/lh_chroot_sysvinit b/helpers/lh_chroot_sysvinit
new file mode 100755
index 0000000..e4746d6
--- /dev/null
+++ b/helpers/lh_chroot_sysvinit
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# lh_chroot_sysvinit(1) - configures sysvinit
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/chroot_sysvinit
+
+if [ "${LIVE_SYSVINIT}" = "disabled" ]
+then
+ # Disable all
+ for FILE in "${LIVE_CHROOT}"/etc/init.d/*
+ do
+ Chroot "update-rc.d -f `basename ${FILE}` remove"
+ done
+
+ # Re-enable all required (taken from -f standard chroot)
+ for PACKAGE in casper console-common cron dpkg ifupdown initscripts kbd klogd libc6 libdevmapper1.02 libselinux1 libsepol1 login makedev module-init-tools netbase openbsd-inetd procps sudo sysklogd udev util-linux
+ do
+ if [ -f "${LIVE_CHROOT}"/var/lib/dpkg/info/${PACKAGE}.postinst ]
+ then
+ # Re-configure if existing
+ Chroot "/var/lib/dpkg/info/${PACKAGE}.postinst configure"
+ fi
+ done
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_sysvinit
+fi
diff --git a/helpers/lh_chroot_sysvrc b/helpers/lh_chroot_sysvrc
new file mode 100755
index 0000000..4f4eeef
--- /dev/null
+++ b/helpers/lh_chroot_sysvrc
@@ -0,0 +1,72 @@
+#!/bin/sh
+
+# lh_chroot_sysvrc(1) - manage /usr/sbin/policy-rc.d
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+case "${1}" in
+ install)
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/chroot_sysvrc
+
+ if [ -f "${LIVE_CHROOT}"/usr/sbin/policy-rc.d ]
+ then
+ # Save policy-rc.d file
+ mv "${LIVE_CHROOT}"/usr/sbin/policy-rc.d "${LIVE_CHROOT}"/usr/sbin/policy-rc.d.orig
+ fi
+
+ # Create policy-rc.d file
+cat > "${LIVE_CHROOT}"/usr/sbin/policy-rc.d << EOF
+#!/bin/sh
+
+echo
+echo "Warning: invoke-rc.d policy in action. Skiping daemon starting"
+
+exit 101
+EOF
+
+ chmod 0755 "${LIVE_CHROOT}"/usr/sbin/policy-rc.d
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_sysvrc
+ ;;
+
+ remove)
+ if [ -f "${LIVE_CHROOT}"/usr/sbin/policy-rc.d.orig ]
+ then
+ # Restore policy-rc.d file
+ mv "${LIVE_CHROOT}"/usr/sbin/policy-rc.d.orig "${LIVE_CHROOT}"/usr/sbin/policy-rc.d
+ else
+ # Remove policy-rc.d file
+ rm -f "${LIVE_CHROOT}"/usr/sbin/policy-rc.d
+ fi
+
+ # Removing stage file
+ rm -f "${LIVE_ROOT}"/.stage/chroot_sysvrc
+ ;;
+
+ *)
+ echo "Usage: ${0} {install|remove}"
+ exit 1
+ ;;
+esac
diff --git a/helpers/lh_chroot_tasks b/helpers/lh_chroot_tasks
new file mode 100755
index 0000000..4959d76
--- /dev/null
+++ b/helpers/lh_chroot_tasks
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# lh_chroot_tasks(1) - install tasks into chroot
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/chroot
+Set_defaults
+
+# Requiring stage file
+Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+# Checking stage file
+Check_stagefile "${LIVE_ROOT}"/.stage/chroot_tasks
+
+# Checking lock file
+Check_lockfile "${LIVE_ROOT}"/.lock
+
+# Creating lock file
+Create_lockfile "${LIVE_ROOT}"/.lock
+
+if [ -n "${LIVE_TASKS}" ] && [ "${LH_APT}" = "aptitude" ]
+then
+ # Restore old cache
+ if [ -d "${LIVE_ROOT}"/cache/chroot_tasks ]
+ then
+ cp "${LIVE_ROOT}"/cache/chroot_tasks/*.deb "${LIVE_CHROOT}"/var/cache/apt/archives
+ fi
+
+ Chroot "aptitude install --assume-yes ${LIVE_TASKS}"
+
+ # Saving new cache
+ Chroot "apt-get autoclean"
+
+ if ls "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb &> /dev/null
+ then
+ if [ ! -d "${LIVE_ROOT}"/cache/chroot_tasks ]
+ then
+ mkdir -p "${LIVE_ROOT}"/cache/chroot_tasks
+ fi
+
+ mv -f "${LIVE_CHROOT}"/var/cache/apt/archives/*.deb "${LIVE_ROOT}"/cache/chroot_tasks
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/chroot_tasks
+fi
diff --git a/helpers/lh_clean b/helpers/lh_clean
new file mode 100755
index 0000000..f4c8960
--- /dev/null
+++ b/helpers/lh_clean
@@ -0,0 +1,71 @@
+#!/bin/sh
+
+# lh_clean(1) - clean up system build directories
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Ensure that a system is built as root
+lh_testroot
+
+# Reading configuration files
+Read_conffile config/common
+Set_defaults
+
+case "${1}" in
+ all)
+ "${0}" chroot
+ "${0}" binary
+ "${0}" stage
+ "${0}" source
+ ;;
+
+ cache)
+ rm -rf "${LIVE_ROOT}"/cache
+ ;;
+
+ chroot)
+ umount -f "${LIVE_CHROOT}"/sys > /dev/null 2>&1 || true
+ umount -f "${LIVE_CHROOT}"/proc > /dev/null 2>&1 || true
+ umount -f "${LIVE_CHROOT}"/lib/init/rw > /dev/null 2>&1 || true
+ umount -f "${LIVE_CHROOT}"/dev/shm > /dev/null 2>&1 || true
+ umount -f "${LIVE_CHROOT}"/dev/pts > /dev/null 2>&1 || true
+ umount -f "${LIVE_CHROOT}"/dev > /dev/null 2>&1 || true
+
+ rm -rf "${LIVE_CHROOT}"
+ ;;
+
+ binary)
+ rm -rf "${LIVE_ROOT}"/binary
+
+ rm -f "${LIVE_ROOT}"/binary.iso
+ rm -f "${LIVE_ROOT}"/binary.img
+ rm -f "${LIVE_ROOT}"/binary.tar.gz
+
+ rm -f "${LIVE_ROOT}"/.stage/binary*
+ ;;
+
+ stage)
+ rm -rf "${LIVE_ROOT}"/.stage
+ rm -f "${LIVE_ROOT}"/.lock
+ ;;
+
+ source)
+ rm -rf "${LIVE_ROOT}"/source
+
+ rm -f "${LIVE_ROOT}"/source.iso
+ rm -f "${LIVE_ROOT}"/source.img
+ rm -f "${LIVE_ROOT}"/source.tar.gz
+
+ rm -f "${LIVE_ROOT}"/.stage/source*
+ ;;
+
+ *)
+ "${0}" all
+ ;;
+esac
diff --git a/helpers/lh_cleanapt b/helpers/lh_cleanapt
deleted file mode 100755
index ec28865..0000000
--- a/helpers/lh_cleanapt
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-# lh_cleanapt
-
-# Clean apt packages cache
-rm -rf "${LIVE_CHROOT}"/var/cache/apt
-mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial
-
-# Clean apt list cache
-rm -rf "${LIVE_CHROOT}"/var/lib/apt/lists/*
-mkdir -p "${LIVE_CHROOT}"/var/lib/apt/lists/partial
-
-# Remove old files
-rm -f "${LIVE_CHROOT}"/var/lib/dpkg/available-old
-rm -f "${LIVE_CHROOT}"/var/lib/dpkg/diversions-old
-rm -f "${LIVE_CHROOT}"/var/lib/dpkg/statoverride-old
-rm -f "${LIVE_CHROOT}"/var/lib/dpkg/status-old
diff --git a/helpers/lh_clone b/helpers/lh_clone
deleted file mode 100755
index d89eba4..0000000
--- a/helpers/lh_clone
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-# lh_clone
-
-# Cloning existing system configuration
-if [ -d "${LIVE_CLONE}" ]
-then
- # Swapping chroot directories
- LIVE_CHROOT_TMP="${LIVE_CHROOT}"
- LIVE_CHROOT="${LIVE_CLONE}"
-
- # Extract debconf settings
- lh_chroot "aptitude install --assume-yes debconf-utils"
- lh_chroot "debconf-get-selections" > "${LIVE_ROOT}"/preseed.cloned
-
- # Extract package selection
- lh_chroot "dpkg --get-selections" | grep -v deinstall | cut -f1 > "${LIVE_ROOT}"/package-list.cloned
-
- # Restoring chroot directories
- LIVE_CHROOT="${LIVE_CHROOT_TMP}"
- LIVE_CHROOT_TMP=""
-
- LIVE_PRESEED="${LIVE_ROOT}/preseed.cloned"
- LIVE_PACKAGE_LIST_CLONED="${LIVE_ROOT}/package-list.cloned"
-fi
diff --git a/helpers/lh_config b/helpers/lh_config
index a664988..a9bdb98 100755
--- a/helpers/lh_config
+++ b/helpers/lh_config
@@ -1,26 +1,218 @@
#!/bin/sh
-# lh_config
-
-case "${1}" in
- disable-daemons)
- if [ "${LIVE_DAEMONS}" = "no" ]
- then
- # Disable all
- for FILE in "${LIVE_CHROOT}"/etc/init.d/*
- do
- lh_chroot "update-rc.d -f `basename ${FILE}` remove"
- done
-
- # Re-enable all required (taken from -f standard chroot)
- for PACKAGE in casper console-common cron dpkg ifupdown initscripts kbd klogd libc6 libdevmapper1.02 libselinux1 libsepol1 login makedev module-init-tools netbase openbsd-inetd procps sudo sysklogd udev util-linux
- do
- # Re-configure if existing
- if [ -f "${LIVE_CHROOT}"/var/lib/dpkg/info/${PACKAGE}.postinst ]
- then
- lh_chroot "/var/lib/dpkg/info/${PACKAGE}.postinst configure"
- fi
- done
- fi
- ;;
-esac
+# lh_make(1) - create sample configuration for live-helper(7)
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+Set_defaults
+
+# Creating configuration directory
+install -d -m 0755 "${LIVE_ROOT}"/config || true
+
+# Creating live-helper configuration
+cat > "${LIVE_ROOT}"/config/common << EOF
+# config/common: configuration for live-helper(7)
+
+# \$LH_APT: set package manager
+# (Default: ${LH_APT})
+LH_APT="${LH_APT}"
+
+# \$LH_APT_FTPPROXY: set apt/aptitude ftp proxy
+# (Default: autodetected or empty)
+LH_APT_FTPPROXY="${LH_APT_FTPPROXY}"
+
+# \$LH_APT_HTTPPROXY: set apt/aptitude http proxy
+# (Default: autodetected or empty)
+LH_APT_HTTPPROXY="${LH_APT_HTTPPROXY}"
+
+# \$LH_APT_GENERIC: set apt/aptitude generic indices
+# (Default: ${LH_APT_GENERIC})
+LH_APT_GENERIC="${LH_APT_GENERIC}"
+
+# \$LH_APT_PDIFFS: set apt/aptitude pdiff indices
+# (Default: ${LH_APT_PDIFFS})
+LH_APT_PDIFFS="${LH_APT_PDIFFS}"
+
+# \$LH_APT_RECOMMENDS: enable recommends
+# (Default: ${LH_APT_RECOMMENDS})
+LH_APT_RECOMMENDS="${LH_APT_RECOMMENDS}"
+
+# \$LH_BOOTSTRAP: select the bootstrap program
+# (Default: ${LH_BOOTSTRAP})
+LH_BOOTSTRAP="${LH_BOOTSTRAP}"
+
+# \$LH_CACHE: enable cache
+# (Default: ${LH_CACHE})
+LH_CACHE="${LH_CACHE}"
+
+# \$LH_DEBCONF_FRONTEND: set the debconf(1) frontend to use
+# (Default: ${LH_DEBCONF_FRONTEND})
+LH_DEBCONF_FRONTEND="${LH_DEBCONF_FRONTEND}"
+
+# \$LH_DEBCONF_PRIORITY: set the debconf(1) priority to use
+# (Default: ${LH_DEBCONF_PRIORITY})
+LH_DEBCONF_PRIORITY="${LH_DEBCONF_PRIORITY}"
+
+# \$LH_GENISOIMAGE: set the genisoimage program
+# (Default: autodetected)
+LH_GENISOIMAGE="${LH_GENISOIMAGE}"
+
+# \$LIVE_ROOT: set the root directory
+# (Default: \`pwd\`/debian-live)
+LIVE_ROOT="${LIVE_ROOT}"
+
+# \$LIVE_CHROOT: set the chroot directory
+# (Default: \${LIVE_ROOT}/chroot)
+LIVE_CHROOT="${LIVE_CHROOT}"
+EOF
+
+# Creating lh_chroot_* configuration
+cat > "${LIVE_ROOT}"/config/chroot << EOF
+# config/chroot: configuration for lh_chroot_*
+
+# \$LIVE_KERNEL: set the kernel flavour to use
+# (Default: autodetected)
+LIVE_KERNEL="${LIVE_KERNEL}"
+
+# \$LIVE_KERNEL: set the kernel packages to use
+# (Default: autodetected)
+#LIVE_KERNEL_PACKAGES
+
+# \$LIVE_LANGUAGE: set the language to use
+# (Default: empty)
+LIVE_LANGUAGE="${LIVE_LANGUAGE}"
+
+# \$LIVE_PACKAGES: set the packages to install
+# (Default: empty)
+LIVE_PACKAGES="${LIVE_PACKAGES}"
+
+# \$LIVE_PACKAGES_LIST: set the package list to install
+# (Default: ${LIVE_PACKAGES_LIST})
+LIVE_PACKAGES_LIST="${LIVE_PACKAGES_LIST}"
+
+# \$LIVE_TASKS: set the tasks to install
+# (Default: empty)
+LIVE_TASKS="${LIVE_TASKS}"
+
+# \$LIVE_SECURITY: enable security updates
+# (Default: ${LIVE_SECURITY})
+LIVE_SECURITY="${LIVE_SECURITY}"
+
+# \$LIVE_SYMLINKS: enable symlink convertion
+# (Default: ${LIVE_SYMLINKS})
+LIVE_SYMLINKS="${LIVE_SYMLINKS}"
+
+# \$LIVE_SYSVINIT: enable sysvinit
+# (Default: ${LIVE_SYSVINIT})
+LIVE_SYSVINIT="${LIVE_SYSVINIT}"
+EOF
+
+# Creating lh_chroot_* directories
+install -d -m 0755 "${LIVE_ROOT}"/config/chroot_localhooks || true
+install -d -m 0755 "${LIVE_ROOT}"/config/chroot_localincludes || true
+install -d -m 0755 "${LIVE_ROOT}"/config/chroot_localpackages || true
+install -d -m 0755 "${LIVE_ROOT}"/config/chroot_localpackageslist || true
+
+# Creating lh_bootstrap_* configuration
+cat > "${LIVE_ROOT}"/config/bootstrap << EOF
+# config/bootstrap: configuration for lh_bootstrap_*
+
+# \$LIVE_ARCHITECTURE: select the chroot architecture
+# (Default: autodetected)
+LIVE_ARCHITECTURE="${LIVE_ARCHITECTURE}"
+
+# \$LIVE_DISTRIBUTION: select the distribution to use
+# (Default: ${LIVE_DISTRIBUTION})
+LIVE_DISTRIBUTION="${LIVE_DISTRIBUTION}"
+
+# \$LIVE_DISTRIBUTION_CONFIG: set distribution config directory
+# (Default: empty)
+LIVE_DISTRIBUTION_CONFIG="${LIVE_DISTRIBUTION_CONFIG}"
+
+# \$LIVE_FLAVOUR: select the flavour to use
+# (Default: ${LIVE_FLAVOUR})
+LIVE_FLAVOUR="${LIVE_FLAVOUR}"
+
+# \$LIVE_MIRROR: set the mirror to use
+# (Default: ${LIVE_MIRROR})
+LIVE_MIRROR="${LIVE_MIRROR}"
+
+# \$LIVE_MIRROR_SECURITY: set the security mirror to use
+# (Default: ${LIVE_MIRROR_SECURITY})
+LIVE_MIRROR_SECURITY="${LIVE_MIRROR_SECURITY}"
+
+# \$LIVE_MIRROR_GENERIC: set the generic mirror to use
+# (Default: ${LIVE_MIRROR_GENERIC})
+LIVE_MIRROR_GENERIC="${LIVE_MIRROR_GENERIC}"
+
+# \$LIVE_MIRROR_GENERIC_SECURITY: set the generic security mirror to use
+# (Default: ${LIVE_MIRROR_GENERIC_SECURITY})
+LIVE_MIRROR_GENERIC_SECURITY="${LIVE_MIRROR_GENERIC_SECURITY}"
+
+# \$LIVE_SECTIONS: select the section to use
+# (Default: ${LIVE_SECTIONS})
+LIVE_SECTIONS="${LIVE_SECTIONS}"
+EOF
+
+# Creating lh_image_* configuration
+cat > "${LIVE_ROOT}"/config/image << EOF
+# config/chroot: configuration for lh_image_*
+
+# \$LIVE_BOOTAPPEND: set boot parameters
+# (Default: empty)
+LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND}"
+
+# \$LIVE_ENCRYPTION: set encrytion
+# (Default: empty)
+LIVE_ENCRYPTION="${LIVE_ENCRYPTION}"
+
+# \$LIVE_FILESYSTEM: set filesystem
+# (Default: ${LIVE_FILESYSTEM})
+LIVE_FILESYSTEM="${LIVE_FILESYSTEM}"
+
+# \$LIVE_MEMTEST86: set memtest86+
+# (Default: ${LIVE_MEMTEST86})
+LIVE_MEMTEST86="${LIVE_MEMTEST86}"
+
+# \$LIVE_ISO_VOLUME: set iso volume
+# (Default: ${LIVE_ISO_VOLUME})
+LIVE_ISO_VOLUME="${LIVE_ISO_VOLUME}"
+
+# \$LIVE_SERVER_ADDRESS: set the netboot server address
+# (Default: ${LIVE_SERVER_ADDRESS})
+LIVE_SERVER_ADDRESS="${LIVE_SERVER_ADDRESS}"
+
+# \$LIVE_SERVER_PATH: set the netboot server directory
+# (Default: ${LIVE_SERVER_PATH})
+LIVE_SERVER_PATH="${LIVE_SERVER_PATH}"
+
+# \$LIVE_SOURCE: set source option
+# (Default: ${LH_SOURCE})
+LIVE_SOURCE="${LIVE_SOURCE}"
+
+# \$LIVE_SYSLINUX: set syslinux option
+# (Default: ${LIVE_SYSLINUX})
+LIVE_SYSLINUX="${LIVE_SYSLINUX}"
+
+# \$LIVE_SYSLINUX_SPLASH: set custom syslinux splash
+# (Default: empty)
+LIVE_SYSLINUX_SPLASH="${LIVE_SYSLINUX_SPLASH}"
+
+# \$LIVE_BINARY_IMAGE: set image type
+# (Default: ${LIVE_BINARY_IMAGE})
+LIVE_BINARY_IMAGE="${LIVE_BINARY_IMAGE}"
+
+# \$LIVE_SOURCE_IMAGE: set image type
+# (Default: ${LIVE_SOURCE_IMAGE})
+LIVE_SOURCE_IMAGE="${LIVE_SOURCE_IMAGE}"
+
+# \$LIVE_TEMPLATES: set templates
+# (Default: ${LIVE_TEMPLATES})
+LIVE_TEMPLATES="${LIVE_TEMPLATES}"
+EOF
diff --git a/helpers/lh_configapt b/helpers/lh_configapt
deleted file mode 100755
index 971d02e..0000000
--- a/helpers/lh_configapt
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-
-# lh_configapt.sh <action>
-
-case "${1}" in
- apply-proxy)
- # Configure ftp proxy
- if [ -n "${LIVE_PROXY_FTP}" ]
- then
- echo "Acquire::ftp::Proxy \"${LIVE_PROXY_FTP}\";" > "${LIVE_CHROOT}"/etc/apt/apt.conf.d/00make-live_ftp-proxy.conf
- fi
-
- # Configure http proxy
- if [ -n "${LIVE_PROXY_HTTP}" ]
- then
- echo "Acquire::http::Proxy \"${LIVE_PROXY_HTTP}\";" > "${LIVE_CHROOT}"/etc/apt/apt.conf.d/00make-live_http-proxy.conf
- fi
- ;;
-
- apply-recommends)
- # Configure recommends
- if [ ! -d "${LIVE_CHROOT}"/etc/apt/apt.conf.d ]
- then
- mkdir -p "${LIVE_CHROOT}"/etc/apt/apt.conf.d
- fi
-
- if [ "${LIVE_RECOMMENDS}" = "yes" ]
- then
- echo "Aptitude::Recommends-Important \"true\";" >> "${LIVE_CHROOT}"/etc/apt/apt.conf
- else
- echo "Aptitude::Recommends-Important \"false\";" >> "${LIVE_CHROOT}"/etc/apt/apt.conf
- fi
- ;;
-
- deapply-proxy)
- # Deconfigure ftp proxy
- if [ -f "${LIVE_CHROOT}"/etc/apt/apt.conf.d/00make-live_ftp-proxy.conf ]
- then
- rm -f "${LIVE_CHROOT}"/etc/apt/apt.conf.d/00make-live_ftp-proxy.conf
- fi
-
- # Deconfigure http proxy
- if [ -f "${LIVE_CHROOT}"/etc/apt/apt.conf.d/00make-live_http-proxy.conf ]
- then
- rm -f "${LIVE_CHROOT}"/etc/apt/apt.conf.d/00make-live_http-proxy.conf
- fi
- ;;
-
- deapply-recommends)
- # Deconfigure recommends
- if [ -f "${LIVE_CHROOT}"/etc/apt/apt.conf.d/00make-live_recommends.conf ]
- then
- rm -f "${LIVE_CHROOT}"/etc/apt/apt.conf.d/00make-live_recommends.conf
- fi
- ;;
-esac
diff --git a/helpers/lh_confignetwork b/helpers/lh_confignetwork
deleted file mode 100755
index 892020d..0000000
--- a/helpers/lh_confignetwork
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/bin/sh
-
-# lh_patchnetwork.sh <action>
-
-# Packages which are manually installed inside the chroot are installed
-# from the network. Therefore, we need to be able to resolv hosts.
-
-case "${1}" in
- apply-hosts)
- # Save host lookup table
- if [ -f "${LIVE_CHROOT}"/etc/hosts ]
- then
- cp "${LIVE_CHROOT}"/etc/hosts \
- "${LIVE_CHROOT}"/etc/hosts.orig
- fi
-
- # Copy host lookup table
- if [ -f /etc/hosts ]
- then
- cp /etc/hosts "${LIVE_CHROOT}"/etc/hosts
- fi
- ;;
-
- apply-resolv)
- # Save resolver configuration
- if [ -f "${LIVE_CHROOT}"/etc/resolv.conf ]
- then
- cp "${LIVE_CHROOT}"/etc/resolv.conf \
- "${LIVE_CHROOT}"/etc/resolv.conf.orig
- fi
-
- # Copy resolver configuration
- if [ -f /etc/resolv.conf ]
- then
- cp /etc/resolv.conf "${LIVE_CHROOT}"/etc/resolv.conf
- fi
- ;;
-
- deapply-hosts)
- # Restore host lookup table
- if [ -f "${LIVE_CHROOT}"/etc/hosts.orig ]
- then
- mv "${LIVE_CHROOT}"/etc/hosts.orig \
- "${LIVE_CHROOT}"/etc/hosts
- else
- rm -f "${LIVE_CHROOT}"/etc/hosts
- fi
- ;;
-
- deapply-resolv)
- # Restore resolver configuration
- if [ -f "${LIVE_CHROOT}"/etc/resolv.conf.orig ]
- then
- mv "${LIVE_CHROOT}"/etc/resolv.conf.orig \
- "${LIVE_CHROOT}"/etc/resolv.conf
- else
- rm -f "${LIVE_CHROOT}"/etc/resolv.conf
- fi
- ;;
-esac
diff --git a/helpers/lh_debootstrap b/helpers/lh_debootstrap
deleted file mode 100755
index fd43b16..0000000
--- a/helpers/lh_debootstrap
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-if [ ! -f "${LIVE_ROOT}"/.stage/bootstrap ]
-then
- # Create chroot directory
- if [ ! -d "${LIVE_CHROOT}" ]
- then
- mkdir -p "${LIVE_CHROOT}"
- fi
-
- if [ -n "${LIVE_BOOTSTRAP_CONFIG}" ];
- then
- LIVE_DEBOOTSTRAP_SCRIPT="/usr/lib/debootstrap/scripts/${LIVE_BOOTSTRAP_CONFIG}"
- fi
-
- debootstrap --arch="${LIVE_ARCHITECTURE}" --variant=buildd "${LIVE_DISTRIBUTION}" "${LIVE_CHROOT}" "${LIVE_MIRROR}" "${LIVE_DEBOOTSTRAP_SCRIPT}"
-
- # Touching stage file
- if [ ! -d "${LIVE_ROOT}"/.stage ]
- then
- mkdir "${LIVE_ROOT}"/.stage
- fi
-
- touch "${LIVE_ROOT}"/.stage/bootstrap
-fi
diff --git a/helpers/lh_depends b/helpers/lh_depends
deleted file mode 100755
index 1cb1f52..0000000
--- a/helpers/lh_depends
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/bin/sh
-
-# lh_depends.sh <action> <type>
-
-case "${1}" in
- install)
- if [ -z "${KEEP_MEMTEST86}" ]
- then
- if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
- then
- lh_chroot "aptitude install --assume-yes memtest86+"
- fi
- fi
-
- if [ -z "${KEEP_SYSLINUX}" ]
- then
- lh_chroot "aptitude install --assume-yes syslinux"
- fi
-
- case "${2}" in
- usb)
- if [ -z "${KEEP_DOSFSTOOLS}" ]
- then
- lh_chroot "aptitude install --assume-yes dosfstools"
- fi
-
- if [ -z "${KEEP_MTOOLS}" ]
- then
- lh_chroot "aptitude install --assume-yes mtools"
- fi
-
- if [ -z "${KEEP_PARTED}" ]
- then
- lh_chroot "aptitude install --assume-yes parted"
- fi
- ;;
- esac
- ;;
-
- remove)
- if [ -z "${KEEP_MEMTEST86}" ]
- then
- if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
- then
- lh_chroot "aptitude purge --assume-yes memtest86+"
- fi
- fi
-
- if [ -z "${KEEP_SYSLINUX}" ]
- then
- lh_chroot "aptitude purge --assume-yes syslinux"
- fi
-
- case "${2}" in
- usb)
- if [ -z "${KEEP_DOSFSTOOLS}" ]
- then
- lh_chroot "aptitude purge --assume-yes dosfstools"
- fi
-
- if [ -z "${KEEP_MEMTEST86}" ]
- then
- if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
- then
- lh_chroot "aptitude purge --assume-yes memtest86+"
- fi
- fi
-
- if [ -z "${KEEP_MTOOLS}" ]
- then
- lh_chroot "aptitude purge --assume-yes mtools"
- fi
-
- if [ -z "${KEEP_PARTED}" ]
- then
- lh_chroot "aptitude purge --assume-yes parted"
- fi
-
- if [ -z "${KEEP_SYSLINUX}" ]
- then
- lh_chroot "aptitude purge --assume-yes syslinux"
- fi
- ;;
- esac
- ;;
-esac
diff --git a/helpers/lh_genrootfs b/helpers/lh_genrootfs
deleted file mode 100755
index 5853ed2..0000000
--- a/helpers/lh_genrootfs
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/bin/sh
-
-# lh_genrootfs.sh <filesystem>
-
-case "${LIVE_FILESYSTEM}" in
- ext2)
- DU_DIM="`du -ks ${LIVE_CHROOT} | cut -f1`"
- REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 20`" # Just 5% more to be sure, need something more sophistcated here...
-
- if [ -z "${LIVE_ENCRYPTION}" ]
- then
- genext2fs --size-in-blocks=${REAL_DIM} --reserved-blocks=0 --root="${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.ext2
- else
- echo "Encrypting ${LIVE_ROOT}/binary/casper/filesystem.ext2 with ${LIVE_ENCRYPTION}..."
-
- while true
- do
- genext2fs --size-in-blocks=${REAL_DIM} --reserved-blocks=0 --root="${LIVE_CHROOT}" | aespipe -e "${LIVE_ENCRYPTION}" -T > "${LIVE_ROOT}"/binary/casper/filesystem.ext2 && break
-
- echo -n "Something went wrong... Retry? [YES/no] "
- read ANSWER
-
- if [ 'no' = "${ANSWER}" ]
- then
- unset ANSWER
- break
- fi
- done
- fi
- ;;
-
- plain)
- if [ -n "${LIVE_ENCRYPTION}" ]
- then
- echo "Error: encryption is not supported for filesystem type 'plain'"
- exit 1
- fi
-
- cd "${LIVE_CHROOT}"
- find . | cpio -pumd "${LIVE_ROOT}"/binary/casper/filesystem.dir
- cd "${OLDPWD}"
- ;;
-
- squashfs)
- if [ -f "${LIVE_ROOT}"/binary/casper/filesystem.squashfs ]
- then
- rm "${LIVE_ROOT}"/binary/casper/filesystem.squashfs
- fi
-
- if [ "${LIVE_FLAVOUR}" = "minimal" ] || [ "${LIVE_FLAVOUR}" = "mini" ]
- then
- mksquashfs "${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.squashfs -e "${LIVE_CHROOT}"/boot/vmlinuz* "${LIVE_CHROOT}"/boot/initrd.img* "${LIVE_CHROOT}"/vmlinuz "${LIVE_CHROOT}"/initrd.img "${LIVE_CHROOT}"/boot/config-* "${LIVE_CHROOT}"/boot/System.map-*
- else
- mksquashfs "${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.squashfs
- fi
-
- if [ -n "$LIVE_ENCRYPTION" ]
- then
- echo "Encrypting ${LIVE_ROOT}/binary/casper/filesystem.squashfs with ${LIVE_ENCRYPTION}..."
-
- while true
- do
- cat "${LIVE_ROOT}"/binary/casper/filesystem.squashfs | aespipe -e "${LIVE_ENCRYPTION}" -T > "${LIVE_ROOT}"/binary/casper/filesystem.squashfs.encrypted && mv "${LIVE_ROOT}"/binary/casper/filesystem.squashfs.encrypted "${LIVE_ROOT}"/binary/casper/filesystem.squashfs && break
-
- echo -n "Something went wrong... Retry? [YES/no] "
- read ANSWER
-
- if [ 'no' = "${ANSWER}" ]
- then
- unset ANSWER
- break
- fi
- done
- fi
- ;;
-esac
diff --git a/helpers/lh_hook b/helpers/lh_hook
deleted file mode 100755
index 084a385..0000000
--- a/helpers/lh_hook
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-# lh_hook
-
-# Process flavour specific hooks
-if [ -r "${BASE}"/hooks/"${LIVE_FLAVOUR}" ]
-then
- grep -v "^#" "${BASE}"/hooks/"${LIVE_FLAVOUR}" > "${LIVE_CHROOT}"/root/"${LIVE_FLAVOUR}"
- LIVE_DEBCONF_FRONTEND="readline" LIVE_DEBCONF_PRIORITY="low" lh_chroot "sh /root/${LIVE_FLAVOUR}"
- rm -f "${LIVE_CHROOT}"/root/"${LIVE_FLAVOUR}"
-fi
-
-# Execute extra command in the chroot
-if [ -r "${LIVE_HOOK}" ]
-then
- # FIXME
- LIVE_DEBCONF_FRONTEND="readline" LIVE_DEBCONF_PRIORITY="low" lh_chroot "`cat ${LIVE_HOOK}`"
-elif [ -n "${LIVE_HOOK}" ]
-then
- LIVE_DEBCONF_FRONTEND="readline" LIVE_DEBCONF_PRIORITY="low" lh_chroot "${LIVE_HOOK}"
-fi
diff --git a/helpers/lh_includechroot b/helpers/lh_includechroot
deleted file mode 100755
index eedd31d..0000000
--- a/helpers/lh_includechroot
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-# lh_includechroot
-
-# Copy external directory into the chroot
-if [ -d "${LIVE_INCLUDE_CHROOT}" ]
-then
- cd "${LIVE_INCLUDE_CHROOT}"
- find . | cpio -pumd "${LIVE_CHROOT}"
- cd "${OLDPWD}"
-fi
diff --git a/helpers/lh_installapt b/helpers/lh_installapt
deleted file mode 100755
index ec19931..0000000
--- a/helpers/lh_installapt
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/bin/sh
-
-# lh_installapt
-
-# Install aptitude
-lh_chroot "apt-get install --yes --force-yes aptitude"
-
-# FIXME
-lh_chroot "apt-key update"
-
-# Install secure apt
-if [ "${LIVE_DISTRIBUTION}" = "unstable" ] || [ "${LIVE_DISTRIBUTION}" = "${CODENAME_UNSTABLE}" ] || \
-[ "${LIVE_DISTRIBUTION}" = "testing" ] || [ "${LIVE_DISTRIBUTION}" = "${CODENAME_TESTING}" ]
-then
- if [ "${LIVE_FLAVOUR}" != "minimal" ] || [ "${LIVE_FLAVOUR}" != "mini" ]
- then
- lh_chroot "apt-get install --yes --force-yes ${LIVE_REPOSITORY_KEYRING}"
-
- for NAME in ${LIVE_REPOSITORIES}
- do
- eval REPOSITORY_KEY="$`echo LIVE_REPOSITORY_KEY_$NAME`"
- eval REPOSITORY_KEYRING="$`echo LIVE_REPOSITORY_KEYRING_$NAME`"
-
- if [ -n "${REPOSITORY_KEYRING}" ]
- then
- lh_chroot "aptitude install ${REPOSITORY_KEYRING}"
- elif [ -n "${REPOSITORY_KEY}" ]
- then
- lh_chroot "wget ${REPOSITORY_KEY}"
- lh_chroot "apt-key add `basename ${REPOSITORY_KEY}`"
- lh_chroot "rm -f `basename ${REPOSITORY_KEY}`"
- fi
- done
- fi
-fi
diff --git a/helpers/lh_installlinux b/helpers/lh_installlinux
deleted file mode 100755
index 24dd7d1..0000000
--- a/helpers/lh_installlinux
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-# lh_installinux <type>
-
-# Removing initrd backup files
-rm -f "${LIVE_CHROOT}"/boot/initrd*bak*
-
-# Setting destination directory
-case "${1}" in
- iso)
- DESTDIR="${LIVE_ROOT}/binary/isolinux"
- ;;
-
- net)
- DESTDIR="${LIVE_ROOT}/tftpboot"
- ;;
-
- usb)
- DESTDIR="${LIVE_ROOT}/binary"
- ;;
-esac
-
-# Installing linux image
-cp "${LIVE_CHROOT}"/boot/vmlinuz* "${DESTDIR}"/vmlinuz
-cp "${LIVE_CHROOT}"/boot/initrd.img* "${DESTDIR}"/initrd.gz
diff --git a/helpers/lh_installmemtest86+ b/helpers/lh_installmemtest86+
deleted file mode 100755
index b35b26a..0000000
--- a/helpers/lh_installmemtest86+
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-# lh_installmemtest86+.sh <type>
-
-# Setting destination directory
-case "${1}" in
- iso)
- DESTDIR="${LIVE_ROOT}/binary/isolinux"
- ;;
-
- net)
- DESTDIR="${LIVE_ROOT}/tftpboot"
- ;;
-
- usb)
- DESTDIR="${LIVE_ROOT}/binary"
- ;;
-esac
-
-# Installing memtest86+
-if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
-then
- cp "${LIVE_ROOT}"/chroot/boot/memtest86+.bin "${DESTDIR}"/memtest
-fi
diff --git a/helpers/lh_installpackagelists b/helpers/lh_installpackagelists
deleted file mode 100755
index 71ba2fa..0000000
--- a/helpers/lh_installpackagelists
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-# lh_installpackagelists
-
-# Install packages list
-if [ -n "${LIVE_PACKAGE_LIST}" ]
-then
- if [ "${LIVE_PACKAGE_LIST}" = "everything" ]
- then
- #for FILE in "${LIVE_CHROOT}"/var/lib/apt/lists/*_Packages
- #do
- # awk '/Package: / { print $2 }' "${FILE}" | grep -v ".*-dbg$" >> "${LIVE_CHROOT}"/root/everything
- #done
-
- #lh_chroot "xargs --arg-file=/root/everything aptitude install --assume-yes"
- #rm -f "${LIVE_CHROOT}"/root/everything
-
- # FIXME
-
- for SECTION in admin base comm devel doc editors electronics embedded games gnome graphics hamradio interpreters kde libs libdevel mail math misc net news oldlibs otherosfs perl python science shells sound tex text utils web x11
- do
- lh_chroot "aptitude install --assume-yes ~s${SECTION}"
- done
- else
- grep -v "^#" "${LIVE_PACKAGE_LIST}" > "${LIVE_CHROOT}"/root/"`basename ${LIVE_PACKAGE_LIST}`"
- lh_chroot "xargs --arg-file=/root/`basename ${LIVE_PACKAGE_LIST}` aptitude install --assume-yes"
- rm -f "${LIVE_CHROOT}"/root/"`basename ${LIVE_PACKAGE_LIST}`"
- fi
-fi
diff --git a/helpers/lh_installpackages b/helpers/lh_installpackages
deleted file mode 100755
index 4cce341..0000000
--- a/helpers/lh_installpackages
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-# lh_installpackages
-
-# Install extra packages
-if [ -n "${LIVE_PACKAGES}" ]
-then
- lh_chroot "aptitude install --assume-yes ${LIVE_PACKAGES}"
-fi
diff --git a/helpers/lh_installsyslinux b/helpers/lh_installsyslinux
deleted file mode 100755
index 641f7db..0000000
--- a/helpers/lh_installsyslinux
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-
-# lh_installsyslinux.sh <type>
-
-if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
-then
- if [ -n "${LIVE_ENCRYPTION}" ]
- then
- LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} encryption=${LIVE_ENCRYPTION}"
- fi
-
- case "${1}" in
- iso)
- # Copy syslinux
- mkdir -p "${LIVE_ROOT}"/binary/isolinux
- cp "${LIVE_CHROOT}"/usr/lib/syslinux/isolinux.bin "${LIVE_ROOT}"/binary/isolinux
- cp -r "${LIVE_TEMPLATES}"/syslinux/* "${LIVE_ROOT}"/binary/isolinux
-
- # Copy splash screen
- if [ -n "${LIVE_ISOLINUX_SPLASH}" ]; then
- cp "${LIVE_ISOLINUX_SPLASH}" "${LIVE_ROOT}/binary/isolinux/splash.rle"
- fi
-
- # Configure syslinux templates
- sed -i -e "s#LIVE_BOOTAPPEND#${LIVE_BOOTAPPEND}#" "${LIVE_ROOT}"/binary/isolinux/isolinux.cfg
- sed -i -e "s/LIVE_DATE/`date +%Y%m%d`/" "${LIVE_ROOT}"/binary/isolinux/f1.txt
- sed -i -e "s/LIVE_VERSION/${VERSION}/" "${LIVE_ROOT}"/binary/isolinux/f10.txt
-
- # Remove unused files
- rm -f "${LIVE_ROOT}"/binary/isolinux/pxelinux.cfg
- ;;
-
- net)
- # Copy syslinux
- mkdir -p "${LIVE_ROOT}"/tftpboot
- cp "${LIVE_ROOT}"/chroot/usr/lib/syslinux/pxelinux.0 "${LIVE_ROOT}"/tftpboot
-
- # Install syslinux templates
- mkdir -p "${LIVE_ROOT}"/tftpboot/pxelinux.cfg
- cp -r "${LIVE_TEMPLATES}"/syslinux/* "${LIVE_ROOT}"/tftpboot/pxelinux.cfg
- mv "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/pxelinux.cfg "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/default
- sed -i -e 's#splash.rle#pxelinux.cfg/splash.rle#' "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/isolinux.txt
-
- # Copy splash screen
- if [ -n "${LIVE_ISOLINUX_SPLASH}" ]; then
- cp "${LIVE_ISOLINUX_SPLASH}" "${LIVE_ROOT}/tftpboot/pxelinux.cfg/splash.rle"
- fi
-
- # Configure syslinux templates
- sed -i -e "s/LIVE_SERVER_ADDRESS/${LIVE_SERVER_ADDRESS}/" -e "s#LIVE_SERVER_PATH#${LIVE_SERVER_PATH}#" -e "s#LIVE_BOOTAPPEND#${LIVE_BOOTAPPEND}#" "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/default
- sed -i -e "s/LIVE_DATE/`date +%Y%m%d`/" "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/f1.txt
- sed -i -e "s/LIVE_VERSION/${VERSION}/" "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/f10.txt
-
- # Remove unused files
- rm -f "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/isolinux.cfg
- ;;
-
- usb)
- # Copy syslinux
- mkdir -p "${LIVE_ROOT}"/binary
- cp "${LIVE_CHROOT}"/usr/lib/syslinux/isolinux.bin "${LIVE_ROOT}"/binary/syslinux.bin
- cp -r "${LIVE_TEMPLATES}"/syslinux/* "${LIVE_ROOT}"/binary
- mv "${LIVE_ROOT}"/binary/isolinux.cfg "${LIVE_ROOT}"/binary/syslinux.cfg
-
- # Copy splash screen
- if [ -n "${LIVE_ISOLINUX_SPLASH}" ]; then
- cp "${LIVE_ISOLINUX_SPLASH}" "${LIVE_ROOT}/binary/splash.rle"
- fi
-
- # Configure syslinux templates
- sed -i -e "s#LIVE_BOOTAPPEND#${LIVE_BOOTAPPEND}#" "${LIVE_ROOT}"/binary/syslinux.cfg
- sed -i -e "s/LIVE_DATE/`date +%Y%m%d`/" "${LIVE_ROOT}"/binary/f1.txt
- sed -i -e "s/LIVE_VERSION/${VERSION}/" "${LIVE_ROOT}"/binary/f10.txt
-
- # Remove unused files
- rm -f "${LIVE_ROOT}"/binary/isolinux/pxelinux.cfg
- ;;
- esac
-fi
diff --git a/helpers/lh_installtasks b/helpers/lh_installtasks
deleted file mode 100755
index 0a21a4a..0000000
--- a/helpers/lh_installtasks
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-# lh_installtasks
-
-# Install aptitude tasks
-if [ -n "${LIVE_TASKS}" ]
-then
- for TASK in ${LIVE_TASKS}
- do
- lh_chroot "aptitude install --assume-yes ${TASK}"
- done
-fi
diff --git a/helpers/lh_localdeb b/helpers/lh_localdeb
deleted file mode 100755
index 0fe71aa..0000000
--- a/helpers/lh_localdeb
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-# lh_localdeb
-
-if [ `ls "${LIVE_ROOT}"/localdeb/*.deb` ]
-then
- cp "${LIVE_ROOT}"/localdeb/*.deb "${LIVE_CHROOT}"/root
- lh_chroot "dpkg -i /root/*.deb"
- rm -f "${LIVE_CHROOT}"/root/*.deb
-fi
diff --git a/helpers/lh_losetup b/helpers/lh_losetup
index e2b3c0d..442afdb 100755
--- a/helpers/lh_losetup
+++ b/helpers/lh_losetup
@@ -2,7 +2,13 @@
# lh_losetup <device> <file> <partition>
-DEVICE="${1}"
+if [ -z "${1}" ]
+then
+ DEVICE="`losetup -f`"
+else
+ DEVICE="${1}"
+fi
+
FILE="${2}"
PARTITION="${3}"
@@ -11,7 +17,7 @@ FDISK_OUT="`fdisk -l -u ${DEVICE} 2>&1`"
losetup -d "${DEVICE}"
LOOPDEVICE="`echo ${DEVICE}p${PARTITION:=1}`"
-CYL="`echo ${FDISK_OUT} | sed -ne "s_^${LOOPDEVICE}[ *]*\([0-9]*\).*_\1_p" `"
+CYL=`echo "$FDISK_OUT" | sed -ne "s_^$LOOPDEVICE[ *]*\([0-9]*\).*_\1_p"`
#OFFSET="`expr 512 '*' ${CYL}`"
OFFSET="$((CYL*512))"
diff --git a/helpers/lh_manifest b/helpers/lh_manifest
deleted file mode 100755
index d755335..0000000
--- a/helpers/lh_manifest
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-
-# lh_manifest
-
-# Add filesystem.manifest
-lh_chroot "dpkg --get-selections" | awk '{ print $1 }' | sort -u > "${LIVE_ROOT}"/filesystem.manifest
-
-if [ -n "${LIVE_MANIFEST}" ]
-then
- # FIXME; what should that be good for anyway?
- lh_chroot "aptitude install --assume-yes ${LIVE_MANIFEST}"
- lh_chroot "dpkg-query -W \*" | awk '$2 ~ /./ {print $1 " " $2 }' > "${LIVE_ROOT}"/filesystem.manifest-desktop
-fi
diff --git a/helpers/lh_md5sums b/helpers/lh_md5sums
deleted file mode 100755
index 8097e6c..0000000
--- a/helpers/lh_md5sums
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-# lh_md5sums.sh
-
-# Calculating md5sums
-cd "${LIVE_ROOT}"/binary
-find . -type f -print0 | xargs -0 md5sum > "${LIVE_ROOT}"/md5sum.txt
-cd "${OLDPWD}"
-
-if [ -d "${LIVE_INCLUDE_IMAGE}" ]
-then
- cd "${LIVE_INCLUDE_IMAGE}"
- find . -type f -print0 | xargs -0 md5sum >> "${LIVE_ROOT}"/md5sum.txt
- cd "${OLDPWD}"
-fi
-
-mv "${LIVE_ROOT}"/md5sum.txt "${LIVE_ROOT}"/binary
diff --git a/helpers/lh_patchchroot b/helpers/lh_patchchroot
deleted file mode 100755
index ae99997..0000000
--- a/helpers/lh_patchchroot
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-# lh_patchchroot.sh <action>
-
-# Some maintainer scripts can detect if they are in a chrooted system.
-# Therefore, we create the needed file.
-
-case "${1}" in
- apply)
- # Create chroot file
- echo "debian-live" > "${LIVE_CHROOT}"/etc/debian_chroot
- ;;
-
- deapply)
- # Remove chroot file
- rm -f "${LIVE_CHROOT}"/etc/debian_chroot
- ;;
-esac
diff --git a/helpers/lh_patchlinux b/helpers/lh_patchlinux
deleted file mode 100755
index 7193f23..0000000
--- a/helpers/lh_patchlinux
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-# lh_patchlinux.sh <action>
-
-# The linux-image package asks interactively for initial ramdisk
-# creation. Therefore, we preconfigure /etc/kernel-img.conf.
-# FIXME: preseeding?
-
-case "${1}" in
- apply)
- # Save kernel configuration
- if [ -f "${LIVE_CHROOT}"/etc/kernel-img.conf ]
- then
- cp "${LIVE_CHROOT}"/etc/kernel-img.conf \
- "${LIVE_CHROOT}"/etc/kernel-img.conf.old
- fi
-
- # Configure kernel-img.conf
- echo "do_initrd = Yes" >> "${LIVE_CHROOT}"/etc/kernel-img.conf
- ;;
-
- deapply)
- # Restore kernel configuration
- if [ -f "${LIVE_CHROOT}"/etc/kernel-img.conf.old ]
- then
- mv "${LIVE_CHROOT}"/etc/kernel-img.conf.old \
- "${LIVE_CHROOT}"/etc/kernel-img.conf
- else
- rm -f "${LIVE_CHROOT}"/etc/kernel-img.conf
- fi
- ;;
-esac
diff --git a/helpers/lh_patchnetwork b/helpers/lh_patchnetwork
deleted file mode 100755
index 9d0b4b0..0000000
--- a/helpers/lh_patchnetwork
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-# lh_patchnetwork.sh <action>
-
-# Packages which are manually installed inside the chroot are installed
-# from the network. Therefore, we need to be able to resolv hosts.
-
-case "${1}" in
- apply)
- lh_confignetwork apply-hosts
- lh_confignetwork apply-resolv
- ;;
-
- deapply)
- lh_confignetwork deapply-hosts
- lh_confignetwork deapply-resolv
- ;;
-esac
diff --git a/helpers/lh_patchrunlevel b/helpers/lh_patchrunlevel
deleted file mode 100755
index 05fa9fb..0000000
--- a/helpers/lh_patchrunlevel
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-
-# lh_patchrunlevel.sh <action>
-
-# Disabling all init scripts with a blocking policy as in
-# /usr/share/doc/sysv-rc/README.policy-rc.d.gz.
-
-case "${1}" in
- apply)
- # Create init policy
- cat > "${LIVE_CHROOT}"/usr/sbin/policy-rc.d << EOF
-#!/bin/sh
-
-echo
-echo "Warning: invoke-rc.d policy in action. Skiping daemon starting"
-
-exit 101
-EOF
-
- chmod 0755 "${LIVE_CHROOT}"/usr/sbin/policy-rc.d
- ;;
-
- deapply)
- # Removing init policy
- rm -f "${LIVE_CHROOT}"/usr/sbin/policy-rc.d
- ;;
-esac
diff --git a/helpers/lh_preseed b/helpers/lh_preseed
deleted file mode 100755
index bcad060..0000000
--- a/helpers/lh_preseed
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-# lh_preseed
-
-# Restore preseed configuration
-if [ -f "${LIVE_PRESEED}" ]
-then
- lh_chroot "aptitude install --assume-yes debconf-utils"
- cp "${LIVE_PRESEED}" "${LIVE_CHROOT}"/root/preseed
- lh_chroot "debconf-set-selections /root/preseed"
- rm -f "${LIVE_CHROOT}"/root/preseed
-else
- if [ -n "${LIVE_PRESEED}" ]; then
- echo "'${LIVE_PRESEED}' file doesn't exists. Exiting..."
- exit 1
- fi
-fi
-
-# Restore cloned package selection
-if [ -f "${LIVE_PACKAGE_LIST_CLONED}" ]
-then
- lh_chroot "xargs --arg-file=/root/`basename ${LIVE_PACKAGE_LIST_CLONED}` aptitude install --assume-yes"
-fi
diff --git a/helpers/lh_setupapt b/helpers/lh_setupapt
deleted file mode 100755
index 37a3dbd..0000000
--- a/helpers/lh_setupapt
+++ /dev/null
@@ -1,124 +0,0 @@
-#!/bin/sh
-
-case "${1}" in
- custom)
- # Configure custom sources.list
- case "${LIVE_DISTRIBUTION}" in
- stable|"${CODENAME_STABLE}"|testing|"${CODENAME_TESTING}")
- echo "deb ${LIVE_MIRROR} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" > "${LIVE_CHROOT}"/etc/apt/sources.list
-
- if [ "${LIVE_SOURCE}" = "yes" ]
- then
- echo "deb-src ${LIVE_MIRROR} ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
- fi
-
- echo "deb ${LIVE_MIRROR_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
-
- if [ "${LIVE_SOURCE}" = "yes" ]
- then
- echo "deb-src ${LIVE_MIRROR_SECURITY} ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
- fi
- ;;
-
- unstable|"${CODENAME_UNSTABLE}")
- echo "deb ${LIVE_MIRROR} unstable ${LIVE_SECTIONS}" > "${LIVE_CHROOT}"/etc/apt/sources.list
-
- if [ "${LIVE_SOURCE}" = "yes" ]
- then
- echo "deb-src ${LIVE_MIRROR} unstable ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
- fi
-
- if [ "${LIVE_DISTRIBUTION_EXPERIMENTAL}" = "yes" ]
- then
- echo "deb ${LIVE_MIRROR} experimental ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
-
- if [ "${LIVE_SOURCE}" = "yes" ]
- then
- echo "deb-src ${LIVE_MIRROR} experimental ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
- fi
-
-cat > "${LIVE_CHROOT}"/etc/apt/preferences << EOF
-Package: *
-Pin: release a=experimental
-Pin-Priority: 999
-EOF
- fi
- ;;
- esac
- ;;
-
- default)
- # Configure default sources.list
- case "${LIVE_DISTRIBUTION}" in
- oldstable|"${CODENAME_OLDSTABLE}"|stable|"${CODENAME_STABLE}"|testing|"${CODENAME_TESTING}")
- echo "deb http://ftp.debian.org/debian/ ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" > "${LIVE_CHROOT}"/etc/apt/sources.list
-
- if [ "${LIVE_SOURCE}" = "yes" ]
- then
- echo "deb-src http://ftp.debian.org/debian/ ${LIVE_DISTRIBUTION} ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
- fi
-
- echo "deb http://security.debian.org/ ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
-
- if [ "${LIVE_SOURCE}" = "yes" ]
- then
- echo "deb-src http://security.debian.org/ ${LIVE_DISTRIBUTION}/updates ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
- fi
- ;;
-
- unstable|"${CODENAME_UNSTABLE}")
- echo "deb http://ftp.debian.org/debian/ unstable ${LIVE_SECTIONS}" > "${LIVE_CHROOT}"/etc/apt/sources.list
-
- if [ "${LIVE_SOURCE}" = "yes" ]
- then
- echo "deb-src http://ftp.debian.org/debian/ unstable ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
- fi
-
- if [ "${LIVE_DISTRIBUTION_EXPERIMENTAL}" = "yes" ]
- then
- echo "deb http://ftp.debian.org/debian/ experimental ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
-
- if [ "${LIVE_SOURCE}" = "yes" ]
- then
- echo "deb-src http://ftp.debian.org/debian/ experimental ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
- fi
- fi
- ;;
- esac
- ;;
-esac
-
-# Add custom repositories
-echo "" >> "${LIVE_CHROOT}"/etc/apt/sources.list
-echo "# Custom repositories" >> "${LIVE_CHROOT}"/etc/apt/sources.list
-
-for NAME in ${LIVE_REPOSITORIES}
-do
- eval REPOSITORY="$`echo LIVE_REPOSITORY_$NAME`"
- eval REPOSITORY_DISTRIBUTION="$`echo LIVE_REPOSITORY_DISTRIBUTION_$NAME`"
- eval REPOSITORY_SECTIONS="$`echo LIVE_REPOSITORY_SECTIONS_$NAME`"
-
- # Configure /etc/apt/sources.list
- if [ -n "${REPOSITORY_DISTRIBUTION}" ]
- then
- echo "deb ${REPOSITORY} ${REPOSITORY_DISTRIBUTION} ${REPOSITORY_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
- else
- echo "deb ${REPOSITORY} ${LIVE_DISTRIBUTION} ${REPOSITORY_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list
- fi
-done
-
-# Update indices
-if [ "${2}" = "initial" ]
-then
- lh_chroot "apt-get update"
-else
- lh_chroot "aptitude update"
-fi
-
-if [ "${LIVE_DISTRIBUTION_EXPERIMENTAL}" = "yes" ]
-then
- # experimental is sometimes broken,
- # therefore this is intentionally kept interactive.
- lh_chroot "aptitude upgrade" || return 0
- lh_chroot "aptitude dist-upgrade" || return 0
-fi
diff --git a/helpers/lh_source b/helpers/lh_source
new file mode 100755
index 0000000..5d08385
--- /dev/null
+++ b/helpers/lh_source
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+# lh_source(1) - building the source images
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/image
+Set_defaults
+
+# Enabling network in chroot
+lh_chroot_hosts install
+lh_chroot_resolv install
+lh_chroot_sources install
+
+# Preparing images
+lh_source_download
+
+# Building images
+lh_source_generic
+lh_source_iso
+lh_source_net
+lh_source_usb
+
+# Deconfiguring chroot
+rm -f "${LIVE_ROOT}"/.stage/chroot_sources
+lh_chroot_resolv remove
+lh_chroot_hosts remove
diff --git a/helpers/lh_source_download b/helpers/lh_source_download
new file mode 100755
index 0000000..0684d87
--- /dev/null
+++ b/helpers/lh_source_download
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+# lh_source_download(1) - download sources
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/image
+Set_defaults
+
+if [ "${LIVE_SOURCE}" = "enabled" ]
+then
+ # Requiring stage file
+ Require_stagefile "${LIVE_ROOT}"/.stage/bootstrap
+
+ # Checking lock file
+ Check_lockfile "${LIVE_ROOT}"/.lock
+
+ # Creating lock file
+ Create_lockfile "${LIVE_ROOT}"/.lock
+
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/source_download
+
+ # Remove old sources
+ if [ "${LIVE_ROOT}"/source ]
+ then
+ rm -rf "${LIVE_ROOT}"/source
+ fi
+
+ # Download sources
+ Chroot "dpkg --get-selections" | awk '{ print $1 }' > "${LIVE_CHROOT}"/root/dpkg-selection.txt
+ Chroot "xargs --arg-file=/root/dpkg-selection.txt apt-get source --download-only"
+ rm -f "${LIVE_CHROOT}"/root/dpkg-selection.txt
+
+ # Sort sources
+ for DSC in "${LIVE_CHROOT}"/*.dsc
+ do
+ SOURCE="`awk '/Source:/ { print $2; }' ${DSC}`"
+
+ if [ "`echo ${SOURCE} | cut -b 1-3`" == "lib" ]
+ then
+ LETTER="`echo ${SOURCE} | cut -b 1-4`"
+ else
+ LETTER="`echo ${SOURCE} | cut -b 1`"
+ fi
+
+ # Install directory
+ install -d -m 0755 "${LIVE_ROOT}"/source/"${LETTER}"/"${SOURCE}"
+
+ # Move files
+ mv "${LIVE_CHROOT}"/"${SOURCE}"_* "${LIVE_ROOT}"/source/"${LETTER}"/"${SOURCE}"
+ done
+
+ # Copy system configuration
+ cp -a "${LIVE_ROOT}"/config "${LIVE_ROOT}"/source
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/source_download
+fi
diff --git a/helpers/lh_source_generic b/helpers/lh_source_generic
new file mode 100755
index 0000000..a4fa1cc
--- /dev/null
+++ b/helpers/lh_source_generic
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# lh_source_generic(1) - build source generic image
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/image
+Set_defaults
+
+if [ "${LIVE_SOURCE}" = "disabled" ]
+then
+ echo "W: source images disabled (FIXME)"
+ exit 0
+fi
+
+for IMAGE in ${LIVE_SOURCE_IMAGE}
+do
+ if [ "${IMAGE}" = "generic" ]
+ then
+ # Requiring stage file
+ Require_stagefile "${LIVE_ROOT}"/.stage/source_download
+
+ # Checking lock file
+ Check_lockfile "${LIVE_ROOT}"/.lock
+
+ # Creating lock file
+ Create_lockfile "${LIVE_ROOT}"/.lock
+
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/source_generic
+
+ # Remove old source
+ if [ -f "${LIVE_ROOT}"/source.tar ]
+ then
+ rm -f "${LIVE_ROOT}"/source.tar
+ fi
+
+ # Create tarball
+ cd "${LIVE_ROOT}" &&
+ tar cf source.tar source
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/source_generic
+ fi
+done
diff --git a/helpers/lh_source_iso b/helpers/lh_source_iso
new file mode 100755
index 0000000..96d24ae
--- /dev/null
+++ b/helpers/lh_source_iso
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# lh_source_iso(1) - build source iso image
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/image
+Set_defaults
+
+if [ "${LIVE_SOURCE}" = "disabled" ]
+then
+ echo "W: source images disabled (FIXME)"
+ exit 0
+fi
+
+for IMAGE in ${LIVE_SOURCE_IMAGE}
+do
+ if [ "${IMAGE}" = "iso" ]
+ then
+ # Requiring stage file
+ Require_stagefile "${LIVE_ROOT}"/.stage/source_download
+
+ # Checking lock file
+ Check_lockfile "${LIVE_ROOT}"/.lock
+
+ # Creating lock file
+ Create_lockfile "${LIVE_ROOT}"/.lock
+
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/source_iso
+
+ # Remove old source
+ if [ -f "${LIVE_ROOT}"/source.iso ]
+ then
+ rm -f "${LIVE_ROOT}"/source.iso
+ fi
+
+ # Create image
+ cd "${LIVE_ROOT}" &&
+ ${LH_GENISOIMAGE} -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o source.iso -r -J -l -V "${LIVE_DISK_VOLUME}" source
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/source_iso
+ fi
+done
diff --git a/helpers/lh_source_net b/helpers/lh_source_net
new file mode 100755
index 0000000..30a8b83
--- /dev/null
+++ b/helpers/lh_source_net
@@ -0,0 +1,53 @@
+#!/bin/sh
+
+# lh_source_net(1) - build source net image
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/image
+Set_defaults
+
+if [ "${LIVE_SOURCE}" = "disabled" ]
+then
+ echo "W: source images disabled (FIXME)"
+ exit 0
+fi
+
+for IMAGE in ${LIVE_SOURCE_IMAGE}
+do
+ if [ "${IMAGE}" = "net" ]
+ then
+ # Requiring stage file
+ Require_stagefile "${LIVE_ROOT}"/.stage/source_download
+
+ # Checking lock file
+ Check_lockfile "${LIVE_ROOT}"/.lock
+
+ # Creating lock file
+ Create_lockfile "${LIVE_ROOT}"/.lock
+
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/source_net
+
+ # Remove old source
+ if [ -f "${LIVE_ROOT}"/source.tar.gz ]
+ then
+ rm -f "${LIVE_ROOT}"/source.tar.gz
+ fi
+
+ # Create tarball
+ cd "${LIVE_ROOT}" &&
+ tar cfz source.tar.gz source
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/source_net
+ fi
+done
diff --git a/helpers/lh_source_usb b/helpers/lh_source_usb
new file mode 100755
index 0000000..03e90d7
--- /dev/null
+++ b/helpers/lh_source_usb
@@ -0,0 +1,121 @@
+#!/bin/sh
+
+# lh_source_usb(1) - build source image
+
+set -e
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+# Reading configuration files
+Read_conffile config/common
+Read_conffile config/bootstrap
+Read_conffile config/image
+Set_defaults
+
+if [ "${LIVE_SOURCE}" = "disabled" ]
+then
+ echo "W: source images disabled (FIXME)"
+ exit 0
+fi
+
+for IMAGE in ${LIVE_SOURCE_IMAGE}
+do
+ if [ "${IMAGE}" = "usb" ]
+ then
+ # Requiring stage file
+ Require_stagefile "${LIVE_ROOT}"/.stage/source_download
+
+ # Checking lock file
+ Check_lockfile "${LIVE_ROOT}"/.lock
+
+ # Creating lock file
+ Create_lockfile "${LIVE_ROOT}"/.lock
+
+ # Checking stage file
+ Check_stagefile "${LIVE_ROOT}"/.stage/source_usb
+
+ if [ ! -f "${LIVE_CHROOT}"/sbin/mkdosfs ]
+ then
+ PACKAGES="${PACKAGES} dosfstools"
+ fi
+
+ if [ ! -f "${LIVE_CHROOT}"/sbin/parted ]
+ then
+ PACKAGES="${PACKAGES} parted"
+ fi
+
+ if [ -n "${PACKAGES}" ]
+ then
+ # Installing packages
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get install --yes ${PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude install --assume-yes ${PACKAGES}"
+ ;;
+ esac
+ fi
+
+ # Remove old source
+ if [ -f "${LIVE_ROOT}"/source.img ]
+ then
+ rm -f "${LIVE_ROOT}"/source.img
+ fi
+
+ # Everything which comes here needs to be cleaned up,
+ DU_DIM="`du -ms ${LIVE_ROOT}/source | cut -f1`"
+ REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 20`" # Just 5% more to be sure, need something more sophistcated here...
+ dd if=/dev/zero of="${LIVE_ROOT}"/source.img bs=1024k count=${REAL_DIM}
+ FREELO="`losetup -f`"
+ if [ ! -b "${LIVE_CHROOT}"/${FREELO} ]
+ then
+ MAKEDEV="true"
+ Chroot "cd /dev && ./MAKEDEV ${FREELO}"
+ fi
+
+ echo "!!! The following error/warning messages can be ignored !!!"
+ lh_losetup $FREELO "${LIVE_ROOT}"/source.img 0
+ Chroot "parted -s ${FREELO} mklabel msdos" || true
+ Chroot "parted -s ${FREELO} mkpartfs primary fat16 0.0 100%" || true
+ Chroot "parted -s ${FREELO} set 1 lba off" || true
+ losetup -d ${FREELO}
+
+ lh_losetup $FREELO "${LIVE_ROOT}"/source.img 1
+ Chroot "mkfs.msdos -n DEBIAN_LIVE ${FREELO}"
+ mkdir -p "${LIVE_ROOT}"/source.tmp
+ mount ${FREELO} "${LIVE_ROOT}"/source.tmp
+ cp -r "${LIVE_ROOT}"/source/* "${LIVE_ROOT}"/source.tmp
+ umount "${LIVE_ROOT}"/source.tmp
+ rmdir "${LIVE_ROOT}"/source.tmp
+ losetup -d ${FREELO}
+ echo "!!! The above error/warning messages can be ignored !!!"
+
+ if [ -n "${MAKEDEV}" ]
+ then
+ rm -f "${LIVE_CHROOT}"/${FREELO}
+ fi
+
+ if [ -n "${PACKAGES}" ]
+ then
+ # Removing packages
+ case "${LH_APT}" in
+ apt)
+ Chroot "apt-get remove --purge --yes ${PACKAGES}"
+ ;;
+
+ aptitude)
+ Chroot "aptitude purge --assume-yes ${PACKAGES}"
+ ;;
+ esac
+ fi
+
+ # Creating stage file
+ Create_stagefile "${LIVE_ROOT}"/.stage/source_usb
+ fi
+done
diff --git a/helpers/lh_testroot b/helpers/lh_testroot
index 6725850..e213ec5 100755
--- a/helpers/lh_testroot
+++ b/helpers/lh_testroot
@@ -1,6 +1,8 @@
#!/bin/sh
-# lh_testroot.sh
+# lh_testroot(1) - ensure that a system is built as root
+
+set -e
# Checking user account
if [ "`id -u`" -ne "0" ]
diff --git a/helpers/make-live b/helpers/make-live
new file mode 100755
index 0000000..8ae82ae
--- /dev/null
+++ b/helpers/make-live
@@ -0,0 +1,324 @@
+#!/bin/sh
+
+set -e
+
+# Set static variables
+PROGRAM="`basename ${0}`"
+
+# Source common functions
+for FUNCTION in /usr/share/live-helper/functions/*.sh
+do
+ . ${FUNCTION}
+done
+
+USAGE="Usage: ${PROGRAM} build|config [--apt apt|aptitude] [--apt-ftpproxy URL] [--apt-httpproxy URL] [--apt-generic enabled|disabled] [--apt-pdiffs enabled|disabled] [--apt-recommends enabled|disabled] [--bootstrap cdebootstrap|deboostrap] [--cache enabled|disabled] [--debconf-frontend dialog|readline|noninteractive] [--debconf-priority low|medium|high|critical] [--genisoimage genisoimage|mkisofs] [--root DIRECTORY] [--chroot DIRECTORY] [-a|--architecture ARCHITECTURE] [-d|--distribution testing|unstable|etch|sid] [--distribution-config DIRECTORY] [-f|--flavour minimal|standard] [-m|--mirror URL] [--mirror-security URL] [--mirror-generic URL] [--mirror-generic-security URL] [--sections SECTION|\"SECTIONS\"] [-k|--kernel KERNEL] [--kernel-packages PACKAGES] [-l|--language LANGUAGE] [--packages PACKAGE|\"PACKAGES\"] [-p|--packages-list LIST] [--tasks TASK|\"TASKS\"] [--security enabled|disabled] [--symlinks enabled|disabled] [--sysvinit enabled|disabled] [--bootappend KERNEL_PARAMETER|\"KERNEL_PARAMETERS\"] [-e|--encryption ALGORITHM] [--filesystem ext2|plain|squashfs] [--memtest86 enabled|disabled] [--iso-volume STRING] [--server-address HOSTNAME|IP] [--server-path DIRECTORY] [--source enabled|disabled] [--syslinux enabled|disabled] [--syslinux-splash FILE] [-b|--binary-image iso|usb|net] [-s|--source-image generic|iso|usb|net] [--templates DIRECTORY]"
+
+Help ()
+{
+ echo "${PROGRAM} - utility to build Debian Live systems"
+ echo
+ echo "${USAGE}"
+ echo "Usage: ${PROGRAM} [-h|--help]"
+ echo "Usage: ${PROGRAM} [-u|--usage]"
+ echo "Usage: ${PROGRAM} [-v|--version]"
+ echo
+ echo "Lists: gnome, gnome-core, gnome-desktop, gnome-full, gnome-junior, gnustep, kde, kde-core, kde-desktop, kde-extra, kde-full, kde-junior, mini, minimal, minimal-net, rescue, standard, standard-x11, xfce, xfce-desktop, xfce-junior"
+ echo
+ echo "Report bugs to Debian Live project <http://debian-live.alioth.debian.org/>."
+ exit 0
+}
+
+Usage ()
+{
+ echo "${PROGRAM} - utility to build Debian Live systems"
+ echo
+ echo "${USAGE}"
+ echo "Usage: ${PROGRAM} [-h|--help]"
+ echo "Usage: ${PROGRAM} [-u|--usage]"
+ echo "Usage: ${PROGRAM} [-v|--version]"
+ echo
+ echo "Try \"${PROGRAM} --help\" for more information."
+ exit ${1}
+}
+
+Version ()
+{
+ echo "${PROGRAM}, version ${VERSION}"
+ echo
+ echo "Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org>"
+ echo "Copyright (C) 2006-2007 Marco Amadori <marco.amadori@gmail.com>"
+ echo
+ echo "This program is free software; you can redistribute it and/or modify"
+ echo "it under the terms of the GNU General Public License as published by"
+ echo "the Free Software Foundation; either version 2 of the License, or"
+ echo "(at your option) any later version."
+ echo
+ echo "This program is distributed in the hope that it will be useful,"
+ echo "but WITHOUT ANY WARRANTY; without even the implied warranty of"
+ echo "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"
+ echo "GNU General Public License for more details."
+ echo
+ echo "You should have received a copy of the GNU General Public License"
+ echo "along with this program; if not, write to the Free Software"
+ echo "Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA"
+ echo
+ echo "On Debian systems, the complete text of the GNU General Public License"
+ echo "can be found in /usr/share/common-licenses/GPL file."
+ echo
+ echo "Homepage: <http://debian-live.alioth.debian.org/>"
+ exit 0
+}
+
+Main ()
+{
+ ARGUMENTS="`getopt --longoptions build,config,apt:,apt-ftpproxy:,apt-httpprox:,apt-generic:,apt-pdiffs:,apt-recommends:,bootstrap:,cache:,debconf-frontend:,debconf-priority:,genisoimage:,root:,chroot:,architecture:,distribution:,distribution-config:,flavour:,mirror:,mirror-security:,mirror-generic:,mirror-generic-security:,sections:,kernel:,kernel-packages:,language:,packages:,packages-list:,tasks:,security:,symlinks:,sysvinit:,bootappend:,encryption:,filesystem:,memtest86:,iso-volume:,server-address:,server-path:,source:,syslinux:,syslinux-splash:,binary-image:,binary-source:,templates:,help,usage,version --name=${PROGRAM} --options a:d:f:m:k:l:p:e:b:s:huv --shell sh -- "${@}"`"
+
+ if [ "${?}" != "0" ]
+ then
+ echo "Terminating." >&2
+ exit 1
+ fi
+
+ case "${1}" in
+ config)
+ CONFIG="true"
+ ;;
+
+ build)
+ BUILD="true"
+ ;;
+
+ *)
+ echo "E: no operation (config|build) specified."
+ exit 1
+ ;;
+ esac
+
+ eval set -- "${ARGUMENTS}"
+
+ while true
+ do
+ case "${1}" in
+ # common
+ --apt)
+ LH_APT="${2}"; shift 2
+ ;;
+
+ --apt-ftpproxy)
+ LH_APT_FTPPROXY="${2}"; shift 2
+ ;;
+
+ --apt-httpproxy)
+ LH_APT_HTTPPROXY="${2}"; shift 2
+ ;;
+
+ --apt-generic)
+ LH_APT_GENERIC="${2}"; shift 2
+ ;;
+
+ --apt-pdiffs)
+ LH_APT_PDIFFS="${2}"; shift 2
+ ;;
+
+ --apt-recommends)
+ LH_APT_RECOMMENDS="${2}"; shift 2
+ ;;
+
+ --bootstrap)
+ LH_BOOTSTRAP="${2}"; shift 2
+ ;;
+
+ --cache)
+ LH_CACHE="${2}"; shift 2
+ ;;
+
+ --debconf-frontend)
+ LH_DEBCONF_FRONTEND="${2}"; shift 2
+ ;;
+
+ --debconf-priority)
+ LH_DEBCONF_PRIORITY="${2}"; shift 2
+ ;;
+
+ --genisoimage)
+ LH_GENISOIMAGE="${2}"; shift 2
+ ;;
+
+ --root)
+ LIVE_ROOT="${2}"; shift 2
+ ;;
+
+ --chroot)
+ LIVE_CHROOT="${2}"; shift 2
+ ;;
+
+ # bootstrap
+ -a|--architecture)
+ LIVE_ARCHITECTURE="${2}"; shift 2
+ ;;
+
+ -d|--distribution)
+ LIVE_DISTRIBUTION="${2}"; shift 2
+ export LIVE_DISTRIBUTION
+ ;;
+
+ --distribution-config)
+ LIVE_DISTRIBUTION_CONFIG="${2}"; shift 2
+ ;;
+
+ -f|--flavour)
+ LIVE_FLAVOUR="${2}"; shift 2
+ ;;
+
+ -m|--mirror)
+ LIVE_MIRROR="${2}"; shift 2
+ ;;
+
+ --mirror-security)
+ LIVE_MIRROR_SECURITY="${2}"; shift 2
+ ;;
+
+ --mirror-generic)
+ LIVE_MIRROR_GENERIC="${2}"; shift 2
+ ;;
+
+ --mirror-generic-security)
+ LIVE_MIRROR_GENERIC_SECURITY="${2}"; shift 2
+ ;;
+
+ --sections)
+ LIVE_SECTIONS="${2}"; shift 2
+ ;;
+
+ # chroot
+ -k|--kernel)
+ LIVE_KERNEL="${2}"; shift 2
+ ;;
+
+ --kernel-packages)
+ LIVE_KERNEL_PACKAGES="${2}"; shift 2
+ ;;
+
+ -l|--language)
+ LIVE_LANGUAGE="${2}"; shift 2
+ ;;
+
+ --packages)
+ LIVE_PACKAGES="${2}"; shift 2
+ ;;
+
+ -p|--packages-list)
+ LIVE_PACKAGES_LIST="${2}"; shift 2
+ ;;
+
+ --tasks)
+ LIVE_TASKS="${2}"; shift 2
+ ;;
+
+ --security)
+ LIVE_SECURITY="${2}"; shift 2
+ ;;
+
+ --symlinks)
+ LIVE_SYMLINKS="${2}"; shift 2
+ ;;
+
+ --sysvinit)
+ LIVE_SYSVINIT="${2}"; shift 2
+ ;;
+
+ # image
+ --bootappend)
+ LIVE_BOOTAPPEND="${2}"; shift 2
+ ;;
+
+ -e|--encryption)
+ LIVE_ENCRYPTION="${2}"; shift 2
+ ;;
+
+ --filesystem)
+ LIVE_FILESYSTEM="${2}"; shift 2
+ ;;
+
+ --memtest86)
+ LIVE_MEMTEST86="${2}"; shift 2
+ ;;
+
+ --iso-volume)
+ LIVE_ISO_VOLUME="${2}"; shift 2
+ ;;
+
+ --server-address)
+ LIVE_SERVER_ADDRESS="${2}"; shift 2
+ ;;
+
+ --server-path)
+ LIVE_SERVER_PATH="${2}"; shift 2
+ ;;
+
+ --source)
+ LIVE_SOURCE="${2}"; shift 2
+ ;;
+
+ --syslinux)
+ LIVE_SYSLINUX="${2}"; shift 2
+ ;;
+
+ --syslinux-splash)
+ LIVE_SYSLINUX_SPLASH="${2}"; shift 2
+ ;;
+
+ -b|--binary-image)
+ LIVE_BINARY_IMAGE="${2}"; shift 2
+ ;;
+
+ -s|--source-image)
+ LIVE_SOURCE_IMAGE="${2}"; shift 2
+ ;;
+
+ --templates)
+ LIVE_TEMPLATES="${2}"; shift 2
+ ;;
+
+ # other
+ -h|--help)
+ Help; shift
+ ;;
+
+ -u|--usage)
+ Usage 0; shift
+ ;;
+
+ -v|--version)
+ Version; shift
+ ;;
+
+ --)
+ shift; break
+ ;;
+
+ *)
+ echo "Internal error."
+ exit 1
+ ;;
+ esac
+ done
+
+ # Initializing
+ lh_testroot
+ Set_defaults
+
+ # Configuring (this is really shit!)
+ if [ "${CONFIG}" = "true" ]
+ then
+ LH_APT="${LH_APT}" LH_APT_FTPPROXY="${LH_APT_FTPPROXY}" LH_APT_HTTPPROXY="${LH_APT_HTTPPROXY}" LH_APT_GENERIC="${LH_APT_GENERIC}" LH_APT_PDIFFS="${LH_APT_PDIFFS}" LH_APT_RECOMMENDS="${LH_APT_RECOMMENDS}" LH_BOOTSTRAP="${LH_BOOTSTRAP}" LH_CACHE="${LH_CACHE}" LH_DEBCONF_FRONTEND="${LH_DEBCONF_FRONTEND}" LH_DEBCONF_PRIORITY="${LH_DEBCONF_PRIORITY}" LH_GENISOIMAGE="${LH_GENISOIMAGE}" LIVE_ROOT="${LIVE_ROOT}" LIVE_CHROOT="${LIVE_CHROOT}" LIVE_ARCHITECTURE="${LIVE_ARCHITECTURE}" LIVE_DISTRIBUTION="${LIVE_DISTRIBUTION}" LIVE_DISTRIBUTION_CONFIG="${LIVE_DISTRIBUTION_CONFIG}" LIVE_FLAVOUR="${LIVE_FLAVOUR}" LIVE_MIRROR="${LIVE_MIRROR}" LIVE_MIRROR_SECURITY="${LIVE_MIRROR_SECURITY}" LIVE_MIRROR_GENERIC="${LIVE_MIRROR_GENERIC}" LIVE_MIRROR_GENERIC_SECURITY="${LIVE_MIRROR_GENERIC_SECURITY}" LIVE_SECTIONS="${LIVE_SECTIONS}" LIVE_KERNEL="${LIVE_KERNEL}" LIVE_KERNEL_PACKAGES="${LIVE_KERNEL_PACKAGES}" LIVE_LANGUAGE="${LIVE_LANGUAGE}" LIVE_PACKAGES="${LIVE_PACKAGES}" LIVE_PACKAGES_LIST="${LIVE_PACKAGES_LIST}" LIVE_TASKS="${LIVE_TASKS}" LIVE_SECURITY="${LIVE_SECURITY}" LIVE_SYMLINKS="${LIVE_SYMLINKS}" LIVE_SYSVINIT="${LIVE_SYSVINIT}" LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND}" LIVE_ENCRYPTION="${LIVE_ENCRYPTION}" LIVE_FILESYSTEM="${LIVE_FILESYSTEM}" LIVE_MEMTEST86="${LIVE_MEMTEST86}" LIVE_ISO_VOLUME="${LIVE_ISO_VOLUME}" LIVE_SERVER_ADDRESS="${LIVE_SERVER_ADDRESS}" LIVE_SERVER_PATH="${LIVE_SERVER_PATH}" LIVE_SOURCE="${LIVE_SOURCE}" LIVE_SYSLINUX="${LIVE_SYSLINUX}" LIVE_SYSLINUX_SPLASH="${LIVE_SYSLINUX_SPLASH}" LIVE_BINARY_IMAGE="${LIVE_BINARY_IMAGE}" LIVE_SOURCE_IMAGE="${LIVE_SOURCE_IMAGE}" LIVE_TEMPLATES="${LIVE_TEMPLATES}" lh_config
+ fi
+
+ # Building
+ if [ "${BUILD}" = "true" ]
+ then
+ cd "${LIVE_ROOT}" && lh_build
+ fi
+}
+
+Main "${@}"
diff --git a/helpers/overview.txt b/helpers/overview.txt
deleted file mode 100644
index f84421f..0000000
--- a/helpers/overview.txt
+++ /dev/null
@@ -1,51 +0,0 @@
-Overview
-========
-
-The basic concept is threefold:
-
- 1. Create a chroot
- 2. Install additional packages
- 3. Create images
-
-In detail:
-
-We start make-live, which handels configuration file, commandline paramters and defaults. Then, we start the helpers:
-
- * lh_testroot
-
- Tests if we are root, and fails if not.
-
- * lh_cdebootstrap
-
- Creates a bootstrap with cdebootstrap.
-
- * Configure chroot
- * Configure policy-id
- * Configure network
- * Mount proc
- * Configure sources.list
- * Configure apt: proxy and recommends
- * install aptitude
- * install secure apt
- * aptitude update
- * Configure linux-image
- * Install linux-image squashfs/unionfs
- * Deconfigure linux-image
- * CLONING/PRESEEDING
- * Install tasks lists
- * Install packages lists
- * Install LIVE_PACKAGES
- * Copy INCLUDE_ROOT
- * Process hooks
- * Save packages list
- * Disable daemons
- * Add manifest
- * Clean apt cache
- * Binfmt hack
- * Unmount proc
- * Deconfigure network
- * Deconfigure chroot
- * Check the chroot for depends
-
- build binary
- build source