live-build/helpers/lh_binary_iso

171 lines
4.1 KiB
Plaintext
Raw Normal View History

2007-09-23 08:04:46 +00:00
#!/bin/sh
# lh_binary_iso(1) - build iso binary image
2008-03-06 14:43:00 -01:00
# Copyright (C) 2006-2008 Daniel Baumann <daniel@debian.org>
2007-09-23 08:04:48 +00:00
#
# 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
DESCRIPTION="$(Echo 'build iso binary image')"
2007-09-23 08:04:48 +00:00
HELP=""
USAGE="${PROGRAM} [--force]"
Arguments "${@}"
2007-09-23 08:04:46 +00:00
# Reading configuration files
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
2007-09-23 08:04:46 +00:00
Set_defaults
2008-06-20 00:31:21 +00:00
if ! In_list iso "${LH_BINARY_IMAGES}"
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/config .stage/bootstrap
2007-09-23 08:05:11 +00:00
# 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
# Handle genisoimage generic options
GENISOIMAGE_OPTIONS="-J -l -cache-inodes -allow-multidot"
# Handle genisoimage live-helper specific options
if [ "${_QUIET}" = "enabled" ]
then
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -quiet"
fi
if [ "${_VERBOSE}" = "enabled" ]
2007-09-23 08:05:11 +00:00
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
if In_list "stripped minimal" "${LH_PACKAGES_LISTS}"
then
if [ "${LH_DEBIAN_INSTALLER}" != "live" ]
then
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m ${GENISOIMAGE_EXCLUDE}"
fi
fi
# Handle genisoimage architecture specific options
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
;;
silo)
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -G boot/isofs.b -B ..."
GENISOIMAGE_EXCLUDE="boot/isofs.b"
;;
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 by live-helper."
Echo_warning "This will produce a most likely not bootable image (Continuing in 5 seconds)."
2007-09-23 08:05:12 +00:00
sleep 5
;;
esac
cat > binary.sh << EOF
genisoimage ${GENISOIMAGE_OPTIONS} -o binary.iso 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 chroot "sh binary.sh"
2007-09-23 08:05:15 +00:00
# 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