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