| 1 | #!/bin/sh |
| 2 | # this file is executed right at the end of installation, just before reboot. |
| 3 | # it operates from the point of view of the target computer, so / is the target's HDD and so on |
| 4 | # importantly enough, this is actually followed-up after reboot by a custom /etc/rc.local file, which erases itself after running (so it only runs on first reboot) |
| 5 | # the (abundant) feedback messages should not be visible, but they should appear on the installer's syslog. Also yes, I know writing "task finished" after something that might fail isn't the greatest thing. |
| 6 | |
| 7 | |
| 8 | mount /dev/cdrom /media/cdrom |
| 9 | |
| 10 | # first we install the packages we couldn't install automatically |
| 11 | echo 'Installing additional package : firmware-bnx2..' |
| 12 | dpkg -i /media/cdrom/simple-cdd/firmware-bnx2_0.36+wheezy.1_all.deb |
| 13 | echo 'Additional packages installed.' |
| 14 | |
| 15 | # now we unpack our master archive and replace all those conf files and scripts and things |
| 16 | echo 'Unpacking master config files..' |
| 17 | tar xzf /media/cdrom/simple-cdd/master.tar.gz -C / |
| 18 | chown root /etc/cron.d/getswitchtemp |
| 19 | chown root /root/bin/get_switch_temperature |
| 20 | echo 'Files unpacked.' |
| 21 | |
| 22 | # I don't know why things were that way before, but I'm told to set them that way again. |
| 23 | echo 'Moving things around..' |
| 24 | mv /home /var/media/backup |
| 25 | mkdir -p /var/media/backup/dump/{core,dump_delay_line,dump_track_base,log,prod,rec,trace} |
| 26 | ln -s /var/media/backup/home /home |
| 27 | echo 'Things moved.' |
| 28 | |
| 29 | echo 'Adding TRC6500 public key to keyring..' |
| 30 | cat /media/cdrom/simple-cdd/TRC6500.pub | apt-key add - |
| 31 | echo 'Key added.' |
| 32 | |
| 33 | # now enable all the scripts and such.. |
| 34 | echo 'Enabling on-startup scripts..' |
| 35 | update-rc.d waitswitches defaults |
| 36 | update-rc.d waitswitches enable |
| 37 | update-rc.d etherwake defaults |
| 38 | update-rc.d etherwake enable |
| 39 | update-rc.d ipmiwake defaults |
| 40 | update-rc.d ipmiwake enable |
| 41 | update-rc.d wakeonlan defaults |
| 42 | update-rc.d wakeonlan enable |
| 43 | update-rc.d waitslaves defaults |
| 44 | update-rc.d shutdownallblades defaults |
| 45 | update-rc.d checkudevrules enable |
| 46 | update-rc.d checkudevrules defaults |
| 47 | echo 'Scripts enabled.' |
| 48 | |
| 49 | # and these other things too |
| 50 | echo 'Finalizing configuration..' |
| 51 | chown webconfig /etc/webconfig/alias.csv /etc/dhcp/dhcpd.conf* |
| 52 | cp /etc/dhcp/dhcpd.conf.blank /etc/dhcp/dhcpd.conf |
| 53 | chsh -s /usr/bin/pdmenu trc6500 |
| 54 | |
| 55 | # from that sync_master.sh script.. Apparently there from Git shenanigans. |
| 56 | chmod go-rwx /root/.ssh/id_rsa |
| 57 | chmod go-rwx /opt/cluster/slave/root/.ssh |
| 58 | chmod go-rwx /opt/cluster/slave/root/.ssh/id_rsa |
| 59 | chmod a+rwx /opt/tftp |
| 60 | |
| 61 | echo "">/var/log/atftpd.log |
| 62 | chown nobody /var/log/atftpd.log |
| 63 | |
| 64 | update-initramfs -u |
| 65 | echo 'Finalized.' |
| 66 | |
| 67 | # our interfaces file gets written over for some reason, we'll copy it and restore it on first boot |
| 68 | # note : after install, we'll be executing our own rc.local on first boot |
| 69 | echo 'Placing first-boot script (/etc/rc.local)..' |
| 70 | cp /etc/network/interfaces /etc/network/interfaces.original |
| 71 | mv /etc/rc.local /etc/rc.local.original |
| 72 | cp /media/cdrom/simple-cdd/myrc.local /etc/rc.local |
| 73 | echo 'Script copied.' |
| 74 | |
| 75 | echo 'Deleting simple-cdd files on disk..' |
| 76 | rm -r /usr/local/simple-cdd |
| 77 | echo 'Script deleted' |
| 78 | |
| 79 | umount /media/cdrom |