Introduction of installer-making tool simple-cdd
[debian6500.git] / simple-cdd / profiles / trc6500.postinst
diff --git a/simple-cdd/profiles/trc6500.postinst b/simple-cdd/profiles/trc6500.postinst
new file mode 100755 (executable)
index 0000000..0ad5d60
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh
+# this file is executed right at the end of installation, just before reboot.
+# it operates from the point of view of the target computer, so / is the target's HDD and so on
+# 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)
+# 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.
+
+
+mount /dev/cdrom /media/cdrom
+
+# first we install the packages we couldn't install automatically
+echo 'Installing additional package : firmware-bnx2..'
+dpkg -i /media/cdrom/simple-cdd/firmware-bnx2_0.36+wheezy.1_all.deb
+echo 'Additional packages installed.'
+
+# now we unpack our master archive and replace all those conf files and scripts and things
+echo 'Unpacking master config files..'
+tar xzf /media/cdrom/simple-cdd/master.tar -C /
+echo 'Files unpacked.'
+
+# I don't know why things were that way before, but I'm told to set them that way again.
+echo 'Moving things around..'
+mv /home /var/media/backup
+mkdir -p /var/media/backup/dump/{core,dump_delay_line,dump_track_base,log,prod,rec,trace}
+ln -s /var/media/backup/home /home
+echo 'Things moved.'
+
+echo 'Adding TRC6500 public key to keyring..'
+cat /media/cdrom/simple-cdd/TRC6500.pub | apt-key add -
+echo 'Key added.'
+
+# now enable all the scripts and such..
+echo 'Enabling on-startup scripts..'
+update-rc.d waitswitches defaults
+update-rc.d waitswitches enable
+update-rc.d etherwake defaults
+update-rc.d etherwake enable
+update-rc.d ipmiwake defaults
+update-rc.d ipmiwake enable
+update-rc.d wakeonlan defaults
+update-rc.d wakeonlan enable
+update-rc.d waitslaves defaults
+update-rc.d shutdownallblades defaults
+update-rc.d checkudevrules enable
+update-rc.d checkudevrules defaults
+echo 'Scripts enabled.'
+
+# and these other things too
+echo 'Finalizing configuration..'
+chown webconfig /etc/webconfig/alias.csv /etc/dhcp/dhcpd.conf*
+cp /etc/dhcp/dhcpd.conf.blank /etc/dhcp/dhcpd.conf
+chsh -s /usr/bin/pdmenu trc6500
+
+# from that sync_master.sh script.. Apparently there from Git shenanigans.
+chmod go-rwx /root/.ssh/id_rsa
+chmod go-rwx /opt/cluster/slave/root/.ssh
+chmod go-rwx /opt/cluster/slave/root/.ssh/id_rsa
+chmod a+rwx  /opt/tftp
+echo 'Finalized.'
+
+# our interfaces file gets written over for some reason, we'll copy it and restore it on first boot
+# note : after install, we'll be executing our own rc.local on first boot
+echo 'Placing first-boot script (/etc/rc.local)..'
+cp /etc/network/interfaces /etc/network/interfaces.original
+mv /etc/rc.local /etc/rc.local.original
+cp /media/cdrom/simple-cdd/myrc.local /etc/rc.local
+echo 'Script copied.'
+
+
+umount /media/cdrom