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.
 
 
 

80 lines
2.9 KiB

  1. #!/bin/bash
  2. . config || exit 0
  3. set -e
  4. set -x
  5. # Customize the outer ISO image
  6. sed -i -s -e \
  7. "s/DISKNAME.*/DISKNAME NILMbuntu $VERSION/" \
  8. ${ISO}/README.diskdefines
  9. # The .disk/info file is important -- it's used by ubiquity to extract
  10. # out the distro name in dialogs, and I think casper might use it too
  11. echo "NILMbuntu $VERSION" > ${ISO}/.disk/info
  12. # Set up preseed file
  13. cp ${ISO}/preseed/xubuntu.seed ${ISO}/preseed/nilmbuntu.seed
  14. cat >> ${ISO}/preseed/nilmbuntu.seed <<"EOF"
  15. # Commands to run on successful install:
  16. # - Regenerate SSH host keys
  17. # - Remove "quiet splash" from grub command line
  18. # Ubiquity doesn't actually use preseed/late_command, so we do it
  19. # in ubiquity/success_command (which needs things mounted)
  20. ubiquity ubiquity/success_command string \
  21. echo "success_command running" >/target/var/log/installer/postinst.log; \
  22. for i in /dev /dev/pts /dev/shm /sys /sys/kernel/security /proc /cdrom; do \
  23. mount --bind $i /target/$i; done; \
  24. sed -i -e 's/quiet splash//g' /target/etc/default/grub; \
  25. chroot /target update-grub \
  26. >>/target/var/log/installer/postinst.log 2>&1; \
  27. rm -f /target/etc/ssh/ssh_host_*; \
  28. chroot /target dpkg-reconfigure openssh-server \
  29. >>/target/var/log/installer/postinst.log 2>&1; \
  30. for i in /dev/pts /dev/shm /dev /sys/kernel/security /sys /proc /cdrom; do \
  31. umount /target/$i; done; \
  32. echo "success_command done" >>/target/var/log/installer/postinst.log
  33. # Default user. Ubiquity should let them change this.
  34. # (To skip the dialog completely, maybe set a password?)
  35. d-i passwd/user-fullname string NILM User
  36. d-i passwd/username string nilm
  37. #d-i passwd/user-password password nilm
  38. #d-i passwd/user-password-again password nilm
  39. d-i user-setup/allow-password-weak boolean true
  40. d-i passwd/auto-login boolean true
  41. EOF
  42. # Set up isolinux how we want by editing its config
  43. TRY="Boot ^NILMbuntu ${VERSION}"
  44. cp splash.png ${ISO}/isolinux/splash.png
  45. perl -n -i \
  46. -e '$n=1 if /^label/; $n=2 if /^label live-install/; next if $n==2;' \
  47. -e "s/menu label.*(Try|NILM).*/menu label $TRY/g;" \
  48. -e "s,preseed/.*[.]seed,preseed/nilmbuntu.seed,g;" \
  49. -e "s/ quiet splash//g;" \
  50. -e "print;" \
  51. ${ISO}/isolinux/txt.cfg
  52. sed -i -s -e "s/^ui gfxboot/# ui gfxboot/g;" ${ISO}/isolinux/isolinux.cfg
  53. # Set up grub similarly
  54. TRY="Boot NILMbuntu ${VERSION}"
  55. perl -n -i \
  56. -e "next if /menuentry \"Install/../^}$/;" \
  57. -e "next if /menuentry \"OEM install/../^}$/;" \
  58. -e "s/menuentry \"(Try|NILM).*\" \{/menuentry \"${TRY}\" {/g;" \
  59. -e "s,preseed/.*[.]seed,preseed/nilmbuntu.seed,g;" \
  60. -e "s/ quiet splash//g;" \
  61. -e "print;" \
  62. ${ISO}/boot/grub/{grub,loopback}.cfg
  63. if ! [ "$1" == "skip" ] ; then
  64. # Run the customize-inner.sh script inside the chroot
  65. sudo cp nilmbuntu.png ${FS}/usr/share/xfce4/backdrops/nilmbuntu.png
  66. sudo cp customize-inner.sh ${FS}/root/customize-inner.sh
  67. sudo chmod +x ${FS}/root/customize-inner.sh
  68. ./enter.sh "cd /root ; ./customize-inner.sh"
  69. fi