home · contact · privacy
Fix server meet preparation script bug.
[config] / all_new_2018 / setup_server.sh
1 #!/bin/sh
2 # Next setup steps for a server whose login policy has just been set from
3 # the outside via ./init_user_and_keybased_login.sh.
4 set -e
5
6 # Provide maximum input for set_hostname_and_fqdn.sh.
7 if [ "$#" -ne 2 ]; then
8     echo 'Need exactly two arguments (hostname, FQDN).'
9     false
10 fi
11 hostname="$1"
12 fqdn="$2"
13
14 # Adapt /etc/ to our needs by hardlinking into ./linkable_etc_files. This
15 # will set basic configurations affecting following steps, such as setup
16 # of APT and the locale selection, so needs to be right at the beginning.
17 ./hardlink_etc.sh all server
18
19 # Set hostname and FQDN.
20 ./set_hostname_and_fqdn.sh "${hostname}" "${fqdn}"
21
22 # Some debconf selections we don't want to get asked during coming
23 # install actions.
24 echo 'iptables-persistent iptables-persistent/autosave_v4 boolean false' | debconf-set-selections
25 echo 'iptables-persistent iptables-persistent/autosave_v6 boolean false' | debconf-set-selections
26
27 # Ensure package installation state as defined by what packages are
28 # defined as required by Debian policy and by settings in ./apt-mark/.
29 apt update
30 ./install_for_target.sh all server
31 ./purge_nonrequireds.sh all server
32
33 # Only upgrade after reducing the system to the desired minimum, so that
34 # we don't need to get more data than necessary.
35 apt -y dist-upgrade
36
37 # Set Berlin localtime.
38 ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
39
40 # If we have not yet set the shell for user plom, ensure it here. This
41 # is mostly for convenience.
42 usermod -s /bin/bash plom