Adding live-package 0.99.22-1.

This commit is contained in:
Daniel Baumann 2007-09-23 10:04:40 +02:00
parent 9a9491318d
commit 6f5e2da03e
54 changed files with 1487 additions and 1392 deletions

View File

@ -13,3 +13,4 @@ Patches (alphabetical order):
* Marcelo D. Re <mdre@rectorado.unl.edu.ar>
* Markus Bauer <bauer-markus@web.de>
* Otavio Salvador <otavio@debian.org>
* Sebastian Raveau <sebastien.raveau@epita.fr>

View File

@ -1,9 +1,19 @@
2007-02-15 Daniel Baumann <daniel@debian.org>
* Applied patch from Sebastian Raveau <sebastien.raveau@epita.fr> to
add support for filesystem images encrypted with loop-aes.
2007-02-13 Daniel Baumann <daniel@debian.org>
* Broken out scripts into modularized lh_* subscripts.
2007-02-12 Daniel Baumann <daniel@debian.org>
* Added some code as suggested by Alex Owen <r.a.owen@qmul.ac.uk> 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 <daniel@debian.org>

View File

@ -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

10
README
View File

@ -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 <http://live.debian.net/>.
More information about Debian Live can be found at:
* <http://debian-live.alioth.debian.org/>
* <http://wiki.debian.org/DebianLive/>

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
live-package (0.99.22-1) unstable; urgency=low
* New upstream release:
- updates manpage (Closes: #411008).
-- Daniel Baumann <daniel@debian.org> Fri, 16 Feb 2007 20:38:00 +0100
live-package (0.99.21-1) unstable; urgency=low
* New upstream release.

8
debian/control vendored
View File

@ -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: <http://debian-live.alioth.debian.org/>

2
debian/copyright vendored
View File

@ -3,7 +3,7 @@ Mon, 17 Jul 2006 00:00:00 +0200.
It was downloaded from <http://debian-live.alioth.debian.org/>.
Upstream Contact: debian-live-devel@lists.alioth.debian.org
Upstream: Debian Live Project <debian-live-devel@lists.alioth.debian.org>
License:

View File

@ -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).

11
helpers/Makefile Normal file
View File

@ -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

200
helpers/lh_buildbinary Executable file
View File

@ -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

84
helpers/lh_buildsource Executable file
View File

