3 ## live-build(7) - System Build Scripts
4 ## Copyright (C) 2006-2015 Daniel Baumann <mail@daniel-baumann.ch>
6 ## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
7 ## This is free software, and you are welcome to redistribute it
8 ## under certain conditions; see COPYING for details.
13 # Including common functions
14 [ -e "${LIVE_BUILD}/scripts/build.sh" ] && .
"${LIVE_BUILD}/scripts/build.sh" || .
/usr
/lib
/live
/build.sh
16 # Setting static variables
17 DESCRIPTION
="$(Echo 'build iso binary image')"
19 USAGE
="${PROGRAM} [--force]"
23 # Reading configuration files
24 Read_conffiles config
/all config
/common config
/bootstrap config
/chroot config
/binary config
/source
27 case "${LIVE_IMAGE_TYPE}" in
29 IMAGE
="${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.iso"
33 IMAGE
="${LIVE_IMAGE_NAME}-${LB_ARCHITECTURES}.hybrid.iso"
41 Echo_message
"Begin building binary iso image..."
43 # Requiring stage file
44 Require_stagefile .build
/config .build
/bootstrap
47 Check_stagefile .build
/binary_iso
56 Check_package chroot
/usr
/bin
/xorriso xorriso
57 Check_package chroot
/usr
/lib
/ISOLINUX
/isohdpfx.bin isolinux
60 Restore_cache cache
/packages.binary
65 # Remove old iso image
71 # Handle xorriso generic options
72 XORRISO_OPTIONS
="-R -r -J -joliet-long -l -cache-inodes -iso-level 3"
74 # Handle xorriso live-build specific options
75 if [ "${LIVE_IMAGE_TYPE}" = "iso-hybrid" ]
77 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -partition_offset 16"
80 if [ "${_QUIET}" = "true" ]
82 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -quiet"
85 if [ "${_VERBOSE}" = "true" ]
87 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -v"
90 if [ -n "${LB_ISO_APPLICATION}" ] && [ "${LB_ISO_APPLICATION}" != "none" ]
92 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -A \"${LB_ISO_APPLICATION}\""
95 if [ -n "${LB_ISO_PREPARER}" ] && [ "${LB_ISO_PREPARER}" != "none" ]
97 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -p \"${LB_ISO_PREPARER}\""
100 if [ -n "${LB_ISO_PUBLISHER}" ] && [ "${LB_ISO_PUBLISHER}" != "none" ]
102 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -publisher \"${LB_ISO_PUBLISHER}\""
105 if [ -n "${LB_ISO_VOLUME}" ] && [ "${LB_ISO_VOLUME}" != "none" ]
107 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -V \"${LB_ISO_VOLUME}\""
110 # Handle xorriso architecture specific options
111 case "${LB_BOOTLOADER}" in
113 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
114 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -b boot/grub/stage2_eltorito"
115 XORRISO_EXCLUDE
="boot/grub/stage2_eltorito"
119 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
120 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -b boot/grub/grub_eltorito -J"
121 XORRISO_EXCLUDE
="boot/grub/grub_eltorito"
127 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -b boot/boot.bin -c boot/boot.cat"
128 XORRISO_EXCLUDE
="boot/boot.bin"
132 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -b isolinux/isolinux.bin -c isolinux/boot.cat"
133 XORRISO_EXCLUDE
="isolinux/isolinux.bin"
137 XORRISO_OPTIONS
="${XORRISO_OPTIONS} -no-emul-boot -boot-load-size 4 -boot-info-table"
141 Echo_warning
"Bootloader on your architecture not yet supported by live-build."
142 Echo_warning
"This will produce a most likely not bootable image (Continuing in 5 seconds)."
147 #if [ "${LB_DEBIAN_INSTALLER}" != "live" ]
149 # XORRISO_OPTIONS="${XORRISO_OPTIONS} -m ${XORRISO_EXCLUDE}"
152 if [ "${LB_BOOTLOADER}" = "grub2" ]
155 cat > binary.sh
<< EOF
158 input_dir=/usr/lib/grub/i386-pc
162 grub-mkimage -d \${input_dir} -o \${core_img} -O i386-pc biosdisk iso9660
164 # build grub_eltorito image
165 cat \${input_dir}/cdboot.img \${core_img} > binary/boot/grub/grub_eltorito
169 for file in \${input_dir}/*.mod \${input_dir}/efiemu??.o \
170 \${input_dir}/command.lst \${input_dir}/moddep.lst \${input_dir}/fs.lst \
171 \${input_dir}/handler.lst \${input_dir}/parttool.lst
175 cp -f "\$file" binary/boot/grub/i386-pc
181 echo "#!/bin/sh" > binary.sh
184 cat >> binary.sh
<< EOF
186 xorriso -as mkisofs ${XORRISO_OPTIONS} -o ${IMAGE} binary
189 case "${LB_BUILD_WITH_CHROOT}" in
195 Chroot chroot
"sh binary.sh"
198 mv chroot
/binary chroot
/${IMAGE} .
/
199 rm -f chroot
/binary.sh
209 Save_cache cache
/packages.binary
214 # Creating stage file
215 Create_stagefile .build
/binary_iso