From 611911c8b14ed0fa3d11b3e817893c7db234e56f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gero=20M=C3=BCller?= Date: Mon, 12 Jun 2017 10:38:21 +1000 Subject: [PATCH] add stretch vm setup script. --- stretch-vm.sh | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 stretch-vm.sh diff --git a/stretch-vm.sh b/stretch-vm.sh new file mode 100644 index 0000000..e25394e --- /dev/null +++ b/stretch-vm.sh @@ -0,0 +1,70 @@ +#!/bin/bash + + +set -e + +{ # failed download protection + + +cat > /etc/apt/sources.list <>/root/.zshrc << EOF +export LS_COLORS="*=00;37:rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:" +RED="$(tput setaf 1)" +ORANGE="$(tput setaf 3)" +BLUE="$(tput setaf 4)" +BLACK="$(tput sgr0)" +colorls() { + /bin/ls -lh --color=yes $@ | sed -e "s/ \([0-9,.]\+K\) / ${BLUE}\1${BLACK} /g" -e "s/ \([0-9.,]\+G\) / ${RED}\1${BLACK} /g" -e "s/ \([0-9.,]\+M\) / ${ORANGE}\1${BLACK} /g" +} +alias ls='command ls -h --color=auto' +alias l='colorls' +alias ll='colorls -A' +EOF +chsh -s /bin/zsh + + +echo "Setup hostname." +( exec ne /etc/hostname /etc/hosts ) +hostname -F /etc/hostname + + +echo "Nice motd." +figlet `hostname -f | sed 's/\./ \. /g'` > /etc/motd + + +echo "Install system and security utils." +apt install -y systemd-cron apticron logwatch unattended-upgrades + +apt install -y ssmtp +( exec ne /etc/ssmtp/* ) + + +echo "Disable unneeded getty" +for i in {4..6}; do + systemctl stop getty@tty$i.service + systemctl disable getty@tty$i.service +done + +wget -q -O /usr/local/sbin/systembackup https://code.camijo.de/gmueller/server-scripts/raw/master/systembackup +if [ ! -f /etc/systembackup.conf ] then +cat >>/etc/systembackup.conf <