Fix buildiso.sh for new EFI stuff

This commit is contained in:
Jim Paris 2016-06-26 02:41:38 -04:00
parent 8b49a30144
commit a2c4eb6258
3 changed files with 33 additions and 21 deletions

2
README
View File

@ -28,6 +28,6 @@ cleanup.sh
SHORT VERSION:
sudo apt-get install squashfs-tools xorriso syslinux systemd-container
sudo apt-get install squashfs-tools xorriso isolinux systemd-container
time sudo sh -c "env BUILD_CONFIG=12.10 ./full-rebuild.sh"
time sudo sh -c "env BUILD_CONFIG=13.04 ./full-rebuild.sh"

View File

@ -1,6 +1,12 @@
#!/bin/bash
# build the iso
# make sure this was run as root
if [ $UID -ne 0 ] ; then
echo "Need to be root; trying sudo"
exec sudo env BUILD_CONFIG=$BUILD_CONFIG $0 "$@"
fi
. config || exit 0
set -x
@ -8,49 +14,52 @@ set -e
if ! [ "$1" == "skip" ] ; then
# copy kernel if changed
# Recompress initrd if changed
if [ ${FS}/initrd.img -nt ${ISO}/casper/initrd.lz ] ; then
sudo cp ${FS}/vmlinuz ${ISO}/casper/vmlinuz
sudo sh -c "zcat ${FS}/initrd.img | lzma > ${ISO}/casper/initrd.lz"
sh -c "zcat ${FS}/initrd.img | lzma > ${ISO}/casper/initrd.lz"
fi
# Get kernel and signed EFI kernel
cp $(readlink -f ${FS}/vmlinuz) ${ISO}/casper/vmlinuz
cp $(readlink -f ${FS}/vmlinuz).efi.signed ${ISO}/casper/vmlinuz.efi
# manifests
sudo chmod +w ${ISO}/casper/filesystem.manifest
sudo chroot ${FS} dpkg-query -W --showformat='${Package} ${Version}\n' \
| sudo tee ${ISO}/casper/filesystem.manifest >/dev/null
chmod +w ${ISO}/casper/filesystem.manifest
chroot ${FS} dpkg-query -W --showformat='${Package} ${Version}\n' \
| tee ${ISO}/casper/filesystem.manifest >/dev/null
# squashfs
sudo rm -f ${ISO}/casper/filesystem.squashfs
sudo mksquashfs ${FS} ${ISO}/casper/filesystem.squashfs
printf $(sudo du -sx --block-size=1 ${FS} | cut -f1) \
| sudo tee ${ISO}/casper/filesystem.size
rm -f ${ISO}/casper/filesystem.squashfs
mksquashfs ${FS} ${ISO}/casper/filesystem.squashfs
printf $(du -sx --block-size=1 ${FS} | cut -f1) \
| tee ${ISO}/casper/filesystem.size
fi
# md5sums
sudo rm -f md5sum.txt
sudo find ${ISO} -type f -print0 \
| sudo xargs -0 md5sum \
rm -f md5sum.txt
find ${ISO} -type f -print0 \
| xargs -0 md5sum \
| sed -e "s, ${ISO}, .," \
| grep -v isolinux/boot.cat \
| grep -v isolinux/isolinux.bin \
| grep -v md5sum.txt \
| sudo tee ${ISO}/md5sum.txt >/dev/null
| tee ${ISO}/md5sum.txt >/dev/null
sudo chown -R ${NONPRIV_UID} ${ISO}
chown -R ${NONPRIV_UID} ${ISO}
# build CD
xorriso -as mkisofs \
-D -r -V "NilmDBuntu ${VERSION}" -cache-inodes -J -l \
-input-charset utf-8 -o ${OUTPUT} \
-joliet -full-iso9660-filenames \
-rational-rock \
-V "NILMbuntu ${VERSION}" \
-input-charset utf-8 -output ${OUTPUT} \
-b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
-boot-load-size 4 -boot-info-table \
-eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot \
-isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
-isohybrid-gpt-basdat -isohybrid-apm-hfsplus \
${ISO}
# fix iso for hybrid booting
isohybrid ${OUTPUT}
set +x
echo "Burn it with:"
echo " growisofs -dvd-compat -Z /dev/dvd=${OUTPUT}"

View File

@ -5,6 +5,9 @@ if [ "$IN_CHROOT" != "1" ] ; then
exit 1
fi
echo ---------------CUSTOMIZE_INNER GIVING UP-----------------
exit
set -e
set -x