Introduction of installer-making tool simple-cdd
[debian6500.git] / simple-cdd / profiles / trc6500.postinst
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 -C /
18 echo 'Files unpacked.'
19
20 # I don't know why things were that way before, but I'm told to set them that way again.
21 echo 'Moving things around..'
22 mv /home /var/media/backup
23 mkdir -p /var/media/backup/dump/{core,dump_delay_line,dump_track_base,log,prod,rec,trace}
24 ln -s /var/media/backup/home /home
25 echo 'Things moved.'
26
27 echo 'Adding TRC6500 public key to keyring..'
28 cat /media/cdrom/simple-cdd/TRC6500.pub | apt-key add -
29 echo 'Key added.'
30
31 # now enable all the scripts and such..
32 echo 'Enabling on-startup scripts..'
33 update-rc.d waitswitches defaults
34 update-rc.d waitswitches enable
35 update-rc.d etherwake defaults
36 update-rc.d etherwake enable
37 update-rc.d ipmiwake defaults
38 update-rc.d ipmiwake enable
39 update-rc.d wakeonlan defaults
40 update-rc.d wakeonlan enable
41 update-rc.d waitslaves defaults
42 update-rc.d shutdownallblades defaults
43 update-rc.d checkudevrules enable
44 update-rc.d checkudevrules defaults
45 echo 'Scripts enabled.'
46
47 # and these other things too
48 echo 'Finalizing configuration..'
49 chown webconfig /etc/webconfig/alias.csv /etc/dhcp/dhcpd.conf*
50 cp /etc/dhcp/dhcpd.conf.blank /etc/dhcp/dhcpd.conf
51 chsh -s /usr/bin/pdmenu trc6500
52
53 # from that sync_master.sh script.. Apparently there from Git shenanigans.
54 chmod go-rwx /root/.ssh/id_rsa
55 chmod go-rwx /opt/cluster/slave/root/.ssh
56 chmod go-rwx /opt/cluster/slave/root/.ssh/id_rsa
57 chmod a+rwx /opt/tftp
58 echo 'Finalized.'
59
60 # our interfaces file gets written over for some reason, we'll copy it and restore it on first boot
61 # note : after install, we'll be executing our own rc.local on first boot
62 echo 'Placing first-boot script (/etc/rc.local)..'
63 cp /etc/network/interfaces /etc/network/interfaces.original
64 mv /etc/rc.local /etc/rc.local.original
65 cp /media/cdrom/simple-cdd/myrc.local /etc/rc.local
66 echo 'Script copied.'
67
68
69 umount /media/cdrom