2013-08-17 22:28:49 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# build the iso
|
|
|
|
. config || exit 0
|
|
|
|
|
|
|
|
set -x
|
|
|
|
set -e
|
|
|
|
|
2013-08-19 11:58:48 -04:00
|
|
|
if ! [ "$1" == "skip" ] ; then
|
|
|
|
|
2013-08-17 22:28:49 -04:00
|
|
|
# copy kernel 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"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
# 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
|
|
|
|
|
2013-08-19 11:58:48 -04:00
|
|
|
fi
|
|
|
|
|
2013-08-17 22:28:49 -04:00
|
|
|
# md5sums
|
|
|
|
sudo rm -f md5sum.txt
|
2013-08-19 10:57:38 -04:00
|
|
|
sudo find ${ISO} -type f -print0 \
|
2013-08-17 22:28:49 -04:00
|
|
|
| sudo xargs -0 md5sum \
|
2013-08-19 17:31:43 -04:00
|
|
|
| sed -e "s, ${ISO}, .," \
|
2013-08-17 22:28:49 -04:00
|
|
|
| grep -v isolinux/boot.cat \
|
2013-08-19 17:31:43 -04:00
|
|
|
| grep -v isolinux/isolinux.bin \
|
2013-08-19 14:25:05 -04:00
|
|
|
| grep -v md5sum.txt \
|
|
|
|
| sudo tee ${ISO}/md5sum.txt >/dev/null
|
2013-08-17 22:28:49 -04:00
|
|
|
|
2013-08-18 23:33:33 -04:00
|
|
|
sudo chown -R ${USER} ${ISO}
|
2013-08-18 00:22:35 -04:00
|
|
|
|
2013-08-17 22:28:49 -04:00
|
|
|
# build CD
|
2013-08-18 00:22:35 -04:00
|
|
|
xorriso -as mkisofs \
|
2013-08-19 16:09:38 -04:00
|
|
|
-D -r -V "NilmDBuntu ${VERSION}" -cache-inodes -J -l \
|
2013-08-18 00:22:35 -04:00
|
|
|
-input-charset utf-8 -o ${OUTPUT} \
|
2013-08-17 22:28:49 -04:00
|
|
|
-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 \
|
2013-08-18 00:22:35 -04:00
|
|
|
${ISO}
|
2013-08-18 20:53:22 -04:00
|
|
|
|
|
|
|
# fix iso for hybrid booting
|
2013-08-18 23:33:33 -04:00
|
|
|
isohybrid ${OUTPUT}
|
2013-08-19 15:27:25 -04:00
|
|
|
|
2013-08-19 16:09:38 -04:00
|
|
|
set +x
|
2013-08-19 15:27:25 -04:00
|
|
|
echo "Burn it with:"
|
|
|
|
echo " growisofs -dvd-compat -Z /dev/dvd=${OUTPUT}"
|
|
|
|
echo "or write directly to a USB key"
|