9493769f84b7464ca23111e833eb9c0b626fee74
[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 # note that much of what used to be here was put in the postinst file for the deb package we unpack
7
8
9 mount /dev/cdrom /media/cdrom
10
11 # first we install the packages we couldn't install automatically
12 echo 'Installing additional package : firmware-bnx2...'
13 dpkg -i /media/cdrom/simple-cdd/firmware-bnx2_0.36+wheezy.1_all.deb
14 echo 'Additional packages installed'
15
16 #debugging
17 echo 'force-confnew' > /etc/dpkg/dpkg.cfg.d/trc6500
18
19 # now we unpack our master archive and replace all those conf files and scripts and things
20 echo 'Unpacking master config files...'
21 dpkg -i /media/cdrom/simple-cdd/trc6500-master-file* # version-proof
22 echo 'Files unpacked'
23
24 echo 'Adding TRC6500 public key to keyring...'
25 cat /media/cdrom/simple-cdd/TRC6500.pub | apt-key add -
26 echo 'Key added'
27
28 echo 'Removing exim packages...'
29 dpkg -l | awk '/exim/ {print $2}' | xargs dpkg --remove bsd-mailx
30 find /media/cdrom0 -name libgnutls-openssl\*_\* -o -name ssmtp_\* -o -name bsd-mailx_\* | xargs dpkg --install
31 echo 'Exim remove'
32
33 # our interfaces file gets written over for some reason, we'll copy it and restore it on first boot
34 # note : after install, we'll be executing our own rc.local on first boot
35 echo 'Copying first-boot script (/etc/rc.local)...'
36 cp /etc/network/interfaces /etc/network/interfaces.original
37 mv /etc/rc.local /etc/rc.local.original
38 cp /media/cdrom/simple-cdd/myrc.local /etc/rc.local
39 echo 'Script copied'
40
41 echo 'Deleting simple-cdd files on disk...'
42 rm -r /usr/local/simple-cdd
43 rm -r /etc/dpkg/dpkg.cfg.d/trc6500
44 echo 'Files deleted'
45
46 echo 'Umount cdrom'
47 umount /media/cdrom
48
49 exit 0