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