diff options
Diffstat (limited to 'src/scripts')
-rw-r--r-- | src/scripts/02defaults.sh | 43 | ||||
-rw-r--r-- | src/scripts/11bootstrap.sh | 2 | ||||
-rw-r--r-- | src/scripts/13chroot.sh | 64 | ||||
-rw-r--r-- | src/scripts/21image.sh | 79 | ||||
-rw-r--r-- | src/scripts/23net.sh | 6 | ||||
-rw-r--r-- | src/scripts/24.usb.sh | 152 |
6 files changed, 299 insertions, 47 deletions
diff --git a/src/scripts/02defaults.sh b/src/scripts/02defaults.sh index e762145a8..924ad65c2 100644 --- a/src/scripts/02defaults.sh +++ b/src/scripts/02defaults.sh @@ -29,6 +29,10 @@ Defaults () LIVE_TYPE="Net" ;; + usb) + LIVE_TYPE="Usb" + ;; + *) echo "E: image type wrong or not yet supported." Usage 1 @@ -72,6 +76,9 @@ Defaults () if [ -z "${LIVE_FILESYSTEM}" ] && [ "${LIVE_TYPE}" = "Iso" ] then LIVE_FILESYSTEM="squashfs" + elif [ -z "${LIVE_FILESYSTEM}" ] && [ "${LIVE_TYPE}" = "Usb" ] + then + LIVE_FILESYSTEM="squashfs" elif [ -z "${LIVE_FILESYSTEM}" ] && [ "${LIVE_TYPE}" = "Net" ] then LIVE_FILESYSTEM="plain" @@ -164,15 +171,15 @@ Defaults () if [ "${LIVE_PACKAGE_LIST}" = "gnome-desktop" ] then LIVE_PACKAGE_LIST="gnome" - LIVE_TASKS="${LIVE_TASKS} gnome-desktop" + LIVE_TASKS="${LIVE_TASKS} standard laptop desktop gnome-desktop" elif [ "${LIVE_PACKAGE_LIST}" = "kde-desktop" ] then LIVE_PACKAGE_LIST="kde" - LIVE_TASKS="${LIVE_TASKS} kde-desktop" + LIVE_TASKS="${LIVE_TASKS} standard laptop desktop kde-desktop" elif [ "${LIVE_PACKAGE_LIST}" = "xfce-desktop" ] then LIVE_PACKAGE_LIST="xfce" - LIVE_TASKS="${LIVE_TASKS} xfce-desktop" + LIVE_TASKS="${LIVE_TASKS} standard laptop desktop xfce-desktop" fi # Check for package lists @@ -185,13 +192,16 @@ Defaults () LIVE_PACKAGE_LIST="${BASE}/lists/standard" fi else - if [ ! -r "${LIVE_PACKAGE_LIST}" ] + if [ "${LIVE_PACKAGE_LIST}" != "everything" ] then - if [ -r "${BASE}/lists/${LIVE_PACKAGE_LIST}" ] + if [ ! -r "${LIVE_PACKAGE_LIST}" ] then - LIVE_PACKAGE_LIST="${BASE}/lists/${LIVE_PACKAGE_LIST}" - else - LIVE_PACKAGE_LIST="${BASE}/lists/standard" + if [ -r "${BASE}/lists/${LIVE_PACKAGE_LIST}" ] + then + LIVE_PACKAGE_LIST="${BASE}/lists/${LIVE_PACKAGE_LIST}" + else + LIVE_PACKAGE_LIST="${BASE}/lists/standard" + fi fi fi fi @@ -223,9 +233,9 @@ Defaults () fi # Set debian sections - if [ -z "${LIVE_SECTION}" ] + if [ -z "${LIVE_SECTIONS}" ] then - LIVE_SECTION="main" + LIVE_SECTIONS="main" fi # Set netboot server @@ -279,4 +289,17 @@ Defaults () then LIVE_DEBCONF_PRIORITY="critical" fi + + if [ -z "${LIVE_DAEMONS}" ] + then + LIVE_DAEMONS="yes" + fi + + # This is a hack because Ubuntu does not ship cdrkit already + if [ -x /usr/bin/genisoimage ] + then + GENISOIMAGE="/usr/bin/genisoimage" + else + GENISOIMAGE="/usr/bin/mkisofs" + fi } diff --git a/src/scripts/11bootstrap.sh b/src/scripts/11bootstrap.sh index 724722353..224ac19e1 100644 --- a/src/scripts/11bootstrap.sh +++ b/src/scripts/11bootstrap.sh @@ -21,7 +21,7 @@ Bootstrap () if [ -n "${LIVE_BOOTSTRAP_CONFIG}" ]; then SUITE_CONFIG="--suite-config ${LIVE_BOOTSTRAP_CONFIG}" - fi + fi # Bootstrap system cdebootstrap --arch="${LIVE_ARCHITECTURE}" --flavour="${LIVE_FLAVOUR}" ${SUITE_CONFIG} "${LIVE_DISTRIBUTION}" "${LIVE_CHROOT}" "${LIVE_MIRROR}" diff --git a/src/scripts/13chroot.sh b/src/scripts/13chroot.sh index 06df0b60e..5a5298e1f 100644 --- a/src/scripts/13chroot.sh +++ b/src/scripts/13chroot.sh @@ -126,12 +126,39 @@ EOF 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 - 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}`" + 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 @@ -140,15 +167,6 @@ EOF Chroot_exec "aptitude install --assume-yes ${LIVE_PACKAGES}" fi - # Install aptitude tasks - if [ -n "${LIVE_TASKS}" ] - then - for TASK in ${LIVE_TASKS} - do - Chroot_exec "aptitude install --assume-yes ${TASK}" - done - fi - # Copy external directory into the chroot if [ -d "${LIVE_INCLUDE_CHROOT}" ] then @@ -178,6 +196,26 @@ EOF # 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 + + # 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 + # Add filesystem.manifest Chroot_exec "dpkg-query -W \*" | awk '$2 ~ /./ {print $1 " " $2 }' > "${LIVE_ROOT}"/filesystem.manifest @@ -193,7 +231,7 @@ EOF if [ "${LIVE_FLAVOUR}" = "minimal" ] then - rm -f "${LIVE_CHROOT}"/var/lib/apt/lists/* + 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 diff --git a/src/scripts/21image.sh b/src/scripts/21image.sh index ba52d70e0..934bc7094 100644 --- a/src/scripts/21image.sh +++ b/src/scripts/21image.sh @@ -16,36 +16,36 @@ Indices () # Configure custom sources.list case "${LIVE_DISTRIBUTION}" in oldstable|"${CODENAME_OLDSTABLE}"|stable|"${CODENAME_STABLE}"|testing|"${CODENAME_TESTING}") - echo "deb ${LIVE_MIRROR} ${LIVE_DISTRIBUTION} ${LIVE_SECTION}" > "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" > "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list + echo "deb-src ${LIVE_MIRROR} experimental ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list fi cat > "${LIVE_CHROOT}"/etc/apt/preferences << EOF @@ -62,36 +62,36 @@ EOF # 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_SECTION}" > "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" > "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list + 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_SECTION}" >> "${LIVE_CHROOT}"/etc/apt/sources.list + echo "deb-src http://ftp.debian.org/debian/ experimental ${LIVE_SECTIONS}" >> "${LIVE_CHROOT}"/etc/apt/sources.list fi fi ;; @@ -181,6 +181,15 @@ 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 @@ -201,7 +210,7 @@ Syslinux () 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 + 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 @@ -304,19 +313,19 @@ Mkisofs () 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} + ${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} + ${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 + ${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 } @@ -347,3 +356,33 @@ Sources () mv "${LIVE_CHROOT}"/"${SOURCE}"_* "${LIVE_ROOT}"/source/"${LETTER}"/"${SOURCE}" done } + +losetup_p () +{ + # Usage: losetup_p <image_filename> [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/23net.sh b/src/scripts/23net.sh index 48f5926ac..f9c2089d5 100644 --- a/src/scripts/23net.sh +++ b/src/scripts/23net.sh @@ -22,7 +22,7 @@ Net () 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 @@ -42,10 +42,10 @@ Net () if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ] then if [ ! -d "${LIVE_CHROOT}"/etc/initramfs-tools ] - then + then mkdir "${LIVE_CHROOT}"/etc/initramfs-tools fi - + # Configuring initramfs for NFS cat >> "${LIVE_CHROOT}"/etc/initramfs-tools/initramfs.conf << EOF MODULES=netboot diff --git a/src/scripts/24.usb.sh b/src/scripts/24.usb.sh new file mode 100644 index 000000000..cc51fdac6 --- /dev/null +++ b/src/scripts/24.usb.sh @@ -0,0 +1,152 @@ +#!/bin/sh + +# make-live - utility to build Debian Live systems +# +# Copyright (C) 2006 Daniel Baumann <daniel@debian.org> +# Copyright (C) 2006 Marco Amadori <marco.amadori@gmail.com> +# +# 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 + + 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 + + # Installing syslinux + Syslinux iso + + # Installing linux-image + Linuximage iso + + # Installing memtest + Memtest iso + + # Deconfigure network + Patch_network deapply + + # Deconfigure chroot + Patch_runlevel deapply + Patch_chroot deapply + + # Calculating md5sums + Md5sum + + # Creating image + 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 + + # Everything which comes here needs to be cleaned up, + # especially all the parted/syslinux stuff should be done + # from within the chroot, not on the host system, will do that later. + + 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 + parted -s ${FREELO} mklabel msdos + set +e + parted -s ${FREELO} mkpartfs primary fat16 0.0 100% + parted -s ${FREELO} set 1 boot on + parted -s ${FREELO} set 1 lba off + set -e + cat /usr/lib/syslinux/mbr.bin > ${FREELO} + losetup -d ${FREELO} + echo "!!! The above error/warning messages can be ignored !!!" + + losetup_p "${LIVE_ROOT}"/binary.img 1 + 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 + syslinux ${FREELO} + losetup -d ${FREELO} + + # 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 +} |