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.
 
 
 

76 lines
2.0 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}/boot/initrd.img
  15. VMLINUZ=${FS}/boot/vmlinuz
  16. if ! [ "$1" == "justiso" ] ; then
  17. if ! [ -r ${INITRD} -a -r ${VMLINUZ} ] ; then
  18. set +x
  19. echo "== Missing kernel and/or initrd. Either upgrade or reinstall"
  20. echo "== the kernel inside the image to get the right files."
  21. exit 1
  22. fi
  23. # Copy kernel and initrd
  24. cp ${INITRD} ${ISO}/casper/initrd
  25. cp ${VMLINUZ} ${ISO}/casper/vmlinuz
  26. # manifests
  27. chmod +w ${ISO}/casper/filesystem.manifest
  28. chroot ${FS} dpkg-query -W --showformat='${Package} ${Version}\n' \
  29. | tee ${ISO}/casper/filesystem.manifest >/dev/null
  30. # squashfs
  31. rm -f ${ISO}/casper/filesystem.squashfs
  32. mksquashfs ${FS} ${ISO}/casper/filesystem.squashfs
  33. printf $(du -sx --block-size=1 ${FS} | cut -f1) \
  34. | tee ${ISO}/casper/filesystem.size
  35. fi
  36. # md5sums
  37. rm -f ${ISO}/md5sum.txt
  38. find ${ISO} -type f -print0 \
  39. | xargs -0 md5sum \
  40. | sed -e "s, ${ISO}, .," \
  41. | grep -v isolinux/boot.cat \
  42. | grep -v isolinux/isolinux.bin \
  43. | grep -v md5sum.txt \
  44. | tee ${ISO}/md5sum.txt >/dev/null
  45. chown -R ${NONPRIV_UID} ${ISO}
  46. # build CD
  47. xorriso -as mkisofs \
  48. -joliet -full-iso9660-filenames \
  49. -rational-rock \
  50. -V "NILMbuntu ${VERSION}" \
  51. -input-charset utf-8 -output ${OUTPUT} \
  52. -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
  53. -boot-load-size 4 -boot-info-table \
  54. -eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot \
  55. -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin \
  56. -isohybrid-gpt-basdat -isohybrid-apm-hfsplus \
  57. ${ISO}
  58. set +x
  59. echo "Burn it with:"
  60. echo " growisofs -dvd-compat -Z /dev/dvd=${OUTPUT}"
  61. echo "or write directly to a USB key"