@ -0,0 +1,84 @@
#!/bin/sh
# lh_buildsource.sh <type>
if [ ! -f "${LIVE_ROOT}"/.stage/image_source ] && [ "${LIVE_SOURCE}" = "yes" ]
then
# Configure chroot
lh_patchnetwork apply
# Download sources
lh_chroot "dpkg --get-selections" | awk '{ print $1 }' > "${LIVE_CHROOT}"/root/dpkg-selection.txt
lh_chroot "xargs --arg-file=/root/dpkg-selection.txt apt-get source --download-only"
rm -f "${LIVE_CHROOT}"/root/dpkg-selection.txt
# Sort sources
for DSC in "${LIVE_CHROOT}"/*.dsc
do
SOURCE="`awk '/Source:/ { print $2; }' ${DSC}`"
if [ "`echo ${SOURCE} | cut -b 1-3`" == "lib" ]
then
LETTER="`echo ${SOURCE} | cut -b 1-4`"
else
LETTER="`echo ${SOURCE} | cut -b 1`"
fi
# Install directory
install -d -m 0755 "${LIVE_ROOT}"/source/"${LETTER}"/"${SOURCE}"
# Move files
mv "${LIVE_CHROOT}"/"${SOURCE}"_* "${LIVE_ROOT}"/source/"${LETTER}"/"${SOURCE}"
done
case "${1}" in
generic)
# Create tarball
tar cf source.tar "$LIVE_ROOT"/source
;;
iso)
# Create image
${GENISOIMAGE} -A "Debian Live" -p "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -publisher "Debian Live; http://debian-live.alioth.debian.org/; debian-live-devel@lists.alioth.debian.org" -o "${LIVE_ROOT}"/"${LIVE_IMAGE}"source.iso -r -J -l -V "${LIVE_DISK_VOLUME}" "${LIVE_ROOT}"/source
;;
net)
# Create tarball
tar cfz source.tar.gz "${LIVE_ROOT}"/source
;;
usb)
# Create image
DU_DIM="`du -ms ${LIVE_ROOT}/source | cut -f1`"
REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 20`" # Just 5% more to be sure, need something more sophistcated here...
dd if=/dev/zero of="${LIVE_ROOT}"/source.img bs=1024k count=${REAL_DIM}
FREELO=`losetup -f`
echo "!!! The following error/warning messages can be ignored !!!"
lh_losetup $FREELO "${LIVE_ROOT}"/source.img 0
set +e
lh_chroot "parted -s ${FREELO} mklabel msdos"
lh_chroot "parted -s ${FREELO} mkpartfs primary fat16 0.0 100%"
lh_chroot "parted -s ${FREELO} set 1 lba off"
set -e
losetup -d ${FREELO}
lh_losetup $FREELO "${LIVE_ROOT}"/source.img 1
lh_chroot "mkfs.msdos -n DEBIAN_LIVE ${FREELO}"
mkdir "${LIVE_ROOT}"/source.tmp
mount ${FREELO} "${LIVE_ROOT}"/source.tmp
cp -r "${LIVE_ROOT}"/source/* "${LIVE_ROOT}"/source.tmp
umount "${LIVE_ROOT}"/source.tmp
rmdir "${LIVE_ROOT}"/source.tmp
losetup -d ${FREELO}
echo "!!! The above error/warning messages can be ignored !!!"
;;
esac
# Deconfigure network
lh_patchnetwork deapply
# Touching stage file
touch "${LIVE_ROOT}"/.stage/image_source
fi

33
helpers/lh_cdebootstrap Executable file
View File

@ -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

6
helpers/lh_chroot Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
# lh_chroot.sh <command>
# 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}

17
helpers/lh_cleanapt Executable file
View File

@ -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

25
helpers/lh_clone Executable file
View File

@ -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

26
helpers/lh_config Executable file
View File

@ -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

51
helpers/lh_configapt Executable file
View File

@ -0,0 +1,51 @@
#!/bin/sh
# lh_configapt.sh <action>
case "${1}" in
apply-proxy)
# Configure ftp proxy
if [ -n "${LIVE_PROXY_FTP}" ]
then
echo "Acquire::ftp::Proxy \"${LIVE_PROXY_FTP}\";" > "${LIVE_CHROOT}"/etc/apt/apt.conf.d/00make-live_ftp-proxy.conf
fi
# Configure http proxy
if [ -n "${LIVE_PROXY_HTTP}" ]
then
echo "Acquire::http::Proxy \"${LIVE_PROXY_HTTP}\";" > "${LIVE_CHROOT}"/etc/apt/apt.conf.d/00make-live_http-proxy.conf
fi
;;
apply-recommends)
# Configure recommends
if [ "${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

60
helpers/lh_confignetwork Executable file
View File

@ -0,0 +1,60 @@
#!/bin/sh
# lh_patchnetwork.sh <action>
# Packages which are manually installed inside the chroot are installed
# from the network. Therefore, we need to be able to resolv hosts.
case "${1}" in
apply-hosts)
# Save host lookup table
if [ -f "${LIVE_CHROOT}"/etc/hosts ]
then
cp "${LIVE_CHROOT}"/etc/hosts \
"${LIVE_CHROOT}"/etc/hosts.orig
fi
# Copy host lookup table
if [ -f /etc/hosts ]
then
cp /etc/hosts "${LIVE_CHROOT}"/etc/hosts
fi
;;
apply-resolv)
# Save resolver configuration
if [ -f "${LIVE_CHROOT}"/etc/resolv.conf ]
then
cp "${LIVE_CHROOT}"/etc/resolv.conf \
"${LIVE_CHROOT}"/etc/resolv.conf.orig
fi
# Copy resolver configuration
if [ -f /etc/resolv.conf ]
then
cp /etc/resolv.conf "${LIVE_CHROOT}"/etc/resolv.conf
fi
;;
deapply-hosts)
# Restore host lookup table
if [ -f "${LIVE_CHROOT}"/etc/hosts.orig ]
then
mv "${LIVE_CHROOT}"/etc/hosts.orig \
"${LIVE_CHROOT}"/etc/hosts
else
rm -f "${LIVE_CHROOT}"/etc/hosts
fi
;;
deapply-resolv)
# Restore resolver configuration
if [ -f "${LIVE_CHROOT}"/etc/resolv.conf.orig ]
then
mv "${LIVE_CHROOT}"/etc/resolv.conf.orig \
"${LIVE_CHROOT}"/etc/resolv.conf
else
rm -f "${LIVE_CHROOT}"/etc/resolv.conf
fi
;;
esac

20
helpers/lh_debootstrap Executable file
View File

@ -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

86
helpers/lh_depends Executable file
View File

@ -0,0 +1,86 @@
#!/bin/sh
# lh_depends.sh <action> <type>
case "${1}" in
install)
if [ -z "${KEEP_MEMTEST86}" ]
then
if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
then
lh_chroot "aptitude install --assume-yes memtest86+"
fi
fi
if [ -z "${KEEP_SYSLINUX}" ]
then
lh_chroot "aptitude install --assume-yes syslinux"
fi
case "${2}" in
usb)
if [ -z "${KEEP_DOSFSTOOLS}" ]
then
lh_chroot "aptitude install --assume-yes dosfstools"
fi
if [ -z "${KEEP_MTOOLS}" ]
then
lh_chroot "aptitude install --assume-yes mtools"
fi
if [ -z "${KEEP_PARTED}" ]
then
lh_chroot "aptitude install --assume-yes parted"
fi
;;
esac
;;
remove)
if [ -z "${KEEP_MEMTEST86}" ]
then
if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
then
lh_chroot "aptitude purge --assume-yes memtest86+"
fi
fi
if [ -z "${KEEP_SYSLINUX}" ]
then
lh_chroot "aptitude purge --assume-yes syslinux"
fi
case "${2}" in
usb)
if [ -z "${KEEP_DOSFSTOOLS}" ]
then
lh_chroot "aptitude purge --assume-yes dosfstools"
fi
if [ -z "${KEEP_MEMTEST86}" ]
then
if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
then
lh_chroot "aptitude purge --assume-yes memtest86+"
fi
fi
if [ -z "${KEEP_MTOOLS}" ]
then
lh_chroot "aptitude purge --assume-yes mtools"
fi
if [ -z "${KEEP_PARTED}" ]
then
lh_chroot "aptitude purge --assume-yes parted"
fi
if [ -z "${KEEP_SYSLINUX}" ]
then
lh_chroot "aptitude purge --assume-yes syslinux"
fi
;;
esac
;;
esac

71
helpers/lh_genrootfs Executable file
View File

@ -0,0 +1,71 @@
#!/bin/sh
# lh_genrootfs.sh <filesystem>
case "${LIVE_FILESYSTEM}" in
ext2)
DU_DIM="`du -ks ${LIVE_CHROOT} | cut -f1`"
REAL_DIM="`expr ${DU_DIM} + ${DU_DIM} / 20`" # Just 5% more to be sure, need something more sophistcated here...
if [ -z "${LIVE_ENCRYPTION}" ]
then
genext2fs --size-in-blocks=${REAL_DIM} --reserved-blocks=0 --root="${LIVE_CHROOT}" "${LIVE_ROOT}"/binary/casper/filesystem.ext2
else
echo "Encrypting ${LIVE_ROOT}/binary/casper/filesystem.ext2 with ${LIVE_ENCRYPTION}..."
while true
do
genext2fs --size-in-blocks=${REAL_DIM} --reserved-blocks=0 --root="${LIVE_CHROOT}" | aespipe -e "${LIVE_ENCRYPTION}" -T > "${LIVE_ROOT}"/binary/casper/filesystem.ext2 && break
echo -n "Something went wrong... Retry? [YES/no] "
read ANSWER
if [ 'no' = "${ANSWER}" ]
then
unset ANSWER
break
fi
done
fi
;;
plain)
if [ -n "${LIVE_ENCRYPTION}" ]
then
echo "Error: encryption is not supported for filesystem type 'plain'"
exit 1
fi
cd "${LIVE_CHROOT}"
find . | cpio -pumd "${LIVE_ROOT}"/binary/casper/filesystem.dir
cd "${OLDPWD}"
;;
squashfs)
if [ -f "${LIVE_ROOT}"/binary/casper/filesystem.squashfs ]
then
rm "${LIVE_ROOT}"/binary/casper/filesystem.squashfs
fi
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

21
helpers/lh_hook Executable file
View File

@ -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

11
helpers/lh_includechroot Executable file
View File

@ -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

32
helpers/lh_installapt Executable file
View File

@ -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

32
helpers/lh_installlinux Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh
# lh_installinux <type>
# Removing initrd backup files
rm -f "${LIVE_CHROOT}"/boot/initrd*bak*
# Setting destination directory
case "${1}" in
iso)
DESTDIR="${LIVE_ROOT}/binary/isolinux"
;;
net)
DESTDIR="${LIVE_ROOT}/tftpboot"
;;
usb)
DESTDIR="${LIVE_ROOT}/binary"
;;
esac
# Installing linux image
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

24
helpers/lh_installmemtest86+ Executable file
View File

@ -0,0 +1,24 @@
#!/bin/sh
# lh_installmemtest86+.sh <type>
# Setting destination directory
case "${1}" in
iso)
DESTDIR="${LIVE_ROOT}/binary/isolinux"
;;
net)
DESTDIR="${LIVE_ROOT}/tftpboot"
;;
usb)
DESTDIR="${LIVE_ROOT}/binary"
;;
esac
# Installing memtest86+
if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
then
cp "${LIVE_ROOT}"/chroot/boot/memtest86+.bin "${DESTDIR}"/memtest
fi

29
helpers/lh_installpackagelists Executable file
View File

@ -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

9
helpers/lh_installpackages Executable file
View File

@ -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

79
helpers/lh_installsyslinux Executable file
View File

@ -0,0 +1,79 @@
#!/bin/sh
# lh_installsyslinux.sh <type>
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

12
helpers/lh_installtasks Executable file
View File

@ -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

10
helpers/lh_localdeb Executable file
View File

@ -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

25
helpers/lh_losetup Executable file
View File

@ -0,0 +1,25 @@
#!/bin/sh
# lh_losetup <device> <file> <partition>
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

12
helpers/lh_manifest Executable file
View File

@ -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

17
helpers/lh_md5sums Executable file
View File

@ -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

18
helpers/lh_patchchroot Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
# lh_patchchroot.sh <action>
# Some maintainer scripts can detect if they are in a chrooted system.
# Therefore, we create the needed file.
case "${1}" in
apply)
# Create chroot file
echo "debian-live" > "${LIVE_CHROOT}"/etc/debian_chroot
;;
deapply)
# Remove chroot file
rm -f "${LIVE_CHROOT}"/etc/debian_chroot
;;
esac

32
helpers/lh_patchlinux Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh
# lh_patchlinux.sh <action>
# The linux-image package asks interactively for initial ramdisk
# creation. Therefore, we preconfigure /etc/kernel-img.conf.
# FIXME: preseeding?
case "${1}" in
apply)
# Save kernel configuration
if [ -f "${LIVE_CHROOT}"/etc/kernel-img.conf ]
then
cp "${LIVE_CHROOT}"/etc/kernel-img.conf \
"${LIVE_CHROOT}"/etc/kernel-img.conf.old
fi
# Configure kernel-img.conf
echo "do_initrd = Yes" >> "${LIVE_CHROOT}"/etc/kernel-img.conf
;;
deapply)
# Restore kernel configuration
if [ -f "${LIVE_CHROOT}"/etc/kernel-img.conf.old ]
then
mv "${LIVE_CHROOT}"/etc/kernel-img.conf.old \
"${LIVE_CHROOT}"/etc/kernel-img.conf
else
rm -f "${LIVE_CHROOT}"/etc/kernel-img.conf
fi
;;
esac

18
helpers/lh_patchnetwork Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
# lh_patchnetwork.sh <action>
# Packages which are manually installed inside the chroot are installed
# from the network. Therefore, we need to be able to resolv hosts.
case "${1}" in
apply)
lh_confignetwork apply-hosts
lh_confignetwork apply-resolv
;;
deapply)
lh_confignetwork deapply-hosts
lh_confignetwork deapply-resolv
;;
esac

27
helpers/lh_patchrunlevel Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
# lh_patchrunlevel.sh <action>
# Disabling all init scripts with a blocking policy as in
# /usr/share/doc/sysv-rc/README.policy-rc.d.gz.
case "${1}" in
apply)
# Create init policy
cat > "${LIVE_CHROOT}"/usr/sbin/policy-rc.d << EOF
#!/bin/sh
echo
echo "Warning: invoke-rc.d policy in action. Skiping daemon starting"
exit 101
EOF
chmod 0755 "${LIVE_CHROOT}"/usr/sbin/policy-rc.d
;;
deapply)
# Removing init policy
rm -f "${LIVE_CHROOT}"/usr/sbin/policy-rc.d
;;
esac

23
helpers/lh_preseed Executable file
View File

@ -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

124
helpers/lh_setupapt Executable file
View File

@ -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

10
helpers/lh_testroot Executable file
View File

@ -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

51
helpers/overview.txt Normal file
View File

@ -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

View File

@ -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 "${@}"

View File

@ -1,20 +0,0 @@
#!/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.
Init ()
{
# Check if user is root
if [ "`id -u`" -ne "0" ]
then
echo "E: ${PROGRAM} requires superuser privilege."
exit 1
fi
}

View File

@ -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
}

View File

@ -1,48 +0,0 @@
#!/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.
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
}

View File

@ -1,165 +0,0 @@
#!/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.
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 <<EOF
#!/bin/sh
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
}
Patch_network ()
{
# 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)
# Save apt configuration
if [ -f "${LIVE_CHROOT}"/etc/apt/apt.conf ]
then
cp "${LIVE_CHROOT}"/etc/apt/apt.conf "${LIVE_CHROOT}"/etc/apt/apt.conf.orig
fi
# Configure apt.conf
if [ -n "${LIVE_PROXY_FTP}" ]
then
echo "Acquire::ftp::Proxy \"${LIVE_PROXY_FTP}\";" >> "${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
}

View File

@ -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 <<EOF
#!/bin/sh
echo
echo "Warning: invoke-rc.d policy in action. Skiping daemon starting"
exit 101
EOF
chmod 755 "${LIVE_CHROOT}"/usr/sbin/policy-rc.d
# Configure sources.list
Indices custom initial
lh_setupapt custom initial
lh_configapt apply-proxy
lh_configapt apply-recommends
# Install aptitude
Chroot_exec "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
Chroot_exec "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
Chroot_exec "aptiude install ${REPOSITORY_KEYRING}"
elif [ -n "${REPOSITORY_KEY}" ]
then
Chroot_exec "wget ${REPOSITORY_KEY}"
Chroot_exec "apt-key add `basename ${REPOSITORY_KEY}`"
Chroot_exec "rm -f `basename ${REPOSITORY_KEY}`"
fi
done
fi
fi
lh_installapt
# Update indices
Chroot_exec "aptitude update"
lh_chroot "aptitude update"
# Configure linux-image
Patch_linux apply
lh_patchlinux apply
# Install linux-image, modules and casper
Chroot_exec "aptitude install --assume-yes ${LIVE_KERNEL_PACKAGES} casper"
lh_chroot "aptitude install --assume-yes ${LIVE_KERNEL_PACKAGES} casper"
# Deconfigure linux-image
Patch_linux deapply
lh_patchlinux deapply
# Cloning existing system configuration
if [ -d "${LIVE_CLONE}" ]
then
# Swapping chroot directories
LIVE_CHROOT_TMP="${LIVE_CHROOT}"
LIVE_CHROOT="${LIVE_CLONE}"
lh_clone
lh_preseed
# Extract debconf settings
Chroot_exec "aptitude install --assume-yes debconf-utils"
Chroot_exec "debconf-get-selections" > "${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
# 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
# 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
lh_chroot "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_config disable-daemons
# 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_manifest
# Add filesystem.manifest
Chroot_exec "dpkg-query -W \*" | awk '$2 ~ /./ {print $1 " " $2 }' > "${LIVE_ROOT}"/filesystem.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

View File

@ -1,372 +0,0 @@
#!/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.
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 <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
}

View File

@ -1,155 +0,0 @@
#!/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.
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
}

View File

@ -1,180 +0,0 @@
#!/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.
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
}

View File

@ -1,218 +0,0 @@
#!/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
# 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
}

View File

@ -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