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.
 
 
 

82 lines
2.3 KiB

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