-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathstretch-postinst.sh
58 lines (37 loc) · 1.06 KB
/
stretch-postinst.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
NAME="server-$RANDOM"
DOMAIN="example.com"
apt-get -y remove nano vim-tiny systemd
apt-get -y install git vim-nox ca-certificates
echo "${NAME}.${DOMAIN}" > /etc/hostname
sed -i "s/^127\.0\.1\.1.*/127.0.1.1 $NAME $NAME.$DOMAIN/" /etc/hosts
sed -i "s/^%sudo.*/%sudo ALL=(ALL:ALL) NOPASSWD:ALL/" /etc/sudoers
>/etc/motd
update-rc.d -f motd remove
# add stuff to be run once on first boot
cat << END > /etc/rc.local.my
#!/bin/sh -e
# local startup script
exit 0
END
cat << END > /etc/rc.local
#!/bin/sh -e
#
# rc.local
mkdir /home/petr/.ssh
wget -O /home/petr/.ssh/authorized_keys https://petr.kle.cz/debian/authorized_keys
chown -R petr:users /home/petr/.ssh
chmod -R og-rwx /home/petr/.ssh
apt-get install -y salt-minion
/etc/init.d/salt-minion stop
update-rc.d -f salt-minion remove
echo 'file_client: local' > /etc/salt/minion
echo 'testmachine: OK' > /etc/salt/grains
mkdir /srv/salt /srv/pillar
chown petr:users /srv/salt /srv/pillar
chmod og-rwx /srv/salt /srv/pillar
cat /etc/rc.local.my > /etc/rc.local
rm /etc/rc.local.my
shutdown -r -t 0
exit 0
END