remove keyring crap
[omsmith/bootstrap.git] / bootstrap.sh
1 #!/usr/bin/env bash
2
3 function pause() {
4     read -n1 -s -p "$1"
5 }
6
7 echo bootstrapping machine...
8
9 grep 'http://mirror' /etc/apt/sources.list > /dev/null \
10      || pause "Update /etc/apt/sources.list to use mirror before continuing..."
11
12 # some packages used for initial setup
13 apt-get update
14 apt-get install sed curl
15
16 DIST=`lsb_release -si`
17 DISTVERSION=`lsb_release -sc`
18
19 # we'll be adding emdebian repo if we're on debian
20 if [[ $DIST = "Debian" ]] ; then
21     apt-get install emdebian-archive-keyring
22     cp ./templates/emdebian.list > /etc/apt/sources.list.d/emdebian.list
23 fi
24
25 # add csclub repo
26 sed "s/<distribution>/$DISTVERSION/" < ./templates/csclub.list > /etc/apt/sources.list.d/csclub.list
27 curl -s http://debian.csclub.uwaterloo.ca/csclub.asc | apt-key add -
28
29 apt-get update
30
31 # lets get inapt going
32 apt-get install inapt
33
34 pause "Verify node is correct in pacakges/nodes.ia before continuing..."
35 inapt packages/*.ia
36
37 # network
38 read -p "ip? 129.97.134." IP_SUFFIX
39 sed "s/_IP_SUFFIX/$IP_SUFFIX/" < ./templates/interfaces > /etc/network/interfaces
40
41 # nsswitch
42 cp ./templates/nsswitch.conf /etc/nsswitch.conf
43
44 # ldap
45 cp ./templates/ldap.conf /etc/ldap/ldap.conf
46 if [[ $DIST = "Debian" ]] ; then
47         ln -s /etc/ldap/ldap.conf /etc/sudo-ldap.conf
48 fi
49
50 # nslcd
51 cp ./templates/nslcd.conf /etc/nslcd.conf
52
53 # krb5
54 cp ./templates/krb5.conf /etc/krb5.conf
55
56 # pam.d
57 cp ./templates/common-account /etc/pam.d/common-account
58
59 # nfs
60 cp ./templates/nfs-common /etc/default/nfs-common
61
62 # ssh
63 cp ./templates/ssh_config /etc/ssh/ssh_config
64 cp ./templates/sshd_config /etc/ssh/sshd_config
65
66 echo "prompts for root on caffeine..."
67 scp root@caffeine.csclub.uwaterloo.ca:/etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts
68 scp root@caffeine.csclub.uwaterloo.ca:/etc/hosts /etc/hosts
69 scp root@caffeine.csclub.uwaterloo.ca:/etc/ssl/certs/GlobalSign_Intermediate_Root.pem
70
71 # mounts
72 mkdir /music /scratch /users
73 cat ./templates/fstab >> /etc/fstab
74
75 # root sso
76 cp ./templates/.k5login /root/.k5login
77
78 read -p "Is this an office terminal? " -n 1 -r
79 if [[ $REPLY =~ ^[Yy]$ ]]
80 then
81     # xscreensaver kills machines, redirect to gnome-screensaver
82     cp ./templates/xscreensaver-command /usr/local/bin/xscreensaver-command
83
84     # ncmpc -> nullsleep
85     cp ./templates/ncmpc /usr/local/bin/ncmpc
86
87         # gnome keyring fix
88         rm /etc/pkcs11/modules/gnome-keyring.module
89 fi
90