You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

buildiso.sh 2.1 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #!/bin/bash
  2. # build the iso
  3. # make sure this was run as root
  4. if [ $UID -ne 0 ] ; then
  5. echo "Need to be root; trying sudo"
  6. exec sudo env BUILD_CONFIG=$BUILD_CONFIG $0 "$@"
  7. fi
  8. . config || exit 0
  9. set -x
  10. set -e
  11. INITRD=${FS}/initrd.img
  12. VMLINUZ=$(readlink -f ${FS}/vmlinuz)
  13. VMLINUZ_EFI=${VMLINUZ}.efi.signed
  14. if ! [ "$1" == "justiso" ] ; then
  15. if ! [ -r ${INITRD} -a -r ${VMLINUZ} -a -r ${VMLINUZ_EFI} ] ; then
  16. set +x
  17. echo "Missing kernel stuff... Either upgrade or reinstall"
  18. echo "the kernel inside the image to get the right files."
  19. exit 1
  20. fi
  21. # Recompress initrd if changed
  22. if [ ${INITRD} -nt ${ISO}/casper/initrd.lz ] ; then
  23. sh -c "zcat ${INITRD} | lzma > ${ISO}/casper/initrd.lz"
  24. fi
  25. # Get kernel and signed EFI kernel
  26. cp ${VMLINUZ} ${ISO}/casper/vmlinuz
  27. cp ${VMLINUZ_EFI} ${ISO}/casper/vmlinuz.efi
  28. # manifests
  29. chmod +w ${ISO}/casper/filesystem.manifest
  30. chroot ${FS} dpkg-query -W --showformat='${Package} ${Version}\n' \
  31. | tee ${ISO}/casper/filesystem.manifest >/dev/null
  32. # squashfs
  33. rm -f ${ISO}/casper/filesystem.squashfs
  34. mksquashfs ${FS} ${ISO}/casper/filesystem.squashfs
  35. printf $(du -sx --block-size=1 ${FS} | cut -f1) \
  36. | tee ${ISO}/casper/filesystem.size
  37. fi
  38. # md5sums
  39. rm -f md5sum.txt
  40. find ${ISO} -type f -print0 \
  41. | xargs -0 md5sum \
  42. | sed -e "s, ${ISO}, .," \
  43. | grep -v isolinux/boot.cat \
  44. | grep -v isolinux/isolinux.bin \
  45. | grep -v md5sum.txt \
  46. | tee ${ISO}/md5sum.txt >/dev/null
  47. chown -R ${NONPRIV_UID} ${ISO}
  48. # build CD
  49. xorriso -as mkisofs \
  50. -joliet -full-iso9660-filenames \
  51. -rational-rock \
  52. -V "NILMbuntu ${VERSION}" \
  53. -input-charset utf-8 -output ${OUTPUT} \
  54. -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
  55. -boot-load-size 4 -boot-info-table \
  56. -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot \
  57. -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
  58. -isohybrid-gpt-basdat -isohybrid-apm-hfsplus \
  59. ${ISO}
  60. set +x
  61. echo "Burn it with:"
  62. echo " growisofs -dvd-compat -Z /dev/dvd=${OUTPUT}"
  63. echo "or write directly to a USB key"