From 6f5e2da03e5fd1af2200d2f55ca84647bc8d3626 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 23 Sep 2007 10:04:40 +0200 Subject: Adding live-package 0.99.22-1. --- AUTHORS | 1 + ChangeLog | 10 + Makefile | 4 + README | 10 +- debian/changelog | 7 + debian/control | 8 +- debian/copyright | 2 +- doc/man/make-live.8 | 7 +- helpers/Makefile | 11 ++ helpers/lh_buildbinary | 200 +++++++++++++++++++ helpers/lh_buildsource | 84 ++++++++ helpers/lh_cdebootstrap | 33 ++++ helpers/lh_chroot | 6 + helpers/lh_cleanapt | 17 ++ helpers/lh_clone | 25 +++ helpers/lh_config | 26 +++ helpers/lh_configapt | 51 +++++ helpers/lh_confignetwork | 60 ++++++ helpers/lh_debootstrap | 20 ++ helpers/lh_depends | 86 +++++++++ helpers/lh_genrootfs | 71 +++++++ helpers/lh_hook | 21 ++ helpers/lh_includechroot | 11 ++ helpers/lh_installapt | 32 ++++ helpers/lh_installlinux | 32 ++++ helpers/lh_installmemtest86+ | 24 +++ helpers/lh_installpackagelists | 29 +++ helpers/lh_installpackages | 9 + helpers/lh_installsyslinux | 79 ++++++++ helpers/lh_installtasks | 12 ++ helpers/lh_localdeb | 10 + helpers/lh_losetup | 25 +++ helpers/lh_manifest | 12 ++ helpers/lh_md5sums | 17 ++ helpers/lh_patchchroot | 18 ++ helpers/lh_patchlinux | 32 ++++ helpers/lh_patchnetwork | 18 ++ helpers/lh_patchrunlevel | 27 +++ helpers/lh_preseed | 23 +++ helpers/lh_setupapt | 124 ++++++++++++ helpers/lh_testroot | 10 + helpers/overview.txt | 51 +++++ src/main.sh | 60 +++++- src/scripts/01init.sh | 20 -- src/scripts/02defaults.sh | 61 ++++++ src/scripts/11bootstrap.sh | 48 ----- src/scripts/12patch.sh | 165 ---------------- src/scripts/13chroot.sh | 230 +++------------------- src/scripts/21image.sh | 372 ------------------------------------ src/scripts/22iso.sh | 155 --------------- src/scripts/23net.sh | 180 ----------------- src/scripts/24.usb.sh | 218 --------------------- templates/syslinux/isolinux.cfg | 15 ++ templates/syslinux/isolinux.cfg.iso | 15 -- templates/syslinux/isolinux.cfg.usb | 15 -- 55 files changed, 1502 insertions(+), 1407 deletions(-) create mode 100644 helpers/Makefile create mode 100755 helpers/lh_buildbinary create mode 100755 helpers/lh_buildsource create mode 100755 helpers/lh_cdebootstrap create mode 100755 helpers/lh_chroot create mode 100755 helpers/lh_cleanapt create mode 100755 helpers/lh_clone create mode 100755 helpers/lh_config create mode 100755 helpers/lh_configapt create mode 100755 helpers/lh_confignetwork create mode 100755 helpers/lh_debootstrap create mode 100755 helpers/lh_depends create mode 100755 helpers/lh_genrootfs create mode 100755 helpers/lh_hook create mode 100755 helpers/lh_includechroot create mode 100755 helpers/lh_installapt create mode 100755 helpers/lh_installlinux create mode 100755 helpers/lh_installmemtest86+ create mode 100755 helpers/lh_installpackagelists create mode 100755 helpers/lh_installpackages create mode 100755 helpers/lh_installsyslinux create mode 100755 helpers/lh_installtasks create mode 100755 helpers/lh_localdeb create mode 100755 helpers/lh_losetup create mode 100755 helpers/lh_manifest create mode 100755 helpers/lh_md5sums create mode 100755 helpers/lh_patchchroot create mode 100755 helpers/lh_patchlinux create mode 100755 helpers/lh_patchnetwork create mode 100755 helpers/lh_patchrunlevel create mode 100755 helpers/lh_preseed create mode 100755 helpers/lh_setupapt create mode 100755 helpers/lh_testroot create mode 100644 helpers/overview.txt delete mode 100644 src/scripts/01init.sh delete mode 100644 src/scripts/11bootstrap.sh delete mode 100644 src/scripts/12patch.sh delete mode 100644 src/scripts/21image.sh delete mode 100644 src/scripts/22iso.sh delete mode 100644 src/scripts/23net.sh delete mode 100644 src/scripts/24.usb.sh create mode 100644 templates/syslinux/isolinux.cfg delete mode 100644 templates/syslinux/isolinux.cfg.iso delete mode 100644 templates/syslinux/isolinux.cfg.usb diff --git a/AUTHORS b/AUTHORS index 6bf8420..a95c532 100644 --- a/AUTHORS +++ b/AUTHORS @@ -13,3 +13,4 @@ Patches (alphabetical order): * Marcelo D. Re * Markus Bauer * Otavio Salvador + * Sebastian Raveau diff --git a/ChangeLog b/ChangeLog index 958fc85..0e214b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,19 @@ +2007-02-15 Daniel Baumann + + * Applied patch from Sebastian Raveau to + add support for filesystem images encrypted with loop-aes. + +2007-02-13 Daniel Baumann + + * Broken out scripts into modularized lh_* subscripts. + 2007-02-12 Daniel Baumann * Added some code as suggested by Alex Owen to check if the depends (syslinux, memtest etc.) are intentionally installed in the chroot, and hence, don't remove them. * Moved some depends into the chroot. + * Uploaded 0.99.21. 2007-02-11 Daniel Baumann diff --git a/Makefile b/Makefile index 9bdb6db..084e1a4 100644 --- a/Makefile +++ b/Makefile @@ -34,6 +34,8 @@ install: install -d -m 0755 $(DESTDIR)/usr/share/man/man8 install -m 0644 doc/man/*.8 $(DESTDIR)/usr/share/man/man8 + $(MAKE) -C helpers install + uninstall: @# Remove main script rm -f $(DESTDIR)/usr/sbin/make-live @@ -51,4 +53,6 @@ uninstall: rm -f $(DESTDIR)/usr/share/man/man5/make-live.* rm -f $(DESTDIR)/usr/share/man/man8/make-live.* + $(MAKE) -C helpers uninstall + reinstall: uninstall install diff --git a/README b/README index dc3a615..771c4e2 100644 --- a/README +++ b/README @@ -2,7 +2,11 @@ Debian Live Framework: make-live ================================ make-live is a utility to build Debian Live systems. It takes a Debian mirror as -an input and outputs a live system image (ISO image for CDs and DVDs, or tarball -for netboot). make-live is still in the early stage of development, but has basic functionality and can be run successfully. +an input and outputs a live system image (ISO image for CDs and DVDs, tarball +for netboot, or images for USB sticks). make-live is still in the early stage of +development, but has basic functionality and can be run successfully. -More information about Debian Live can be found at . +More information about Debian Live can be found at: + + * + * diff --git a/debian/changelog b/debian/changelog index 76c54a7..db40649 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +live-package (0.99.22-1) unstable; urgency=low + + * New upstream release: + - updates manpage (Closes: #411008). + + -- Daniel Baumann Fri, 16 Feb 2007 20:38:00 +0100 + live-package (0.99.21-1) unstable; urgency=low * New upstream release. diff --git a/debian/control b/debian/control index 0832ca8..181f4f8 100644 --- a/debian/control +++ b/debian/control @@ -9,11 +9,13 @@ Standards-Version: 3.7.2 Package: live-package Architecture: all Depends: cdebootstrap, genext2fs, genisoimage | mkisofs, squashfs-tools +Recommends: aespipe Provides: make-live Description: utility to build Debian Live systems make-live is a utility to build Debian Live systems. It takes a Debian mirror - as an input and outputs a live system image (ISO image for CDs and DVDs, or - tarball for netboot). make-live is still in the early stage of development, but - has basic functionality and can be run successfully. + as an input and outputs a live system image (ISO image for CDs and DVDs, + tarballs for netboot, or images for USB sticks). make-live is still in the + early stage of development, but has basic functionality and can be run + successfully. . Homepage: diff --git a/debian/copyright b/debian/copyright index 5a6aab6..a5b3f42 100644 --- a/debian/copyright +++ b/debian/copyright @@ -3,7 +3,7 @@ Mon, 17 Jul 2006 00:00:00 +0200. It was downloaded from . -Upstream Contact: debian-live-devel@lists.alioth.debian.org +Upstream: Debian Live Project License: diff --git a/doc/man/make-live.8 b/doc/man/make-live.8 index ac06c68..ee2d8d9 100644 --- a/doc/man/make-live.8 +++ b/doc/man/make-live.8 @@ -17,6 +17,8 @@ make-live \- utility to build Debian Live systems .IR DIRECTORY \|] .RB [\| \-d \||\| \-\-distribution .IR DISTRIBUTION \|] +.RB [\| \-e \||\| \-\-encryption +.IR ALGORITHM \|] .RB [\| \-\-filesystem .IR FILESYSTEM \|] .RB [\| \-f \||\| \-\-flavour @@ -97,6 +99,9 @@ specifies the chroot directory. Instead of this flag, the environment variable L .BI "\-d, \-\-distribution " DISTRIBUTION specifies the distribution to be used. Allowed values are distributions names like unstable and testing, or codenames like sid and etch. Instead of this flag, the environment variable LIVE_DISTRIBUTION can be used (Default: sid). .TP +.BI "\-e, \-\-encryption " ALGORITHM +specifies the filesystem encryption algorithm. Does not work if -t is set to plain. Instead of this flag, the environment variable LIVE_ENCRYPTION can be used (Default: empty). Valid algorithms are: AES128, AES192 and AES256. +.TP .BI "\-\-filesystem " FILESYSTEM Specifies the filesystem for the compressed image. At the moment, ext2, plain and squashfs are supported. Instead of this flag, the environment variable LIVE_FILESYSTEM can be used (Default: squashfs for iso, plain for net). .TP @@ -156,7 +161,7 @@ specifies the directory on the server, where you have unpacked the netboot image specifies a templates directory to use instead of the default one. Instead of this flag, the environment variable LIVE_TEMPLATES can be used (Default: /usr/share/make-live/templates). .TP .BI "\-t, \-\-type " TYPE -specifies the image type to generate. Currently, only iso and net are available. Instead of this flag, the environment variable LIVE_TYPE can be used (Default: iso). +specifies the image type to generate. TYPE can be one of: iso, net, or usb. Instead of this flag, the environment variable LIVE_TYPE can be used (Default: iso). .TP .B \-\-with-generic-indices enables use of generic Debian package indices. Instead of this flag, the environment variable LIVE_GENERIC_INDICES can be used (Default: yes). diff --git a/helpers/Makefile b/helpers/Makefile new file mode 100644 index 0000000..f2f31d4 --- /dev/null +++ b/helpers/Makefile @@ -0,0 +1,11 @@ +# 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_buildbinary b/helpers/lh_buildbinary new file mode 100755 index 0000000..48216e1 --- /dev/null +++ b/helpers/lh_buildbinary @@ -0,0 +1,200 @@ +#!/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="`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 new file mode 100755 index 0000000..836bd3c --- /dev/null +++ b/helpers/lh_buildsource @@ -0,0 +1,84 @@ +#!/bin/sh + +# lh_buildsource.sh + +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 new file mode 100755 index 0000000..c1f0d7a --- /dev/null +++ b/helpers/lh_cdebootstrap @@ -0,0 +1,33 @@ +#!/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 new file mode 100755 index 0000000..511cdca --- /dev/null +++ b/helpers/lh_chroot @@ -0,0 +1,6 @@ +#!/bin/sh + +# lh_chroot.sh + +# 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} diff --git a/helpers/lh_cleanapt b/helpers/lh_cleanapt new file mode 100755 index 0000000..ec28865 --- /dev/null +++ b/helpers/lh_cleanapt @@ -0,0 +1,17 @@ +#!/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 new file mode 100755 index 0000000..d89eba4 --- /dev/null +++ b/helpers/lh_clone @@ -0,0 +1,25 @@ +#!/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 new file mode 100755 index 0000000..a664988 --- /dev/null +++ b/helpers/lh_config @@ -0,0 +1,26 @@ +#!/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 diff --git a/helpers/lh_configapt b/helpers/lh_configapt new file mode 100755 index 0000000..81ff23a --- /dev/null +++ b/helpers/lh_configapt @@ -0,0 +1,51 @@ +#!/bin/sh + +# lh_configapt.sh + +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 [ "${LIVE_RECOMMENDS}" = "yes" ] + then + echo "Aptitude::Recommends-Important \"true\";" > "${LIVE_CHROOT}"/etc/apt/apt.conf.d/00make-live_recommends.conf + else + echo "Aptitude::Recommends-Important \"false\";" > "${LIVE_CHROOT}"/etc/apt/apt.conf.d/00make-live_recommends.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 new file mode 100755 index 0000000..892020d --- /dev/null +++ b/helpers/lh_confignetwork @@ -0,0 +1,60 @@ +#!/bin/sh + +# lh_patchnetwork.sh + +# 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 new file mode 100755 index 0000000..738179b --- /dev/null +++ b/helpers/lh_debootstrap @@ -0,0 +1,20 @@ +#!/bin/sh + +if [ ! -f "${LIVE_ROOT}"/.stage/bootstrap ] +then + # Create chroot directory + if [ ! -d "${LIVE_CHROOT}" ] + then + mkdir -p "${LIVE_CHROOT}" + fi + + debootstrap --arch="${LIVE_ARCHITECTURE}" --variant=buildd "${LIVE_DISTRIBUTION}" "${LIVE_CHROOT}" "${LIVE_MIRROR}" + + # 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 new file mode 100755 index 0000000..1cb1f52 --- /dev/null +++ b/helpers/lh_depends @@ -0,0 +1,86 @@ +#!/bin/sh + +# lh_depends.sh + +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 new file mode 100755 index 0000000..9ba4b31 --- /dev/null +++ b/helpers/lh_genrootfs @@ -0,0 +1,71 @@ +#!/bin/sh + +# lh_genrootfs.sh + +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 + + mksquashfs "${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.squashfs + + 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 new file mode 100755 index 0000000..084a385 --- /dev/null +++ b/helpers/lh_hook @@ -0,0 +1,21 @@ +#!/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 new file mode 100755 index 0000000..eedd31d --- /dev/null +++ b/helpers/lh_includechroot @@ -0,0 +1,11 @@ +#!/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 new file mode 100755 index 0000000..5324402 --- /dev/null +++ b/helpers/lh_installapt @@ -0,0 +1,32 @@ +#!/bin/sh + +# lh_installapt + +# Install aptitude +lh_chroot "apt-get install --yes --force-yes aptitude" + +# 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 "aptiude 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 new file mode 100755 index 0000000..40897d8 --- /dev/null +++ b/helpers/lh_installlinux @@ -0,0 +1,32 @@ +#!/bin/sh + +# lh_installinux + +# 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 +if [ "${LIVE_FLAVOUR}" = "minimal" ] || [ "${LIVE_FLAVOUR}" = "mini" ] +then + mv "${LIVE_CHROOT}"/boot/vmlinuz* "${DESTDIR}"/vmlinuz + mv "${LIVE_CHROOT}"/boot/initrd.img* "${DESTDIR}"/initrd.gz + rm -f "${LIVE_CHROOT}"/vmlinuz "${LIVE_CHROOT}"/initrd.img +else + cp "${LIVE_CHROOT}"/boot/vmlinuz* "${DESTDIR}"/vmlinuz + cp "${LIVE_CHROOT}"/boot/initrd.img* "${DESTDIR}"/initrd.gz +fi diff --git a/helpers/lh_installmemtest86+ b/helpers/lh_installmemtest86+ new file mode 100755 index 0000000..b35b26a --- /dev/null +++ b/helpers/lh_installmemtest86+ @@ -0,0 +1,24 @@ +#!/bin/sh + +# lh_installmemtest86+.sh + +# 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 new file mode 100755 index 0000000..71ba2fa --- /dev/null +++ b/helpers/lh_installpackagelists @@ -0,0 +1,29 @@ +#!/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 new file mode 100755 index 0000000..4cce341 --- /dev/null +++ b/helpers/lh_installpackages @@ -0,0 +1,9 @@ +#!/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 new file mode 100755 index 0000000..76a7ad7 --- /dev/null +++ b/helpers/lh_installsyslinux @@ -0,0 +1,79 @@ +#!/bin/sh + +# lh_installsyslinux.sh + +if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] +then + if [ -n "${LIVE_ENCRYPTION}" ] + then + LIVE_BOOTAPPEND="${LIVE_BOOTAPPEND} live-media-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 new file mode 100755 index 0000000..0a21a4a --- /dev/null +++ b/helpers/lh_installtasks @@ -0,0 +1,12 @@ +#!/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 new file mode 100755 index 0000000..0fe71aa --- /dev/null +++ b/helpers/lh_localdeb @@ -0,0 +1,10 @@ +#!/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 new file mode 100755 index 0000000..e99f9e0 --- /dev/null +++ b/helpers/lh_losetup @@ -0,0 +1,25 @@ +#!/bin/sh + +# lh_losetup + +DEVICE="${1}" +FILE="${2}" +PARTITION="${3}" + +losetup "${DEVICE}" "${FILE}" +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" `" +#OFFSET="`expr ${CYL}*512`" +OFFSET="$((CYL*512))" + +echo loop $DEVICE at offset $OFFSET + +if [ "${PARTITION}" = "0" ] +then + losetup "${DEVICE}" "${FILE}" +else + losetup -o "${OFFSET}" "${DEVICE}" "${FILE}" +fi diff --git a/helpers/lh_manifest b/helpers/lh_manifest new file mode 100755 index 0000000..9979552 --- /dev/null +++ b/helpers/lh_manifest @@ -0,0 +1,12 @@ +#!/bin/sh + +# lh_manifest + +# Add filesystem.manifest +lh_chroot "dpkg-query -W \*" | awk '$2 ~ /./ {print $1 " " $2 }' > "${LIVE_ROOT}"/filesystem.manifest + +if [ ! -z "${LIVE_MANIFEST}" ] +then + 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 new file mode 100755 index 0000000..8097e6c --- /dev/null +++ b/helpers/lh_md5sums @@ -0,0 +1,17 @@ +#!/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 new file mode 100755 index 0000000..ae99997 --- /dev/null +++ b/helpers/lh_patchchroot @@ -0,0 +1,18 @@ +#!/bin/sh + +# lh_patchchroot.sh + +# 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 new file mode 100755 index 0000000..7193f23 --- /dev/null +++ b/helpers/lh_patchlinux @@ -0,0 +1,32 @@ +#!/bin/sh + +# lh_patchlinux.sh + +# 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 new file mode 100755 index 0000000..9d0b4b0 --- /dev/null +++ b/helpers/lh_patchnetwork @@ -0,0 +1,18 @@ +#!/bin/sh + +# lh_patchnetwork.sh + +# 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 new file mode 100755 index 0000000..05fa9fb --- /dev/null +++ b/helpers/lh_patchrunlevel @@ -0,0 +1,27 @@ +#!/bin/sh + +# lh_patchrunlevel.sh + +# 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 new file mode 100755 index 0000000..bcad060 --- /dev/null +++ b/helpers/lh_preseed @@ -0,0 +1,23 @@ +#!/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 new file mode 100755 index 0000000..37a3dbd --- /dev/null +++ b/helpers/lh_setupapt @@ -0,0 +1,124 @@ +#!/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_testroot b/helpers/lh_testroot new file mode 100755 index 0000000..6725850 --- /dev/null +++ b/helpers/lh_testroot @@ -0,0 +1,10 @@ +#!/bin/sh + +# lh_testroot.sh + +# Checking user account +if [ "`id -u`" -ne "0" ] +then + echo "E: need root privileges" + exit 1 +fi diff --git a/helpers/overview.txt b/helpers/overview.txt new file mode 100644 index 0000000..f84421f --- /dev/null +++ b/helpers/overview.txt @@ -0,0 +1,51 @@ +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 diff --git a/src/main.sh b/src/main.sh index 50b84e6..b858a3e 100755 --- a/src/main.sh +++ b/src/main.sh @@ -28,7 +28,9 @@ set -e BASE=${LIVE_BASE:-"/usr/share/make-live"} CONFIG="/etc/make-live.conf" PROGRAM="`basename ${0}`" -VERSION="0.99.21" +VERSION="0.99.22" + +export VERSION CODENAME_OLDSTABLE="woody" CODENAME_STABLE="sarge" @@ -41,7 +43,7 @@ do . "${SCRIPT}" done -USAGE="Usage: ${PROGRAM} [-a|--architecture ARCHITECTURE] [-b|--bootappend KERNEL_PARAMETER|\"KERNEL_PARAMETERS\"] [--clone DIRECTORY] [--config FILE] [-c|--chroot DIRECTORY] [-d|--distribution DISTRIBUTION] [--with-generic-indices] [--without-generic-indices] [--with-recommends] [--without-recommends] [--with-daemons] [--without-daemons] [--filesystem FILESYSTEM] [-f|--flavour BOOTSTRAP_FLAVOUR] [--hook COMMAND|\"COMMANDS\"] [--include-chroot FILE|DIRECTORY] [--include-image FILE|DIRECTORY] [-k|--kernel KERNEL_FLAVOUR] [--manifest PACKAGE] [-m|--mirror URL] [-k|--keyring] [--mirror-security URL] [--packages PACKAGE|\"PACKAGES\"] [-p|--package-list LIST|FILE] [--preseed FILE] [--proxy-ftp URL] [--proxy-http URL] [--repositories NAME] [-r|--root DIRECTORY] [-s|--section SECTION|\"SECTIONS\"] [--server-address HOSTNAME|IP] [--server-path DIRECTORY] [--templates DIRECTORY] [-t|--type TYPE] [--tasks TASK]" +USAGE="Usage: ${PROGRAM} [-a|--architecture ARCHITECTURE] [-b|--bootappend KERNEL_PARAMETER|\"KERNEL_PARAMETERS\"] [--clone DIRECTORY] [--config FILE] [-c|--chroot DIRECTORY] [-d|--distribution DISTRIBUTION] [-e|--encryption ALGORITHM] [--with-generic-indices] [--without-generic-indices] [--with-recommends] [--without-recommends] [--with-daemons] [--without-daemons] [--filesystem FILESYSTEM] [-f|--flavour BOOTSTRAP_FLAVOUR] [--hook COMMAND|\"COMMANDS\"] [--include-chroot FILE|DIRECTORY] [--include-image FILE|DIRECTORY] [-k|--kernel KERNEL_FLAVOUR] [--manifest PACKAGE] [-m|--mirror URL] [-k|--keyring] [--mirror-security URL] [--packages PACKAGE|\"PACKAGES\"] [-p|--package-list LIST|FILE] [--preseed FILE] [--proxy-ftp URL] [--proxy-http URL] [--repositories NAME] [-r|--root DIRECTORY] [-s|--section SECTION|\"SECTIONS\"] [--server-address HOSTNAME|IP] [--server-path DIRECTORY] [--templates DIRECTORY] [-t|--type TYPE] [--tasks TASK]" Help () { @@ -69,6 +71,7 @@ Help () echo " -c, --chroot: specifies the chroot directory." echo " --clone: specifies a chroot directory to clone." echo " -d, --distribution: specifies the debian distribution." + echo " -e, --encryption: specifies the filesystem encryption algorithm." echo " --filesystem: specifies the chroot filesystem." echo " -f, --flavour: specifies the bootstrap flavour." echo " --bootstrap-config: specifies the suite configuration to be used for bootstraping." @@ -168,7 +171,7 @@ Configuration () Main () { - ARGUMENTS="`getopt --longoptions root:,tasks:,type:,architecture:,bootappend:,clone:,config:,chroot:,distribution:,filesystem:,flavour:,bootstrap-config:,hook:,include-chroot:,include-image:,kernel:,manifest:,mirror:,keyring:,mirror-security:,output:,packages:,package-list:,proxy-ftp:,preseed:,proxy-http:,repositories:,section:,server-address:,server-path:,templates:,with-generic-indices,without-generic-indices,with-recommends,without-recommends,with-daemons,without-daemons,with-source,without-source,help,usage,version --name=${PROGRAM} --options r:t:a:b:c:d:f:k:m:o:p:s:huv --shell sh -- "${@}"`" + ARGUMENTS="`getopt --longoptions root:,tasks:,type:,architecture:,bootappend:,clone:,config:,chroot:,distribution:,encryption:,filesystem:,flavour:,bootstrap-config:,hook:,include-chroot:,include-image:,kernel:,manifest:,mirror:,keyring:,mirror-security:,output:,packages:,package-list:,proxy-ftp:,preseed:,proxy-http:,repositories:,section:,server-address:,server-path:,templates:,with-generic-indices,without-generic-indices,with-recommends,without-recommends,with-daemons,without-daemons,with-source,without-source,help,usage,version --name=${PROGRAM} --options r:t:a:b:c:d:e:f:k:m:o:p:s:huv --shell sh -- "${@}"`" if [ "${?}" != "0" ] then @@ -183,156 +186,200 @@ Main () case "${1}" in -r|--root) LIVE_ROOT="${2}"; shift 2 + export LIVE_ROOT ;; -t|--type) LIVE_TYPE="${2}"; shift 2 + export LIVE_TYPE ;; --tasks) LIVE_TASKS="${2}"; shift 2 + export LIVE_TASKS ;; -a|--architecture) LIVE_ARCHITECTURE="${2}"; shift 2 + export LIVE_ARCHITECTURE ;; -b|--bootappend) LIVE_BOOTAPPEND="${2}"; shift 2 + export LIVE_BOOTAPPEND ;; --clone) LIVE_CLONE="${2}"; shift 2 + export LIVE_CLONE ;; --config) LIVE_CONFIG="${2}"; shift 2 + export LIVE_CONFIG ;; -c|--chroot) LIVE_CHROOT="${2}"; shift 2 + export LIVE_CHROOT ;; -d|--distribution) LIVE_DISTRIBUTION="${2}"; shift 2 + export LIVE_DISTRIBUTION + ;; + + -e|--encryption) + LIVE_ENCRYPTION="${2}"; shift 2 + export LIVE_ENCRYPTION ;; --filesystem) LIVE_FILESYSTEM="${2}"; shift 2 + export LIVE_FILESYSTEM ;; -f|--flavour) LIVE_FLAVOUR="${2}"; shift 2 + export LIVE_FLAVOUR ;; --bootstrap-config) LIVE_BOOTSTRAP_CONFIG="${2}"; shift 2 + export LIVE_BOOTSTRAP_CONFIG ;; --hook) LIVE_HOOK="${2}"; shift 2 + export LIVE_HOOK ;; --include-chroot) LIVE_INCLUDE_CHROOT="${2}"; shift 2 + export LIVE_INCLUDE_CHROOT ;; --include-image) LIVE_INCLUDE_IMAGE="${2}"; shift 2 + export LIVE_INCLUDE_IMAGE ;; -k|--kernel) LIVE_KERNEL="${2}"; shift 2 + export LIVE_KERNEL ;; --manifest) LIVE_MANIFEST="${2}"; shift 2 + export LIVE_MANIFEST ;; -m|--mirror) LIVE_MIRROR="${2}"; shift 2 + export LIVE_MIRROR ;; --keyring) LIVE_REPOSITORY_KEYRING="${2}"; shift 2 + export LIVE_REPOSITORY_KEYRING ;; --mirror-security) LIVE_MIRROR_SECURITY="${2}"; shift 2 + export LIVE_MIRROR_SECURITY ;; -o|--output) LIVE_IMAGE="${2}"; shift 2 + export LIVE_IMAGE ;; --packages) LIVE_PACKAGES="${2}"; shift 2 + export LIVE_PACKAGES ;; -p|--package-list) LIVE_PACKAGE_LIST="${2}"; shift 2 + export LIVE_PACKAGE_LIST ;; --preseed) LIVE_PRESEED="${2}"; shift 2 + export LIVE_PRESEED ;; --proxy-ftp) LIVE_PROXY_FTP="${2}"; shift 2 + export LIVE_PROXY_FTP ;; --proxy-http) LIVE_PROXY_HTTP="${2}"; shift 2 + export LIVE_PROXY_HTTP ;; --repositories) LIVE_REPOSITORIES="${2}"; shift 2 + export LIVE_REPOSITORIES ;; -s|--section) LIVE_SECTION="${2}"; shift 2 + export LIVE_SECTION ;; --server-address) LIVE_SERVER_ADDRESS="${2}"; shift 2 + export LIVE_SERVER_ADDRESS ;; --server-path) LIVE_SERVER_PATH="${2}"; shift 2 + export LIVE_SERVER_PATH ;; --templates) LIVE_TEMPLATES="${2}"; shift 2 + export LIVE_TEMPLATES ;; --with-generic-indices) LIVE_GENERIC_INDICES="yes"; shift + export LIVE_GENERIC_INDICES ;; --without-generic-indices) LIVE_GENERIC_INDICES="no"; shift + export LIVE_GENERIC_INDIDCES ;; --with-recommends) LIVE_RECOMMENDS="yes"; shift + export LIVE_RECOMMENDS ;; --without-recommends) LIVE_RECOMMENDS="no"; shift + export LIVE_RECOMMENDS ;; --with-daemons) LIVE_DAEMONS="yes"; shift + export LIVE_DAEMONS ;; --without-daemons) LIVE_DAEMONS="no"; shift + export LIVE_DEAMONS ;; --with-source) LIVE_SOURCE="yes"; shift + export LIVE_SOURCE ;; --without-source) LIVE_SOURCE="no"; shift + export LIVE_SOURCE ;; -h|--help) @@ -359,16 +406,17 @@ Main () done # Initialising - Init + lh_testroot Configuration Defaults # Building live system - Bootstrap + lh_cdebootstrap Chroot # Building live image - "${LIVE_TYPE}" + lh_buildbinary + lh_buildsource } Main "${@}" diff --git a/src/scripts/01init.sh b/src/scripts/01init.sh deleted file mode 100644 index 6947f6f..0000000 --- a/src/scripts/01init.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# make-live - utility to build Debian Live systems -# -# Copyright (C) 2006 Daniel Baumann -# Copyright (C) 2006 Marco Amadori -# -# make-live comes with ABSOLUTELY NO WARRANTY; for details see COPYING. -# This is free software, and you are welcome to redistribute it -# under certain conditions; see COPYING for details. - -Init () -{ - # Check if user is root - if [ "`id -u`" -ne "0" ] - then - echo "E: ${PROGRAM} requires superuser privilege." - exit 1 - fi -} diff --git a/src/scripts/02defaults.sh b/src/scripts/02defaults.sh index e0590f4..3960e72 100644 --- a/src/scripts/02defaults.sh +++ b/src/scripts/02defaults.sh @@ -17,6 +17,8 @@ Defaults () LIVE_ROOT="`pwd`/debian-live" fi + export LIVE_ROOT + # Set image type if [ -n "${LIVE_TYPE}" ] then @@ -42,18 +44,24 @@ Defaults () LIVE_TYPE="Iso" fi + export LIVE_TYPE + # Set bootstrap architecture if [ -z "${LIVE_ARCHITECTURE}" ] then LIVE_ARCHITECTURE="`dpkg --print-architecture`" fi + export LIVE_ARCHITECTURE + # Set chroot directory if [ -z "${LIVE_CHROOT}" ] then LIVE_CHROOT="${LIVE_ROOT}/chroot" fi + export LIVE_CHROOT + # Set debian distribution if [ -z "${LIVE_DISTRIBUTION}" ] then @@ -64,14 +72,19 @@ Defaults () then LIVE_DISTRIBUTION="unstable" LIVE_DISTRIBUTION_EXPERIMENTAL="yes" + export LIVE_DISTRIBUTION_EXPERIMENTAL fi + export LIVE_DISTRIBUTION + # Set bootstrap flavour if [ -z "${LIVE_FLAVOUR}" ] then LIVE_FLAVOUR="standard" fi + export LIVE_FLAVOUR + # Set filesystem if [ -z "${LIVE_FILESYSTEM}" ] && [ "${LIVE_TYPE}" = "Iso" ] then @@ -84,6 +97,8 @@ Defaults () LIVE_FILESYSTEM="plain" fi + export LIVE_FILESYSTEM + # Set kernel flavour if [ -z "${LIVE_KERNEL}" ] then @@ -143,10 +158,19 @@ Defaults () esac fi + export LIVE_KERNEL + # Set kernel packages if [ -z "${LIVE_KERNEL_PACKAGES}" ] then LIVE_KERNEL_PACKAGES="linux-image-2.6-${LIVE_KERNEL} squashfs-modules-2.6-${LIVE_KERNEL} unionfs-modules-2.6-${LIVE_KERNEL}" + + if [ -n "${LIVE_ENCRYPTION}" ] + then + LIVE_KERNEL_PACKAGES="${LIVE_KERNEL_PACKAGES} loop-aes-modules-2.6-${LIVE_KERNEL} loop-aes-utils" + fi + + export LIVE_KERNEL_PACKAGES fi # Set debian mirror @@ -155,16 +179,20 @@ Defaults () LIVE_MIRROR="http://ftp.debian.org/debian/" fi + export LIVE_MIRROR + # Set debian keyring if [ -z "${LIVE_REPOSITORY_KEYRING}" ] then LIVE_REPOSITORY_KEYRING="debian-archive-keyring" + export LIVE_REPOSITORY_KEYRING fi # Set debian security mirror if [ -z "${LIVE_MIRROR_SECURITY}" ] then LIVE_MIRROR_SECURITY="http://security.debian.org/" + export LIVE_MIRROR_SECURITY fi # Set default aptitude tasks @@ -172,14 +200,17 @@ Defaults () then LIVE_PACKAGE_LIST="gnome" LIVE_TASKS="${LIVE_TASKS} standard laptop desktop gnome-desktop" + export LIVE_PACKAGE_LIST LIVE_TASKS elif [ "${LIVE_PACKAGE_LIST}" = "kde-desktop" ] then LIVE_PACKAGE_LIST="kde" LIVE_TASKS="${LIVE_TASKS} standard laptop desktop kde-desktop" + export LIVE_PACKAGE_LIST LIVE_TASKS elif [ "${LIVE_PACKAGE_LIST}" = "xfce-desktop" ] then LIVE_PACKAGE_LIST="xfce" LIVE_TASKS="${LIVE_TASKS} standard laptop desktop xfce-desktop" + export LIVE_PACKAGE_LIST LIVE_TASKS fi # Check for package lists @@ -209,6 +240,8 @@ Defaults () fi fi + export LIVE_PACKAGE_LIST + # Set FTP proxy if [ -z "${LIVE_PROXY_FTP}" ] && [ -n "${ftp_proxy}" ] then @@ -241,63 +274,85 @@ Defaults () LIVE_SECTIONS="main" fi + export LIVE_SECTIONS + # Set netboot server if [ -z "${LIVE_SERVER_ADDRESS}" ] then LIVE_SERVER_ADDRESS="192.168.1.1" fi + export LIVE_SERVER_ADDRESS + # Set netboot path if [ -z "${LIVE_SERVER_PATH}" ] then LIVE_SERVER_PATH="/srv/debian-live" fi + export LIVE_SERVER_PATH + # Set templates directory if [ -z "${LIVE_TEMPLATES}" ] then LIVE_TEMPLATES="${BASE}/templates" fi + export LIVE_TEMPLATES + # Set package indices if [ -z "${LIVE_GENERIC_INDICES}" ] && [ "${LIVE_FLAVOUR}" != "minimal" ] && [ "${LIVE_FLAVOUR}" != "mini" ] then LIVE_GENERIC_INDICES="yes" fi + export LIVE_GENERIC_INDICES + # Set recommends if [ -z "${LIVE_RECOMMENDS}" ] then LIVE_RECOMMENDS="no" fi + export LIVE_RECOMMENDS + # Set source image if [ -z "${LIVE_SOURCE}" ] then LIVE_SOURCE="no" fi + export LIVE_SOURCE + # Set disk volume if [ -z "${LIVE_DISK_VOLUME}" ] then LIVE_DISK_VOLUME="Debian Live `date +%Y%m%d`" fi + export LIVE_DISK_VOLUME + if [ -z "${LIVE_DEBCONF_FRONTEND}" ] then LIVE_DEBCONF_FRONTEND="noninteractive" fi + export LIVE_DEBCONF_FRONTEND + if [ -z "${LIVE_DEBCONF_PRIORITY}" ] then LIVE_DEBCONF_PRIORITY="critical" fi + export LIVE_DEBCONF_PRIORITY + if [ -z "${LIVE_DAEMONS}" ] then LIVE_DAEMONS="yes" fi + export LIVE_DAEMONS + # This is a hack because Ubuntu does not ship cdrkit already if [ -x /usr/bin/genisoimage ] then @@ -305,4 +360,10 @@ Defaults () else GENISOIMAGE="/usr/bin/mkisofs" fi + + export GENISOIMAGE + + # Variables that do not have defaults but need to be exported to + # allow other helpers to use their values + export LIVE_BOOTSTRAP_CONFIG } diff --git a/src/scripts/11bootstrap.sh b/src/scripts/11bootstrap.sh deleted file mode 100644 index bc3a2ab..0000000 --- a/src/scripts/11bootstrap.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/sh - -# make-live - utility to build Debian Live systems -# -# Copyright (C) 2006 Daniel Baumann -# Copyright (C) 2006 Marco Amadori -# -# make-live comes with ABSOLUTELY NO WARRANTY; for details see COPYING. -# This is free software, and you are welcome to redistribute it -# under certain conditions; see COPYING for details. - -Bootstrap () -{ - 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 unused packages - Chroot_exec "dpkg -P cdebootstrap-helper-diverts" - - # 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/src/scripts/12patch.sh b/src/scripts/12patch.sh deleted file mode 100644 index 326ba4a..0000000 --- a/src/scripts/12patch.sh +++ /dev/null @@ -1,165 +0,0 @@ -#!/bin/sh - -# make-live - utility to build Debian Live systems -# -# Copyright (C) 2006 Daniel Baumann -# Copyright (C) 2006 Marco Amadori -# -# make-live comes with ABSOLUTELY NO WARRANTY; for details see COPYING. -# This is free software, and you are welcome to redistribute it -# under certain conditions; see COPYING for details. - -Patch_chroot () -{ - # 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 -} - -Patch_runlevel () -{ - # 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 <> "${LIVE_CHROOT}"/etc/apt/apt.conf - elif [ -n "${LIVE_PROXY_HTTP}" ] - then - echo "Acquire::http::Proxy \"${LIVE_PROXY_HTTP}\";" >> "${LIVE_CHROOT}"/etc/apt/apt.conf - fi - - # Configure recommends - 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 - - # 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 - - # 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) - # Restore apt configuration - if [ -f "${LIVE_CHROOT}"/etc/apt/apt.conf.orig ] - then - mv "${LIVE_CHROOT}"/etc/apt/apt.conf.orig "${LIVE_CHROOT}"/etc/apt/apt.conf - else - rm -f "${LIVE_CHROOT}"/etc/apt/apt.conf - fi - - # 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 - - # 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 -} - -Patch_linux () -{ - # 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/src/scripts/13chroot.sh b/src/scripts/13chroot.sh index 9403448..f06cf4d 100644 --- a/src/scripts/13chroot.sh +++ b/src/scripts/13chroot.sh @@ -9,234 +9,57 @@ # This is free software, and you are welcome to redistribute it # under certain conditions; see COPYING for details. -Chroot_exec () -{ - # 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} - return ${?} -} - Chroot () { if [ ! -f "${LIVE_ROOT}"/.stage/chroot ] then # Configure chroot - Patch_chroot apply - Patch_runlevel apply + lh_patchchroot apply + lh_patchrunlevel apply # Configure network - Patch_network apply + lh_patchnetwork apply # Mount proc mount proc-live -t proc "${LIVE_CHROOT}"/proc - # Avoid daemon starting - cat > "${LIVE_CHROOT}"/usr/sbin/policy-rc.d < "${LIVE_ROOT}"/preseed.cloned - - # Extract package selection - Chroot_exec "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 + lh_patchlinux deapply - # Restore preseed configuration - if [ -f "${LIVE_PRESEED}" ] - then - Chroot_exec "aptitude install --assume-yes debconf-utils" - cp "${LIVE_PRESEED}" "${LIVE_CHROOT}"/root/preseed - Chroot_exec "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 + lh_clone + lh_preseed - # Restore cloned package selection - if [ -f "${LIVE_PACKAGE_LIST_CLONED}" ] - then - Chroot_exec "xargs --arg-file=/root/`basename ${LIVE_PACKAGE_LIST_CLONED}` aptitude install --assume-yes" - fi - - # Install aptitude tasks - if [ -n "${LIVE_TASKS}" ] - then - for TASK in ${LIVE_TASKS} - do - Chroot_exec "aptitude install --assume-yes ${TASK}" - done - fi - - # 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 - - #Chroot_exec "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 - Chroot_exec "aptitude install --assume-yes ~s${SECTION}" - done - else - grep -v "^#" "${LIVE_PACKAGE_LIST}" > "${LIVE_CHROOT}"/root/"`basename ${LIVE_PACKAGE_LIST}`" - Chroot_exec "xargs --arg-file=/root/`basename ${LIVE_PACKAGE_LIST}` aptitude install --assume-yes" - rm -f "${LIVE_CHROOT}"/root/"`basename ${LIVE_PACKAGE_LIST}`" - fi - fi - - # Install extra packages - if [ -n "${LIVE_PACKAGES}" ] - then - Chroot_exec "aptitude install --assume-yes ${LIVE_PACKAGES}" - fi - - # Copy external directory into the chroot - if [ -d "${LIVE_INCLUDE_CHROOT}" ] - then - cd "${LIVE_INCLUDE_CHROOT}" - find . | cpio -pumd "${LIVE_CHROOT}" - cd "${OLDPWD}" - fi - - # 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" Chroot_exec "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" Chroot_exec "`cat ${LIVE_HOOK}`" - elif [ -n "${LIVE_HOOK}" ] - then - LIVE_DEBCONF_FRONTEND="readline" LIVE_DEBCONF_PRIORITY="low" Chroot_exec "${LIVE_HOOK}" - fi + lh_installtasks + lh_installpackagelists + lh_installpackages + lh_includechroot + lh_hook # Save package list - Chroot_exec "dpkg --get-selections" > "${LIVE_ROOT}"/packages.txt - - # Disable daemons - if [ "${LIVE_DAEMONS}" = "no" ] - then - # Disable all - for FILE in "${LIVE_CHROOT}"/etc/init.d/* - do - Chroot_exec "update-rc.d -f `basename ${FILE}` remove" - done + lh_chroot "dpkg --get-selections" > "${LIVE_ROOT}"/packages.txt - # 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 - Chroot_exec "/var/lib/dpkg/info/${PACKAGE}.postinst configure" - fi - done - fi + lh_config disable-daemons - # Add filesystem.manifest - Chroot_exec "dpkg-query -W \*" | awk '$2 ~ /./ {print $1 " " $2 }' > "${LIVE_ROOT}"/filesystem.manifest + lh_manifest - if [ ! -z "${LIVE_MANIFEST}" ] - then - Chroot_exec "aptitude install --assume-yes ${LIVE_MANIFEST}" - Chroot_exec "dpkg-query -W \*" | awk '$2 ~ /./ {print $1 " " $2 }' > "${LIVE_ROOT}"/filesystem.manifest-desktop - fi - - # Clean apt packages cache - rm -rf "${LIVE_CHROOT}"/var/cache/apt - mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial - - if [ "${LIVE_FLAVOUR}" = "minimal" ] || [ "${LIVE_FLAVOUR}" = "mini" ] - then - rm -rf "${LIVE_CHROOT}"/var/lib/apt/lists/* - 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 - fi + lh_cleanapt # Workaround binfmt-support /proc locking umount "${LIVE_CHROOT}"/proc/sys/fs/binfmt_misc > /dev/null || true @@ -244,15 +67,12 @@ EOF # Unmount proc umount "${LIVE_CHROOT}"/proc - # Allow daemon starting - rm "${LIVE_CHROOT}"/usr/sbin/policy-rc.d - # Deconfigure network - Patch_network deapply + lh_patchnetwork deapply # Deconfigure chroot - Patch_runlevel deapply - Patch_chroot deapply + lh_patchrunlevel deapply + lh_patchchroot deapply # Touching stage file touch "${LIVE_ROOT}"/.stage/chroot diff --git a/src/scripts/21image.sh b/src/scripts/21image.sh deleted file mode 100644 index 9fc4fe2..0000000 --- a/src/scripts/21image.sh +++ /dev/null @@ -1,372 +0,0 @@ -#!/bin/sh - -# make-live - utility to build Debian Live systems -# -# Copyright (C) 2006 Daniel Baumann -# Copyright (C) 2006 Marco Amadori -# -# make-live comes with ABSOLUTELY NO WARRANTY; for details see COPYING. -# This is free software, and you are welcome to redistribute it -# under certain conditions; see COPYING for details. - -Indices () -{ - case "${1}" in - custom) - # Configure custom sources.list - case "${LIVE_DISTRIBUTION}" in - oldstable|"${CODENAME_OLDSTABLE}"|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 - Chroot_exec "apt-get update" - else - Chroot_exec "aptitude update" - fi - - if [ "${LIVE_DISTRIBUTION_EXPERIMENTAL}" = "yes" ] - then - # experimental is sometimes broken, - # therefore this is intentionally kept interactive. - Chroot_exec "aptitude upgrade" || return 0 - Chroot_exec "aptitude dist-upgrade" || return 0 - fi -} - -Genrootfs () -{ - 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... - - genext2fs --size-in-blocks=${REAL_DIM} --reserved-blocks=0 --root="${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.ext2 - ;; - - plain) - 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 - - mksquashfs "${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.squashfs - ;; - esac -} - -Syslinux () -{ - if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] - then - case "${1}" in - iso) - # Copy syslinux - mkdir -p "${LIVE_ROOT}"/binary/isolinux - cp "${LIVE_CHROOT}"/usr/lib/syslinux/isolinux.bin "${LIVE_ROOT}"/binary/isolinux - - # Install syslinux templates - cp -r "${LIVE_TEMPLATES}"/syslinux/* \ - "${LIVE_ROOT}"/binary/isolinux - rm -f "${LIVE_ROOT}"/binary/isolinux/pxelinux.cfg - - #if [ "${LIVE_TYPE}" = "Iso" ] - #then - mv "${LIVE_ROOT}"/binary/isolinux/isolinux.cfg.iso "${LIVE_ROOT}"/binary/isolinux/isolinux.cfg - rm -f "${LIVE_ROOT}"/binary/isolinux/isolinux.cfg.usb - #else - # mv "${LIVE_ROOT}"/binary/isolinux/isolinux.cfg.usb "${LIVE_ROOT}"/binary/isolinux/isolinux.cfg - # rm -f "${LIVE_ROOT}"/binary/isolinux/isolinux.cfg.iso - #fi - - 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 - ;; - - 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 - rm -f "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/isolinux.cfg.* - sed -i -e 's#splash.rle#pxelinux.cfg/splash.rle#' "${LIVE_ROOT}"/tftpboot/pxelinux.cfg/isolinux.txt - - 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 - ;; - esac - fi -} - -Linuximage () -{ - # Removing initrd backup files - rm -f "${LIVE_CHROOT}"/boot/initrd*bak* - - case "${1}" in - iso) - # Copy linux-image - if [ "${LIVE_FLAVOUR}" = "minimal" ] || [ "${LIVE_FLAVOUR}" = "mini" ] - then - mv "${LIVE_CHROOT}"/boot/vmlinuz* "${LIVE_ROOT}"/binary/isolinux/vmlinuz - mv "${LIVE_CHROOT}"/boot/initrd.img* "${LIVE_ROOT}"/binary/isolinux/initrd.gz - rm -f "${LIVE_CHROOT}"/vmlinuz "${LIVE_CHROOT}"/initrd.img - else - cp "${LIVE_CHROOT}"/boot/vmlinuz* "${LIVE_ROOT}"/binary/isolinux/vmlinuz - cp "${LIVE_CHROOT}"/boot/initrd.img* "${LIVE_ROOT}"/binary/isolinux/initrd.gz - fi - ;; - - net) - # Copy linux-image - if [ "${LIVE_FLAVOUR}" = "minimal" ] || [ "${LIVE_FLAVOUR}" = "mini" ] - then - mv "${LIVE_ROOT}"/chroot/boot/vmlinuz* "${LIVE_ROOT}"/tftpboot/vmlinuz - mv "${LIVE_ROOT}"/chroot/boot/initrd.img* "${LIVE_ROOT}"/tftpboot/initrd.gz - else - cp "${LIVE_ROOT}"/chroot/boot/vmlinuz* "${LIVE_ROOT}"/tftpboot/vmlinuz - cp "${LIVE_ROOT}"/chroot/boot/initrd.img-* "${LIVE_ROOT}"/tftpboot/initrd.gz - fi - ;; - esac -} - -Memtest () -{ - if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] - then - case "$1" in - iso) - # Copy memtest - cp "${LIVE_ROOT}"/chroot/boot/memtest86+.bin "${LIVE_ROOT}"/binary/isolinux/memtest - ;; - - net) - # Copy memtest - cp "${LIVE_ROOT}"/chroot/boot/memtest86+.bin "${LIVE_ROOT}"/tftpboot/memtest - ;; - esac - fi -} - -Md5sum () -{ - # 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 -} - -Genisoimage () -{ - case "${1}" in - binary) - 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 - ;; - - source) - # 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 - ;; - esac -} - -Sources () -{ - # Download sources - Chroot_exec "dpkg --get-selections" | awk '{ print $1 }' > "${LIVE_CHROOT}"/root/dpkg-selection.txt - Chroot_exec "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 sources - mv "${LIVE_CHROOT}"/"${SOURCE}"_* "${LIVE_ROOT}"/source/"${LETTER}"/"${SOURCE}" - done -} - -losetup_p () -{ - # Usage: losetup_p [partition_#] - FILE=$1 ; MNT=$2 ; PART=$3 - - FREELO=$(losetup -f) - losetup $FREELO $FILE - - FDISK_OUT=$(fdisk -l -u "$FREELO" 2>&1) - losetup -d $FREELO - - VDEV=$(echo "$FREELO"p"${PART:=1}") - - CYL=`echo "$FDISK_OUT" | sed -ne "s_^$VDEV[ *]*\([0-9]*\).*_\1_p"` - - START=$((CYL*512)) - - FREELO=$(losetup -f) - echo loop $FREELO at offset $START - - export FREELO - - if [ "${PART}" = "0" ] - then - losetup $FREELO "${FILE}" - else - losetup -o $START $FREELO "$FILE" - fi -} diff --git a/src/scripts/22iso.sh b/src/scripts/22iso.sh deleted file mode 100644 index c99b774..0000000 --- a/src/scripts/22iso.sh +++ /dev/null @@ -1,155 +0,0 @@ -#!/bin/sh - -# make-live - utility to build Debian Live systems -# -# Copyright (C) 2006 Daniel Baumann -# Copyright (C) 2006 Marco Amadori -# -# make-live comes with ABSOLUTELY NO WARRANTY; for details see COPYING. -# This is free software, and you are welcome to redistribute it -# under certain conditions; see COPYING for details. - -Iso () -{ - if [ ! -f "${LIVE_ROOT}"/.stage/image_binary ] - then - # Configure chroot - Patch_chroot apply - Patch_runlevel apply - - # Configure network - Patch_network 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 - - # Remove indices - rm -rf "${LIVE_CHROOT}"/var/cache/apt - mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial - rm -rf "${LIVE_CHROOT}"/var/lib/apt/lists - mkdir -p "${LIVE_CHROOT}"/var/lib/apt/lists/partial - - # Switching package indices to default - if [ "${LIVE_GENERIC_INDICES}" = "yes" ] - then - Indices default - fi - - # Deconfigure network - Patch_network deapply - - # Deconfigure chroot - Patch_runlevel deapply - Patch_chroot deapply - - # Generating rootfs image - Genrootfs - - # Configure chroot - Patch_chroot apply - Patch_runlevel apply - - # Configure network - Patch_network apply - - # Remove indices - rm -rf "${LIVE_CHROOT}"/var/cache/apt - mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial - rm -rf "${LIVE_CHROOT}"/var/lib/apt/lists - mkdir -p "${LIVE_CHROOT}"/var/lib/apt/lists/partial - - # Switching package indices to custom - Indices custom - - # Install depends - if [ -z "${KEEP_MEMTEST86}" ] - then - if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] - then - Chroot_exec "aptitude install --assume-yes memtest86+" - fi - fi - - if [ -z "${KEEP_SYSLINUX}" ] - then - Chroot_exec "aptitude install --assume-yes syslinux" - fi - - # Installing syslinux - Syslinux iso - - # Installing linux-image - Linuximage iso - - # Installing memtest - Memtest iso - - # Remove depends - if [ -z "${KEEP_MEMTEST86}" ] - then - if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] - then - Chroot_exec "aptitude purge --assume-yes memtest86+" - fi - fi - - if [ -z "${KEEP_SYSLINUX}" ] - then - Chroot_exec "aptitude purge --assume-yes syslinux" - fi - - # Deconfigure network - Patch_network deapply - - # Deconfigure chroot - Patch_runlevel deapply - Patch_chroot deapply - - # Installing templates - if [ "${LIVE_FLAVOUR}" != "minimal" ] || [ "${LIVE_FLAVOUR}" != "mini" ] - then - cp -r "${LIVE_TEMPLATES}"/iso/* "${LIVE_ROOT}"/binary - cp -r "${LIVE_TEMPLATES}"/common/* "${LIVE_ROOT}"/binary - fi - - # Calculating md5sums - Md5sum - - # Creating image - Genisoimage binary - - # Touching stage file - touch "${LIVE_ROOT}"/.stage/image_binary - fi - - if [ ! -f "${LIVE_ROOT}"/.stage/image_source ] && [ "${LIVE_SOURCE}" = "yes" ] - then - # Configure chroot - Patch_chroot apply - Patch_runlevel apply - - # Configure network - Patch_network apply - - # Downloading sources - Sources - - # Deconfigure network - Patch_network deapply - - # Deconfigure chroot - Patch_runlevel deapply - Patch_chroot deapply - - # Creating image - Genisoimage source - - # Touching stage file - touch "${LIVE_ROOT}"/.stage/image_source - fi -} diff --git a/src/scripts/23net.sh b/src/scripts/23net.sh deleted file mode 100644 index ef837f4..0000000 --- a/src/scripts/23net.sh +++ /dev/null @@ -1,180 +0,0 @@ -#!/bin/sh - -# make-live - utility to build Debian Live systems -# -# Copyright (C) 2006 Daniel Baumann -# Copyright (C) 2006 Marco Amadori -# -# make-live comes with ABSOLUTELY NO WARRANTY; for details see COPYING. -# This is free software, and you are welcome to redistribute it -# under certain conditions; see COPYING for details. - -Net () -{ - if [ ! -f "${LIVE_ROOT}"/.stage/image_binary ] - then - # Configure chroot - Patch_chroot apply - Patch_runlevel apply - - # Configure network - Patch_network apply - - mkdir -p "${LIVE_ROOT}"/binary/casper - cp -r "${LIVE_TEMPLATES}"/common/* "${LIVE_ROOT}"/binary - - for MANIFEST in "${LIVE_ROOT}"/filesystem.manifest* - do - if [ -e "${MANIFEST}" ]; then - mv "${MANIFEST}" "${LIVE_ROOT}"/binary/casper/ - fi - done - - # Mount proc - mount proc-live -t proc "${LIVE_CHROOT}"/proc - - # Installing smbfs - Chroot_exec "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 - Chroot_exec "update-initramfs -tu" - fi - - # Remove indices - rm -rf "${LIVE_CHROOT}"/var/cache/apt - mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial - rm -rf "${LIVE_CHROOT}"/var/lib/apt/lists - mkdir -p "${LIVE_CHROOT}"/var/lib/apt/lists/partial - - # Switching package indices to default - if [ "${LIVE_GENERIC_INDICES}" = "yes" ] - then - Indices default - fi - - # Deconfigure network - Patch_network deapply - - # Deconfigure chroot - Patch_runlevel deapply - Patch_chroot deapply - - # Generating rootfs image - Genrootfs - - # Configure chroot - Patch_chroot apply - Patch_runlevel apply - - # Configure network - Patch_network apply - - # Remove indices - rm -rf "${LIVE_CHROOT}"/var/cache/apt - mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial - rm -rf "${LIVE_CHROOT}"/var/lib/apt/lists - mkdir -p "${LIVE_CHROOT}"/var/lib/apt/lists/partial - - # Switching package indices to custom - Indices custom - - # Install depends - if [ -z "${KEEP_MEMTEST86}" ] - then - if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] - then - Patch_network apply - Chroot_exec "aptitude install --assume-yes memtest86+" - fi - fi - - if [ -z "${KEEP_SYSLINUX}" ] - then - Patch_network apply - Chroot_exec "aptitude install --assume-yes syslinux" - fi - - # Installing syslinux - Syslinux net - - # Installing linux-image - Linuximage net - - # Installing memtest - Memtest net - - # Remove depends - if [ -z "${KEEP_SYSLINUX}" ] - then - if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] - then - Chroot_exec "aptitude purge --assume-yes syslinux" - fi - fi - - if [ -z "${KEEP_SYSLINUX}" ] - then - Chroot_exec "aptitude purge --assume-yes syslinux" - fi - - # Deconfigure network - Patch_network deapply - - # Deconfigure chroot - Patch_runlevel deapply - Patch_chroot deapply - - # Creating tarball - 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 - - # Touching stage file - touch "${LIVE_ROOT}"/.stage/image_binary - fi - - if [ ! -f "${LIVE_ROOT}"/.stage/image_source ] && [ "${LIVE_SOURCE}" = "yes" ] - then - # Configure chroot - Patch_chroot apply - Patch_runlevel apply - - # Configure network - Patch_network apply - - # Downloading sources - Sources - - # Deconfigure network - Patch_network deapply - - # Deconfigure chroot - Patch_runlevel deapply - Patch_chroot deapply - - # Creating tarball - tar cfz source.tar.gz "${LIVE_ROOT}"/source - - # Touching stage file - touch "${LIVE_ROOT}"/.stage/image_source - fi -} diff --git a/src/scripts/24.usb.sh b/src/scripts/24.usb.sh deleted file mode 100644 index 200ca35..0000000 --- a/src/scripts/24.usb.sh +++ /dev/null @@ -1,218 +0,0 @@ -#!/bin/sh - -# make-live - utility to build Debian Live systems -# -# Copyright (C) 2006 Daniel Baumann -# Copyright (C) 2006 Marco Amadori -# -# make-live comes with ABSOLUTELY NO WARRANTY; for details see COPYING. -# This is free software, and you are welcome to redistribute it -# under certain conditions; see COPYING for details. - -Usb () -{ - if [ ! -f "${LIVE_ROOT}"/.stage/image_binary ] - then - # Configure chroot - Patch_chroot apply - Patch_runlevel apply - - # Configure network - Patch_network apply - - # Manifest - 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 - - # Remove indices - rm -rf "${LIVE_CHROOT}"/var/cache/apt - mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial - rm -rf "${LIVE_CHROOT}"/var/lib/apt/lists - mkdir -p "${LIVE_CHROOT}"/var/lib/apt/lists/partial - - # Switching package indices to default - if [ "${LIVE_GENERIC_INDICES}" = "yes" ] - then - Indices default - fi - - # Deconfigure network - Patch_network deapply - - # Deconfigure chroot - Patch_runlevel deapply - Patch_chroot deapply - - # Generating rootfs image - Genrootfs - - # Mount proc - mount proc-live -t proc "${LIVE_CHROOT}"/proc - - # Configure chroot - Patch_chroot apply - Patch_runlevel apply - - # Configure network - Patch_network apply - - # Remove indices - rm -rf "${LIVE_CHROOT}"/var/cache/apt - mkdir -p "${LIVE_CHROOT}"/var/cache/apt/archives/partial - rm -rf "${LIVE_CHROOT}"/var/lib/apt/lists - mkdir -p "${LIVE_CHROOT}"/var/lib/apt/lists/partial - - # Switching package indices to custom - Indices custom - - # Install depends - if [ -z "${KEEP_DOSFSTOOLS}" ] - then - Chroot_exec "aptitude install --assume-yes dosfstools" - fi - - if [ -z "${KEEP_MEMTEST86}" ] - then - if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] - then - Chroot_exec "aptitude install --assume-yes memtest86+" - fi - fi - - if [ -z "${KEEP_MTOOLS}" ] - then - Chroot_exec "aptitude install --assume-yes mtools" - fi - - if [ -z "${KEEP_PARTED}" ] - then - Chroot_exec "aptitude install --assume-yes parted" - fi - - if [ -z "${KEEP_SYSLINUX}" ] - then - Chroot_exec "aptitude install --assume-yes syslinux" - fi - - # Installing syslinux - Syslinux iso - - # Installing linux-image - Linuximage iso - - # Installing memtest - Memtest iso - - # Calculating md5sums - Md5sum - - # Creating image - - # USB hacks - mv "${LIVE_ROOT}"/binary/isolinux/isolinux.cfg "${LIVE_ROOT}"/binary/syslinux.cfg - mv "${LIVE_ROOT}"/binary/isolinux/isolinux.bin "${LIVE_ROOT}"/binary/syslinux.bin - mv "${LIVE_ROOT}"/binary/isolinux/* "${LIVE_ROOT}"/binary - rmdir "${LIVE_ROOT}"/binary/isolinux/ - - # 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} - - echo "!!! The following error/warning messages can be ignored !!!" - losetup_p "${LIVE_ROOT}"/binary.img 0 - set +e - Chroot_exec "parted -s ${FREELO} mklabel msdos" - Chroot_exec "parted -s ${FREELO} mkpartfs primary fat16 0.0 100%" - Chroot_exec "parted -s ${FREELO} set 1 boot on" - Chroot_exec "parted -s ${FREELO} set 1 lba off" - set -e - cat "${LIVE_CHROOT}"/usr/lib/syslinux/mbr.bin > ${FREELO} - losetup -d ${FREELO} - - losetup_p "${LIVE_ROOT}"/binary.img 1 - Chroot_exec "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 - Chroot_exec "syslinux ${FREELO}" - losetup -d ${FREELO} - - echo "!!! The above error/warning messages can be ignored !!!" - - # Remove depends - if [ -z "${KEEP_DOSFSTOOLS}" ] - then - Chroot_exec "aptitude purge --assume-yes dosfstools" - fi - - if [ -z "${KEEP_MEMTEST86}" ] - then - if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] - then - Chroot_exec "aptitude purge --assume-yes memtest86+" - fi - fi - - if [ -z "${KEEP_MTOOLS}" ] - then - Chroot_exec "aptitude purge --assume-yes mtools" - fi - - if [ -z "${KEEP_PARTED}" ] - then - Chroot_exec "aptitude purge --assume-yes parted" - fi - - if [ -z "${KEEP_SYSLINUX}" ] - then - Chroot_exec "aptitude purge --assume-yes syslinux" - fi - - # Deconfigure network - Patch_network deapply - - # Deconfigure chroot - Patch_runlevel deapply - Patch_chroot deapply - - # Unmount proc - umount "${LIVE_CHROOT}"/proc - - # Touching stage file - touch "${LIVE_ROOT}"/.stage/image_binary - fi - - if [ ! -f "${LIVE_ROOT}"/.stage/image_source ] && [ "${LIVE_SOURCE}" = "yes" ] - then - # Configure chroot - Patch_chroot apply - Patch_runlevel apply - - # Configure network - Patch_network apply - - # Downloading sources - Sources - - # Deconfigure network - Patch_network deapply - - # Deconfigure chroot - Patch_runlevel deapply - Patch_chroot deapply - - # Creating image - tar cfz source.tar.gz "${LIVE_ROOT}"/source - - # Touching stage file - touch "${LIVE_ROOT}"/.stage/image_source - fi -} diff --git a/templates/syslinux/isolinux.cfg b/templates/syslinux/isolinux.cfg new file mode 100644 index 0000000..dd03d65 --- /dev/null +++ b/templates/syslinux/isolinux.cfg @@ -0,0 +1,15 @@ +default linux +label linux + kernel vmlinuz + append initrd=initrd.gz boot=casper LIVE_BOOTAPPEND +label memtest + kernel memtest +display isolinux.txt +timeout 0 +prompt 1 +f1 f1.txt +f3 f3.txt +f4 f4.txt +f8 f8.txt +f9 f9.txt +f0 f10.txt diff --git a/templates/syslinux/isolinux.cfg.iso b/templates/syslinux/isolinux.cfg.iso deleted file mode 100644 index dd03d65..0000000 --- a/templates/syslinux/isolinux.cfg.iso +++ /dev/null @@ -1,15 +0,0 @@ -default linux -label linux - kernel vmlinuz - append initrd=initrd.gz boot=casper LIVE_BOOTAPPEND -label memtest - kernel memtest -display isolinux.txt -timeout 0 -prompt 1 -f1 f1.txt -f3 f3.txt -f4 f4.txt -f8 f8.txt -f9 f9.txt -f0 f10.txt diff --git a/templates/syslinux/isolinux.cfg.usb b/templates/syslinux/isolinux.cfg.usb deleted file mode 100644 index 57ebf6c..0000000 --- a/templates/syslinux/isolinux.cfg.usb +++ /dev/null @@ -1,15 +0,0 @@ -default linux -label linux - kernel isolinux/vmlinuz - append initrd=isolinux/initrd.gz boot=casper LIVE_BOOTAPPEND -label memtest - kernel isolinux/memtest -display isolinux/isolinux.txt -timeout 0 -prompt 1 -f1 isolinux/f1.txt -f3 isolinux/f3.txt -f4 isolinux/f4.txt -f8 isolinux/f8.txt -f9 isolinux/f9.txt -f0 isolinux/f10.txt -- cgit v1.0