2016-03-15 20:51:50 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2016-03-18 21:02:45 +00:00
|
|
|
{ # failed download protection
|
|
|
|
|
|
|
|
|
|
|
|
echo "Setup best practice default repositories, see http://httpredir.debian.org/"
|
2016-03-18 21:31:16 +00:00
|
|
|
cat > /etc/apt/sources.list <<EOF
|
2016-03-18 21:02:45 +00:00
|
|
|
deb http://httpredir.debian.org/debian jessie main contrib
|
|
|
|
deb http://httpredir.debian.org/debian jessie-updates main contrib
|
|
|
|
deb http://httpredir.debian.org/debian jessie-backports main contrib
|
|
|
|
deb http://security.debian.org/ jessie/updates main
|
2016-03-15 20:53:21 +00:00
|
|
|
EOF
|
2016-03-18 21:02:45 +00:00
|
|
|
apt update
|
|
|
|
|
|
|
|
|
|
|
|
echo "Install important system tools."
|
|
|
|
apt install -y htop ne iotop curl wget zsh figlet iptraf
|
2016-03-15 20:51:50 +00:00
|
|
|
|
|
|
|
|
2016-03-18 21:02:45 +00:00
|
|
|
echo "Use zsh!"
|
2016-03-18 21:31:16 +00:00
|
|
|
wget -q -O /root/.zshrc http://git.grml.org/f/grml-etc-core/etc/zsh/zshrc
|
|
|
|
cat >>/root/.zshrc << EOF
|
2016-03-18 20:48:13 +00:00
|
|
|
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)"
|
2016-03-18 21:02:45 +00:00
|
|
|
colorls() {
|
2016-03-18 21:31:16 +00:00
|
|
|
/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"
|
2016-03-18 21:02:45 +00:00
|
|
|
}
|
2016-03-18 21:31:16 +00:00
|
|
|
alias ls='command ls -h --color=auto'
|
2016-03-18 21:02:45 +00:00
|
|
|
alias l='colorls'
|
|
|
|
alias ll='colorls -A'
|
2016-03-18 20:48:13 +00:00
|
|
|
EOF
|
2016-03-18 21:02:45 +00:00
|
|
|
chsh -s /bin/zsh
|
2016-03-15 20:51:50 +00:00
|
|
|
|
2016-03-18 21:31:16 +00:00
|
|
|
|
2016-03-18 21:02:45 +00:00
|
|
|
echo "Setup hostname."
|
|
|
|
( exec ne /etc/hostname /etc/hosts )
|
|
|
|
hostname -F /etc/hostname
|
2016-03-15 22:26:31 +00:00
|
|
|
|
2016-03-18 21:31:16 +00:00
|
|
|
|
2016-03-18 21:02:45 +00:00
|
|
|
echo "Nice motd."
|
2016-03-18 21:31:16 +00:00
|
|
|
figlet `hostname -f | sed 's/\./ \. /g'` > /etc/motd
|
|
|
|
|
2016-03-15 22:10:04 +00:00
|
|
|
|
2016-03-18 21:02:45 +00:00
|
|
|
echo "Install system and security utils."
|
|
|
|
apt install -y systemd-cron apticron ssmtp logwatch
|
|
|
|
( exec ne /etc/ssmtp/* )
|
2016-03-15 20:51:50 +00:00
|
|
|
|
2016-03-18 21:31:16 +00:00
|
|
|
|
2016-03-18 21:02:45 +00:00
|
|
|
echo "Disable unneeded getty"
|
|
|
|
for i in {4..6}; do
|
|
|
|
systemctl stop getty@tty$i.service
|
|
|
|
systemctl disable getty@tty$i.service
|
|
|
|
done
|
2016-03-18 20:48:13 +00:00
|
|
|
|
2016-03-15 20:51:50 +00:00
|
|
|
}
|
2016-03-18 21:31:16 +00:00
|
|
|
|