2007-09-23 08:04:46 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2010-09-02 11:12:37 +00:00
|
|
|
## live-build(7) - System Build Scripts
|
2010-09-26 10:38:38 +00:00
|
|
|
## Copyright (C) 2006-2010 Daniel Baumann <daniel@debian.org>
|
2010-09-02 11:12:37 +00:00
|
|
|
##
|
|
|
|
## live-build 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
|
2010-09-07 13:11:20 +00:00
|
|
|
. "${LB_BASE:-/usr/share/live/build}"/scripts/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
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_BINARY_IMAGES}" in
|
2010-02-18 15:34:29 -01:00
|
|
|
iso)
|
|
|
|
IMAGE="binary.iso"
|
|
|
|
;;
|
|
|
|
|
|
|
|
iso-hybrid)
|
|
|
|
IMAGE="binary-hybrid.iso"
|
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
esac
|
2007-09-23 08:05:11 +00:00
|
|
|
|
|
|
|
Echo_message "Begin building binary iso image..."
|
|
|
|
|
|
|
|
# Requiring stage file
|
2008-10-14 19:32:50 +00:00
|
|
|
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
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ "${LB_BINARY_IMAGES}" = "iso-hybrid" ]
|
2009-12-13 19:21:59 -01:00
|
|
|
then
|
2010-07-07 15:23:41 +00:00
|
|
|
Check_package chroot/usr/bin/isohybrid syslinux
|
2009-12-13 19:21:59 -01:00
|
|
|
fi
|
|
|
|
|
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
|
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
|
|
|
|
|
2008-10-30 07:27:21 -01:00
|
|
|
# Handle genisoimage generic options
|
|
|
|
GENISOIMAGE_OPTIONS="-J -l -cache-inodes -allow-multidot"
|
|
|
|
|
2010-09-02 11:22:22 +00:00
|
|
|
# Handle genisoimage live-build specific options
|
2009-12-13 19:17:45 -01:00
|
|
|
if [ "${_QUIET}" = "true" ]
|
2007-09-23 12:05:14 +00:00
|
|
|
then
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -quiet"
|
|
|
|
fi
|
|
|
|
|
2009-12-13 19:17:45 -01:00
|
|
|
if [ "${_VERBOSE}" = "true" ]
|
2007-09-23 08:05:11 +00:00
|
|
|
then
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -v"
|
|
|
|
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
|
2010-09-07 13:11:20 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_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
|
2010-09-07 13:11:20 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_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
|
2010-09-07 13:11:20 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_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
|
2010-09-07 13:11:20 +00:00
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -V \"${LB_ISO_VOLUME}\""
|
2007-09-23 08:05:11 +00:00
|
|
|
fi
|
|
|
|
|
2008-10-30 07:27:21 -01:00
|
|
|
# Handle genisoimage architecture specific options
|
2010-09-07 13:11:20 +00:00
|
|
|
case "${LB_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-27 12:58:02 +00:00
|
|
|
GENISOIMAGE_EXCLUDE="boot/grub/stage2_eltorito"
|
2007-09-23 08:05:12 +00:00
|
|
|
;;
|
|
|
|
|
2009-10-28 11:15:30 -01:00
|
|
|
grub2)
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -r -b boot/grub/grub_eltorito -J"
|
|
|
|
GENISOIMAGE_EXCLUDE="boot/grub/grub_eltorito"
|
|
|
|
;;
|
|
|
|
|
2008-06-15 03:46:51 +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"
|
2007-09-27 12:58:02 +00:00
|
|
|
GENISOIMAGE_EXCLUDE="isolinux/isolinux.bin"
|
2007-09-23 08:05:12 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
yaboot)
|
2007-09-27 12:58:02 +00:00
|
|
|
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
|
|
|
;;
|
|
|
|
|
|
|
|
*)
|
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
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if In_list "stripped minimal" "${LB_PACKAGES_LISTS}"
|
2009-02-03 08:30:10 -01:00
|
|
|
then
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ "${LB_DEBIAN_INSTALLER}" != "live" ]
|
2009-02-03 08:30:10 -01:00
|
|
|
then
|
|
|
|
GENISOIMAGE_OPTIONS="${GENISOIMAGE_OPTIONS} -m ${GENISOIMAGE_EXCLUDE}"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
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)
|
2010-09-26 10:38:38 +00:00
|
|
|
grub-mkimage -d \${input_dir} -o \${core_img} 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
|
|
|
|
|
|
|
|
cat >> binary.sh << EOF
|
|
|
|
|
2010-02-18 15:34:29 -01:00
|
|
|
genisoimage ${GENISOIMAGE_OPTIONS} -o ${IMAGE} binary
|
2007-10-04 23:35:28 +00:00
|
|
|
EOF
|
|
|
|
|
2010-09-07 13:11:20 +00:00
|
|
|
if [ "${LB_BINARY_IMAGES}" = "iso-hybrid" ]
|
2009-12-13 19:21:59 -01:00
|
|
|
then
|
|
|
|
|
|
|
|
cat >> binary.sh << EOF
|
|
|
|
|
2010-05-21 05:31:16 +00:00
|
|
|
isohybrid ${ISOHYBRID_OPTIONS} ${IMAGE}
|
2009-12-13 19:21:59 -01:00
|
|
|
EOF
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
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
|
|
|
|
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
|