live-build/helpers/lh_binary_iso

141 lines
3.3 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
# Source common functions
for FUNCTION in /usr/share/live-helper/functions/*.sh
do
. ${FUNCTION}
done
2007-09-23 08:04:48 +00:00
# Set static variables
DESCRIPTION="build iso binary image"
HELP=""
USAGE="${PROGRAM} [--force]"
Arguments "${@}"
2007-09-23 08:04:49 +00:00
Echo_debug "Init ${PROGRAM}"
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:04:46 +00:00
Set_defaults
2007-09-23 08:05:09 +00:00
for IMAGE in ${LIVE_BINARY_IMAGES}
2007-09-23 08:04:46 +00:00
do
if [ "${IMAGE}" = "iso" ]
then
2007-09-23 08:04:49 +00:00
Breakpoint "binary_iso: Init"
2007-09-23 08:04:48 +00:00
# Requiring stage file
Require_stagefile .stage/bootstrap
2007-09-23 08:04:50 +00:00
# Checking stage file
Check_stagefile .stage/binary_iso
2007-09-23 08:04:48 +00:00
# Checking lock file
Check_lockfile .lock
# Creating lock file
Create_lockfile .lock
2007-09-23 08:04:51 +00:00
# Checking depends
Check_package chroot/usr/bin/"${LH_GENISOIMAGE}" ${LH_GENISOIMAGE}
2007-09-23 08:04:48 +00:00
2007-09-23 08:04:51 +00:00
# Installing depends
Install_package
2007-09-23 08:04:48 +00:00
# Remove old iso image
2007-09-23 08:04:47 +00:00
if [ -f binary.iso ]
2007-09-23 08:04:46 +00:00
then
2007-09-23 08:04:47 +00:00
rm -f binary.iso
2007-09-23 08:04:46 +00:00
fi
2007-09-23 08:04:51 +00:00
if [ "${LH_VERBOSE}" = "enabled" ]
then
2007-09-23 08:04:52 +00:00
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v"
2007-09-23 08:04:51 +00:00
fi
2007-09-23 08:05:10 +00:00
if [ -n "${LIVE_ISO_APPLICATION}" ] && [ "${LIVE_ISO_APPLICATION}" != "none" ]
then
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -A \"${LIVE_ISO_APPLICATION}\""
fi
if [ -n "${LIVE_ISO_PREPARER}" ] && [ "${LIVE_ISO_PREPARER}" != "none" ]
then
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -p \"${LIVE_ISO_PREPARER}\""
fi
if [ -n "${LIVE_ISO_PUBLISHER}" ] && [ "${LIVE_ISO_PUBLISHER}" != "none" ]
then
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -publisher \"${LIVE_ISO_PUBLISHER}\""
fi
if [ -n "${LIVE_ISO_VOLUME}" ] && [ "${LIVE_ISO_VOLUME}" != "none" ]
then
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LIVE_ISO_VOLUME}\""
fi
2007-09-23 08:04:48 +00:00
# Moving image
mv binary chroot
2007-09-23 08:04:46 +00:00
# Create image
if [ "${LIVE_ARCHITECTURE}" = "amd64" ] || [ "${LIVE_ARCHITECTURE}" = "i386" ]
then
2007-09-23 08:04:49 +00:00
case "${LIVE_BOOTLOADER}" in
grub)
2007-09-23 08:05:09 +00:00
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -b boot/grub/stage2_eltorito"
if [ "${LIVE_PACKAGES_LISTS}" = "mini" ] || [ "${LIVE_PACKAGES_LISTS}" = "minimal" ]
then
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m boot/grub/stage2_eltorito"
fi
2007-09-23 08:04:49 +00:00
;;
syslinux)
2007-09-23 08:05:09 +00:00
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -b isolinux/isolinux.bin -c isolinux/boot.cat"
if [ "${LIVE_PACKAGES_LISTS}" = "mini" ] || [ "${LIVE_PACKAGES_LISTS}" = "minimal" ]
then
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m isolinux/isolinux.bin"
fi
;;
*)
Echo_warning "Bootloader on your architecture not yet supported (Continuing in 5 seconds)."
sleep 5
2007-09-23 08:04:49 +00:00
;;
esac
2007-09-23 08:05:09 +00:00
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
2007-09-23 08:04:48 +00:00
fi
2007-09-23 08:05:09 +00:00
cat >> chroot/binary.sh << EOF
2007-09-23 08:05:10 +00:00
${LH_GENISOIMAGE} ${GENISOIMAGE_OPTIONS} -o binary.iso -r -J -l -cache-inodes binary
2007-09-23 08:05:09 +00:00
EOF
Chroot "sh binary.sh"
2007-09-23 08:04:48 +00:00
# Move image
mv chroot/binary chroot/binary.iso ./
2007-09-23 08:05:09 +00:00
rm -f chroot/binary.sh
2007-09-23 08:04:48 +00:00
2007-09-23 08:04:51 +00:00
# Removing depends
Remove_package
2007-09-23 08:04:46 +00:00
# Creating stage file
2007-09-23 08:04:47 +00:00
Create_stagefile .stage/binary_iso
2007-09-23 08:04:46 +00:00
fi
done