2007-09-23 08:04:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# lh_binary_iso(1) - build iso binary image
|
2007-09-23 08:04:48 +00:00
|
|
|
# Copyright (C) 2006-2007 Daniel Baumann <daniel@debian.org>
|
|
|
|
#
|
|
|
|
# live-helper 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.
|
2007-09-23 08:04:46 +00:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Including common functions
|
|
|
|
LH_BASE="${LH_BASE:-/usr/share/live-helper}"
|
|
|
|
|
|
|
|
for FUNCTION in "${LH_BASE}"/functions/*.sh
|
2007-09-23 08:04:46 +00:00
|
|
|
do
|
2007-09-23 08:05:11 +00:00
|
|
|
. "${FUNCTION}"
|
2007-09-23 08:04:46 +00:00
|
|
|
done
|
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Setting static variables
|
2007-09-23 08:04:48 +00:00
|
|
|
DESCRIPTION="build iso binary image"
|
|
|
|
HELP=""
|
|
|
|
USAGE="${PROGRAM} [--force]"
|
|
|
|
|
|
|
|
Arguments "${@}"
|
|
|
|
|
2007-09-23 08:04:46 +00:00
|
|
|
# Reading configuration files
|
2007-09-23 08:04:52 +00:00
|
|
|
Read_conffile config/common
|
2007-09-23 08:04:46 +00:00
|
|
|
Read_conffile config/bootstrap
|
2007-09-23 08:04:49 +00:00
|
|
|
Read_conffile config/chroot
|
2007-09-23 08:04:52 +00:00
|
|
|
Read_conffile config/binary
|
|
|
|
Read_conffile config/source
|
2007-09-23 08:05:18 +00:00
|
|
|
Read_conffile "${LH_CONFIG}"
|
2007-09-23 08:04:46 +00:00
|
|
|
Set_defaults
|
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if ! echo "${LH_BINARY_IMAGES}" | grep -qs iso
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
Echo_message "Begin building binary iso image..."
|
|
|
|
|
|
|
|
# Requiring stage file
|
|
|
|
Require_stagefile .stage/bootstrap
|
|
|
|
|
|
|
|
# Checking stage file
|
|
|
|
Check_stagefile .stage/binary_iso
|
|
|
|
|
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
|
|
|
|
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
|
|
|
|
|
|
|
# Checking depends
|
|
|
|
Check_package chroot/usr/bin/"${LH_GENISOIMAGE}" ${LH_GENISOIMAGE}
|
|
|
|
|
2007-09-23 08:05:15 +00:00
|
|
|
# Restoring cache
|
|
|
|
Restore_cache cache/packages_binary
|
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Installing depends
|
|
|
|
Install_package
|
|
|
|
|
|
|
|
# Remove old iso image
|
|
|
|
if [ -f binary.iso ]
|
|
|
|
then
|
|
|
|
rm -f binary.iso
|
|
|
|
fi
|
|
|
|
|
2007-09-23 12:05:14 +00:00
|
|
|
if [ "${LH_QUIET}" = "enabled" ]
|
|
|
|
then
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -quiet"
|
|
|
|
fi
|
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
if [ "${LH_VERBOSE}" = "enabled" ]
|
|
|
|
then
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v"
|
|
|
|
fi
|
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if [ -n "${LH_ISO_APPLICATION}" ] && [ "${LH_ISO_APPLICATION}" != "none" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2007-09-23 08:05:17 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LH_ISO_APPLICATION}\""
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if [ -n "${LH_ISO_PREPARER}" ] && [ "${LH_ISO_PREPARER}" != "none" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2007-09-23 08:05:17 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LH_ISO_PREPARER}\""
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if [ -n "${LH_ISO_PUBLISHER}" ] && [ "${LH_ISO_PUBLISHER}" != "none" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2007-09-23 08:05:17 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LH_ISO_PUBLISHER}\""
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if [ -n "${LH_ISO_VOLUME}" ] && [ "${LH_ISO_VOLUME}" != "none" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2007-09-23 08:05:17 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LH_ISO_VOLUME}\""
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Create image
|
2007-09-23 08:05:17 +00:00
|
|
|
case "${LH_BOOTLOADER}" in
|
2007-09-23 08:05:12 +00:00
|
|
|
grub)
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b boot/grub/stage2_eltorito"
|
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if [ "${LH_PACKAGES_LISTS}" = "mini" ] || [ "${LH_PACKAGES_LISTS}" = "minimal" ]
|
2007-09-23 08:05:12 +00:00
|
|
|
then
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m boot/grub/stage2_eltorito"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
syslinux)
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
|
2007-09-23 08:05:13 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b isolinux/isolinux.bin -c isolinux/boot.cat"
|
2007-09-23 08:05:12 +00:00
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if [ "${LH_PACKAGES_LISTS}" = "mini" ] || [ "${LH_PACKAGES_LISTS}" = "minimal" ]
|
2007-09-23 08:05:12 +00:00
|
|
|
then
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m isolinux/isolinux.bin"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
yaboot)
|
2007-09-23 08:05:14 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r --iso-level 2 --netatalk -hfs -probe -map binary/yaboot/hfs.map --chrp-boot -part -no-desktop -hfs-bless binary/yaboot -hfs-volid Debian/Live_powerpc"
|
2007-09-23 08:05:12 +00:00
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
if [ "${LH_PACKAGES_LISTS}" = "mini" ] || [ "${LH_PACKAGES_LISTS}" = "minimal" ]
|
2007-09-23 08:05:12 +00:00
|
|
|
then
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m yaboot/hfs.map"
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
Echo_warning "Bootloader on your architecture not yet supported (Continuing in 5 seconds)."
|
|
|
|
sleep 5
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2007-09-23 08:05:17 +00:00
|
|
|
case "${LH_CHROOT_BUILD}" in
|
2007-09-23 08:05:15 +00:00
|
|
|
enabled)
|
|
|
|
# Moving image
|
|
|
|
mv binary chroot
|
|
|
|
|
2007-09-23 08:05:12 +00:00
|
|
|
cat > chroot/binary.sh << EOF
|
|
|
|
${LH_GENISOIMAGE} ${GENISOIMAGE_OPTIONS} -o binary.iso -J -l -cache-inodes binary
|
2007-09-23 08:05:09 +00:00
|
|
|
EOF
|
|
|
|
|
2007-09-23 08:05:15 +00:00
|
|
|
Chroot "sh binary.sh"
|
|
|
|
|
|
|
|
# Move image
|
|
|
|
mv chroot/binary chroot/binary.iso ./
|
|
|
|
rm -f chroot/binary.sh
|
|
|
|
;;
|
|
|
|
|
|
|
|
disabled)
|
|
|
|
cat > binary.sh << EOF
|
|
|
|
${LH_GENISOIMAGE} ${GENISOIMAGE_OPTIONS} -o binary.iso -J -l -cache-inodes binary
|
|
|
|
EOF
|
|
|
|
|
|
|
|
sh binary.sh
|
|
|
|
rm -f binary.sh
|
|
|
|
;;
|
|
|
|
esac
|
2007-09-23 08:05:09 +00:00
|
|
|
|
2007-09-23 08:05:15 +00:00
|
|
|
# Saving cache
|
|
|
|
Save_cache cache/packages_binary
|
2007-09-23 08:04:48 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Removing depends
|
|
|
|
Remove_package
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Creating stage file
|
|
|
|
Create_stagefile .stage/binary_iso
|