Added scripts from lgcore
[debian6500.git] / simple-cdd / profiles / trc6500.postinst
CommitLineData
9c7f26be
OL
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
8mount /dev/cdrom /media/cdrom
9
10# first we install the packages we couldn't install automatically
11echo 'Installing additional package : firmware-bnx2..'
12dpkg -i /media/cdrom/simple-cdd/firmware-bnx2_0.36+wheezy.1_all.deb
13echo 'Additional packages installed.'
14
15# now we unpack our master archive and replace all those conf files and scripts and things
16echo 'Unpacking master config files..'
b3f3562f 17tar xzf /media/cdrom/simple-cdd/master.tar.gz -C /
40346f7c
OL
18chown root /etc/cron.d/getswitchtemp
19chown root /root/bin/get_switch_temperature
9c7f26be
OL
20echo 'Files unpacked.'
21
22# I don't know why things were that way before, but I'm told to set them that way again.
23echo 'Moving things around..'
24mv /home /var/media/backup
25mkdir -p /var/media/backup/dump/{core,dump_delay_line,dump_track_base,log,prod,rec,trace}
26ln -s /var/media/backup/home /home
27echo 'Things moved.'
28
29echo 'Adding TRC6500 public key to keyring..'
30cat /media/cdrom/simple-cdd/TRC6500.pub | apt-key add -
31echo 'Key added.'
32
33# now enable all the scripts and such..
34echo 'Enabling on-startup scripts..'
35update-rc.d waitswitches defaults
36update-rc.d waitswitches enable
37update-rc.d etherwake defaults
38update-rc.d etherwake enable
39update-rc.d ipmiwake defaults
40update-rc.d ipmiwake enable
41update-rc.d wakeonlan defaults
42update-rc.d wakeonlan enable
43update-rc.d waitslaves defaults
44update-rc.d shutdownallblades defaults
45update-rc.d checkudevrules enable
46update-rc.d checkudevrules defaults
47echo 'Scripts enabled.'
48
49# and these other things too
50echo 'Finalizing configuration..'
51chown webconfig /etc/webconfig/alias.csv /etc/dhcp/dhcpd.conf*
52cp /etc/dhcp/dhcpd.conf.blank /etc/dhcp/dhcpd.conf
53chsh -s /usr/bin/pdmenu trc6500
54
55# from that sync_master.sh script.. Apparently there from Git shenanigans.
56chmod go-rwx /root/.ssh/id_rsa
57chmod go-rwx /opt/cluster/slave/root/.ssh
58chmod go-rwx /opt/cluster/slave/root/.ssh/id_rsa
59chmod a+rwx /opt/tftp
b3f3562f
OL
60
61echo "">/var/log/atftpd.log
62chown nobody /var/log/atftpd.log
63
64update-initramfs -u
9c7f26be
OL
65echo '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
69echo 'Placing first-boot script (/etc/rc.local)..'
70cp /etc/network/interfaces /etc/network/interfaces.original
71mv /etc/rc.local /etc/rc.local.original
72cp /media/cdrom/simple-cdd/myrc.local /etc/rc.local
73echo 'Script copied.'
74
40346f7c
OL
75echo 'Deleting simple-cdd files on disk..'
76rm -r /usr/local/simple-cdd
77echo 'Script deleted'
9c7f26be
OL
78
79umount /media/cdrom