8 # Remove unused .bashrc.
11 # Post-installation reduction.
12 dpkg-query -Wf '${Package} ${Priority}\n' | grep ' required' | sed 's/ required//' > list_white_unsorted
13 echo 'ifupdown' >> list_white_unsorted
14 echo 'isc-dhcp-client' >> list_white_unsorted
15 sort list_white_unsorted > list_white
16 dpkg-query -Wf '${Package}\n' > list_all_packages
17 sort list_all_packages > foo
18 mv foo list_all_packages
19 comm -3 list_all_packages list_white > list_black
20 apt-mark auto `cat list_black`
21 echo 'APT::AutoRemove::RecommendsImportant "false";' > /etc/apt/apt.conf.d/99mindeps
22 echo 'APT::AutoRemove::SuggestsImportant "false";' >> /etc/apt/apt.conf.d/99mindeps
23 DEBIAN_FRONTEND=noninteractive apt-get -y --purge autoremove
24 rm list_all_packages list_white_unsorted list_white list_black
25 echo 'APT::Install-Recommends "false";' >> /etc/apt/apt.conf.d/99mindeps
26 echo 'APT::Install-Suggests "false";' >> /etc/apt/apt.conf.d/99mindeps
28 # Set hostname and FQDN.
29 echo 'plomlompom' > /etc/hostname
31 echo '127.0.0.1 localhost' > /etc/hosts
33 echo "$ip plomlompom.com plomlompom" >> /etc/hosts
35 # Call dhclient on startup.
36 cat > /etc/systemd/system/dhclient.service << EOF
38 Description=Ethernet connection
41 ExecStart=/sbin/dhclient eth0
44 WantedBy=multi-user.target
46 systemctl enable /etc/systemd/system/dhclient.service
48 # Package management config, system upgrade.
49 echo 'deb http://ftp.debian.org/debian/ jessie main contrib non-free' > /etc/apt/sources.list
50 echo 'deb http://security.debian.org/ jessie/updates main contrib non-free' >> /etc/apt/sources.list
51 echo 'deb http://ftp.debian.org/debian/ jessie-updates main contrib non-free' >> /etc/apt/sources.list
54 apt-get -y dist-upgrade
57 apt-get -y install man-db manpages less
59 # Don't clear boot messages on start up.
60 sed -i 's/^TTYVTDisallocate=yes$/TTYVTDisallocate=no/g' /etc/systemd/system/getty.target.wants/getty\@tty1.service
63 echo 'Europe/Berlin' > /etc/timezone
64 cp /usr/share/zoneinfo/Europe/Berlin /etc/localtime
67 apt-get -y install locales
68 echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen
71 # Clone git repository.
72 apt-get -y install ca-certificates
73 apt-get -y install git
74 git clone http://github.com/plomlompom/config
77 # Add user. Remove old user's config/ if it exists.
78 useradd -m -s /bin/bash plom
80 rm -rf /home/plom/config
81 su - plom -c 'git clone http://github.com/plomlompom/config /home/plom/config'
82 su plom -c '/home/plom/config/symlink.sh server'
85 apt-get -y install vim
87 su plom -c 'mkdir -p /home/plom/.vimbackups/'
90 apt-get -y install sshguard rsyslog
92 # Set up openssh-server.
93 apt-get -y install openssh-server
96 su plom -c 'mkdir -p /home/plom/mail/'
97 su plom -c 'mkdir -p /home/plom/mail/inbox/{cur,new,tmp}'
98 su plom -c 'mkdir -p /home/plom/mail/new_inbox/{cur,new,tmp}'
99 sed -i 's/^delete = true$/delete = false/g' /home/plom/config/dotfiles_user_server/getmail/getmailrc
100 DEBIAN_FRONTEND=noninteractive apt-get -y install getmail4 procmail mutt postfix maildrop
101 cp config/systemfiles/main.cf /etc/postfix/main.cf
102 cp config/systemfiles/aliases /etc/aliases
104 service postfix restart
106 # Set up regular system update reminder.
107 apt-get -y install cron
108 su plom -c "echo '0 18 * * 0 ~/config/bin/simplemail.sh ~/config/mails/update_reminder' | crontab -"
110 # Set up screen/weechat/OTR/bitlbee. Make bitlbee listen only locally.
111 apt-get -y install screen weechat-plugins python-potr bitlbee
112 sed -i 's/^# DaemonInterface/DaemonInterface = 127.0.0.1 # DaemonInterface/' /etc/bitlbee/bitlbee.conf
113 sedtest=`grep -E '^DaemonInterface = 127.0.0.1 #' /etc/bitlbee/bitlbee.conf | wc -l | cut -d ' ' -f 1`
114 if [ 0 -eq $sedtest ]; then
117 cp config/systemfiles/weechat.service /etc/systemd/system/weechat.service
118 systemctl enable /etc/systemd/system/weechat.service
121 rm jessie_start_server.sh
123 # Send instructions mail.
124 config/bin/simplemail.sh config/mails/server_postinstall_finished
126 # Set password for user.
129 # Finalize everything with a reboot.