live-build/helpers/lh_binary_iso

164 lines
3.7 KiB
Plaintext
Raw Normal View History

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
2007-10-19 10:54:26 +00:00
Check_package chroot/usr/bin/genisoimage genisoimage
2007-09-23 08:05:11 +00:00
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
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"
GENISOIMAGE_EXCLUDE="boot/grub/stage2_eltorito"
2007-09-23 08:05:12 +00:00
;;
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"
GENISOIMAGE_EXCLUDE="isolinux/isolinux.bin"
2007-09-23 08:05:12 +00:00
;;
yaboot)
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r --iso-level 2 --netatalk -hfs -probe -map"
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} binary/yaboot/hfs.map --chrp-boot -part -no-desktop"
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -hfs-bless binary/yaboot -hfs-volid Debian/Live_powerpc"
GENISOIMAGE_EXCLUDE="yaboot/hfs.map"
2007-09-23 08:05:12 +00:00
;;
*)
Echo_warning "Bootloader on your architecture not yet supported (Continuing in 5 seconds)."
sleep 5
;;
esac
case "${LH_PACKAGES_LISTS}" in
stripped|minimal)
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m ${GENISOIMAGE_EXCLUDE}"
;;
esac
cat > binary.sh << EOF
2007-10-19 10:54:26 +00:00
genisoimage ${GENISOIMAGE_OPTIONS} -o binary.iso -J -l -cache-inodes -allow-multidot binary
EOF
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.sh chroot
2007-09-23 08:05:15 +00:00
mv binary chroot
Chroot "sh binary.sh"
# Move image
mv chroot/binary chroot/binary.iso ./
rm -f chroot/binary.sh
;;
disabled)
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