2007-09-23 08:04:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-09-02 11:12:37 +00:00
|
|
|
## live-build(7) - System Build Scripts
|
2013-05-06 12:48:46 +00:00
|
|
|
## Copyright (C) 2006-2012 Daniel Baumann <daniel@debian.org>
|
2010-09-02 11:12:37 +00:00
|
|
|
##
|
2012-07-29 23:59:00 +00:00
|
|
|
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
|
2010-09-02 11:12:37 +00:00
|
|
|
## 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
|
2012-08-27 13:52:29 +00:00
|
|
|
[ -e "${LIVE_BUILD}/scripts/build.sh" ] && . "${LIVE_BUILD}/scripts/build.sh" || . /usr/lib/live/build.sh
|
2007-09-23 08:04:46 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Setting static variables
|
2009-01-15 01:37:42 -01:00
|
|
|
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
|
2008-10-28 14:26:17 -01:00
|
|
|
Read_conffiles config/all config/common config/bootstrap config/chroot config/binary config/source
|
2007-09-23 08:04:46 +00:00
|
|
|
Set_defaults
|
|
|
|
|
2012-12-19 08:52:13 -01:00
|
|
|
case "${LIVE_IMAGE_TYPE}" in
|
2010-02-18 15:34:29 -01:00
|
|
|
iso)
|
2012-12-19 10:21:09 -01:00
|
|
|
IMAGE="${LIVE_IMAGE_NAME}.iso"
|
2010-02-18 15:34:29 -01:00
|
|
|
;;
|
|
|
|
|
|
|
|
iso-hybrid)
|
2012-12-19 10:21:09 -01:00
|
|
|
IMAGE="${LIVE_IMAGE_NAME}.hybrid.iso"
|
2010-02-18 15:34:29 -01:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
2007-09-23 08:05:11 +00:00
|
|
|
|
|
|
|
Echo_message "Begin building binary iso image..."
|
|
|
|
|
|
|
|
# Requiring stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
Require_stagefile .build/config .build/bootstrap
|
2007-09-23 08:05:11 +00:00
|
|
|
|
|
|
|
# Checking stage file
|
2012-06-03 20:42:41 +00:00
|
|
|
Check_stagefile .build/binary_iso
|
2007-09-23 08:05:11 +00:00
|
|
|
|
|
|
|
# Checking lock file
|
|
|
|
Check_lockfile .lock
|
|
|
|
|
|
|
|
# Creating lock file
|
|
|
|
Create_lockfile .lock
|
|
|
|
|
|
|
|
# Checking depends
|
2012-12-16 19:06:25 -01:00
|
|
|
Check_package chroot/usr/bin/xorriso xorriso
|
2013-01-19 16:04:52 -01:00
|
|
|
|
2012-12-19 08:52:13 -01:00
|
|
|
if [ "${LIVE_IMAGE_TYPE}" = "iso-hybrid" ]
|
2013-05-06 12:48:46 +00:00
|
|
|
then
|
2012-12-16 19:06:25 -01:00
|
|
|
Check_package chroot/usr/lib/syslinux/isohdpfx.bin syslinux-common
|
2013-05-06 12:48:46 +00:00
|
|
|
fi
|
2009-12-13 19:21:59 -01:00
|
|
|
|
2007-09-23 08:05:15 +00:00
|
|
|
# Restoring cache
|
2012-06-04 08:52:28 +00:00
|
|
|
Restore_cache cache/packages.binary
|
2007-09-23 08:05:15 +00:00
|
|
|
|
2007-09-23 08:05:11 +00:00
|
|
|
# Installing depends
|
|
|
|
Install_package
|
|
|
|
|
|
|
|
# Remove old iso image
|
2010-02-18 15:34:29 -01:00
|
|
|
if [ -f ${IMAGE} ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2010-02-18 15:34:29 -01:00
|
|
|
rm -f ${IMAGE}
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
|
|
|
|
2012-12-16 19:06:25 -01:00
|
|
|
# Handle xorriso generic options
|
|
|
|
XORRISO_OPTIONS="-as mkisofs -r -J -joliet-long -l -cache-inodes"
|
|
|
|
|
|
|
|
# Handle xorriso live-build specific options
|
2012-12-19 08:52:13 -01:00
|
|
|
if [ "${LIVE_IMAGE_TYPE}" = "iso-hybrid" ]
|
2012-12-16 19:06:25 -01:00
|
|
|
then
|
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -isohybrid-mbr /usr/lib/syslinux/isohdpfx.bin -partition_offset 16"
|
|
|
|
fi
|
2008-10-30 07:27:21 -01:00
|
|
|
|
2009-12-13 19:17:45 -01:00
|
|
|
if [ "${_QUIET}" = "true" ]
|
2007-09-23 12:05:14 +00:00
|
|
|
then
|
2012-12-16 19:06:25 -01:00
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -quiet"
|
2007-09-23 12:05:14 +00:00
|
|
|
fi
|
|
|
|
|
2009-12-13 19:17:45 -01:00
|
|
|
if [ "${_VERBOSE}" = "true" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2012-12-16 19:06:25 -01:00
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -v"
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ -n "${LB_ISO_APPLICATION}" ] && [ "${LB_ISO_APPLICATION}" != "none" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2012-12-16 19:06:25 -01:00
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -A \"${LB_ISO_APPLICATION}\""
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ -n "${LB_ISO_PREPARER}" ] && [ "${LB_ISO_PREPARER}" != "none" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2012-12-16 19:06:25 -01:00
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -p \"${LB_ISO_PREPARER}\""
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ -n "${LB_ISO_PUBLISHER}" ] && [ "${LB_ISO_PUBLISHER}" != "none" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2012-12-16 19:06:25 -01:00
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -publisher \"${LB_ISO_PUBLISHER}\""
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ -n "${LB_ISO_VOLUME}" ] && [ "${LB_ISO_VOLUME}" != "none" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
2012-12-16 19:06:25 -01:00
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -V \"${LB_ISO_VOLUME}\""
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
|
|
|
|
2012-12-16 19:06:25 -01:00
|
|
|
# Handle xorriso architecture specific options
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_BOOTLOADER}" in
|
2007-09-23 08:05:12 +00:00
|
|
|
grub)
|
2012-12-16 19:06:25 -01:00
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
|
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -b boot/grub/stage2_eltorito"
|
|
|
|
XORRISO_EXCLUDE="boot/grub/stage2_eltorito"
|
2007-09-23 08:05:12 +00:00
|
|
|
;;
|
|
|
|
|
2009-10-28 11:15:30 -01:00
|
|
|
grub2)
|
2012-12-16 19:06:25 -01:00
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
|
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -b boot/grub/grub_eltorito -J"
|
|
|
|
XORRISO_EXCLUDE="boot/grub/grub_eltorito"
|
2009-10-28 11:15:30 -01:00
|
|
|
;;
|
|
|
|
|
2008-06-15 03:46:51 +00:00
|
|
|
silo)
|
2012-12-16 19:06:25 -01:00
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -G boot/isofs.b -B ..."
|
|
|
|
XORRISO_EXCLUDE="boot/isofs.b"
|
2008-06-15 03:46:51 +00:00
|
|
|
;;
|
|
|
|
|
2007-09-23 08:05:12 +00:00
|
|
|
syslinux)
|
2012-05-23 05:17:15 +00:00
|
|
|
case "${LB_MODE}" in
|
2012-10-25 11:36:12 +00:00
|
|
|
progress-linux)
|
2012-12-16 19:06:25 -01:00
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -b boot/boot.bin -c boot/boot.cat"
|
|
|
|
XORRISO_EXCLUDE="boot/boot.bin"
|
2012-05-23 05:17:15 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
2012-12-16 19:06:25 -01:00
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -b isolinux/isolinux.bin -c isolinux/boot.cat"
|
|
|
|
XORRISO_EXCLUDE="isolinux/isolinux.bin"
|
2012-05-23 05:17:15 +00:00
|
|
|
;;
|
|
|
|
esac
|
2012-12-16 19:06:25 -01:00
|
|
|
|
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
|
2007-09-23 08:05:12 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
yaboot)
|
2012-12-16 19:06:25 -01:00
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} --iso-level 2 --netatalk -hfs -probe -map"
|
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} binary/yaboot/hfs.map --chrp-boot -part -no-desktop"
|
|
|
|
XORRISO_OPTIONS="${XORRISO_OPTIONS} -hfs-bless binary/yaboot -hfs-volid Debian/Live_powerpc"
|
|
|
|
XORRISO_EXCLUDE="yaboot/hfs.map"
|
2007-09-23 08:05:12 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
2010-09-02 11:22:22 +00:00
|
|
|
Echo_warning "Bootloader on your architecture not yet supported by live-build."
|
2008-10-30 07:30:47 -01:00
|
|
|
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
|
|
|
|
|
2012-07-28 22:24:11 +00:00
|
|
|
#if [ "${LB_DEBIAN_INSTALLER}" != "live" ]
|
|
|
|
#then
|
2012-12-16 19:06:25 -01:00
|
|
|
# XORRISO_OPTIONS="${XORRISO_OPTIONS} -m ${XORRISO_EXCLUDE}"
|
2012-07-28 22:24:11 +00:00
|
|
|
#fi
|
2009-02-03 08:30:10 -01:00
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ "${LB_BOOTLOADER}" = "grub2" ]
|
2009-10-28 11:15:30 -01:00
|
|
|
then
|
|
|
|
|
2007-10-04 23:35:28 +00:00
|
|
|
cat > binary.sh << EOF
|
2009-10-28 11:15:30 -01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
input_dir=/usr/lib/grub/i386-pc
|
|
|
|
|
|
|
|
# build core.img
|
|
|
|
core_img=\$(mktemp)
|
2011-01-17 07:57:10 -01:00
|
|
|
grub-mkimage -d \${input_dir} -o \${core_img} -O i386-pc biosdisk iso9660
|
2009-10-28 11:15:30 -01:00
|
|
|
|
|
|
|
# build grub_eltorito image
|
2009-11-05 11:02:13 -01:00
|
|
|
cat \${input_dir}/cdboot.img \${core_img} > binary/boot/grub/grub_eltorito
|
2009-10-28 11:15:30 -01:00
|
|
|
|
2009-11-05 11:02:13 -01:00
|
|
|
rm -f \${core_img}
|
2009-10-28 11:15:30 -01:00
|
|
|
|
2009-11-05 11:02:13 -01:00
|
|
|
for file in \${input_dir}/*.mod \${input_dir}/efiemu??.o \
|
|
|
|
\${input_dir}/command.lst \${input_dir}/moddep.lst \${input_dir}/fs.lst \
|
|
|
|
\${input_dir}/handler.lst \${input_dir}/parttool.lst
|
2009-10-28 11:15:30 -01:00
|
|
|
do
|
2009-11-05 11:02:13 -01:00
|
|
|
if test -f "\$file"
|
2009-10-28 11:15:30 -01:00
|
|
|
then
|
2009-11-05 11:02:13 -01:00
|
|
|
cp -f "\$file" binary/boot/grub
|
2009-10-28 11:15:30 -01:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
EOF
|
|
|
|
|
|
|
|
else
|
|
|
|
echo "#!/bin/sh" > binary.sh
|
|
|
|
fi
|
|
|
|
|
2013-01-19 16:04:52 -01:00
|
|
|
cat >> binary.sh << EOF
|
|
|
|
|
2012-12-16 19:06:25 -01:00
|
|
|
xorriso ${XORRISO_OPTIONS} -o ${IMAGE} binary
|
2013-01-19 16:04:52 -01:00
|
|
|
EOF
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_BUILD_WITH_CHROOT}" in
|
2009-12-13 19:17:45 -01:00
|
|
|
true)
|
2007-09-23 08:05:15 +00:00
|
|
|
# Moving image
|
2007-10-04 23:35:28 +00:00
|
|
|
mv binary.sh chroot
|
2007-09-23 08:05:15 +00:00
|
|
|
mv binary chroot
|
|
|
|
|
2008-10-28 14:44:06 -01:00
|
|
|
Chroot chroot "sh binary.sh"
|
2007-09-23 08:05:15 +00:00
|
|
|
|
|
|
|
# Move image
|
2010-02-18 15:34:29 -01:00
|
|
|
mv chroot/binary chroot/${IMAGE} ./
|
2007-09-23 08:05:15 +00:00
|
|
|
rm -f chroot/binary.sh
|
|
|
|
;;
|
|
|
|
|
2009-12-13 19:17:45 -01:00
|
|
|
false)
|
2007-09-23 08:05:15 +00:00
|
|
|
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
|
2012-06-04 08:52:28 +00:00
|
|
|
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
|
2012-06-03 20:42:41 +00:00
|
|
|
Create_stagefile .build/binary_iso
|