|
|
@@ -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}" |
|
|
|