#!/usr/bin/env bash # check if root if [[ $EUID -ne 0 ]]; then echo "This script must be run as root" 1>&2 exit 1 fi # check if debian if [ ! "$(grep -Ei 'debian|buntu' /etc/*release)" ]; then echo "This script must be run on a debian system" 1>&2 exit 1 fi # update system apt-get update -y apt-get dist-upgrade -y apt-get autoclean -y # get users directory root_user_path=$(grep ':0:' /etc/passwd | awk -F':' '{print $6}') default_user_path=$(egrep '\:100[0-9]\:' /etc/passwd | tail -n 1 | awk -F':' '{print $6}') default_user=$(egrep '\:100[0-9]\:' /etc/passwd | tail -n 1 | awk -F':' '{print $1}') # default shell apt-get install -y sudo mc tree pv vim bash-completion # zsh shell apt-get install -y zsh && ( sed -i -- 's/\/bin\/bash/\/bin\/zsh/' /etc/passwd wget -O /etc/zsh/newuser.zshrc.recommended \ http://git.grml.org/f/grml-etc-core/etc/zsh/zshrc cp -f /etc/zsh/newuser.zshrc.recommended ${default_user_path}/.zshrc cp -f /etc/zsh/newuser.zshrc.recommended ${root_user_path}/.zshrc ) # add tmux auto start apt-get install -y tmux && ( echo 'if [ "$TMUX" = "" ]; then tmux; fi' | cat - ${default_user_path}/.zshrc > \ /tmp/.zshrc && mv /tmp/.zshrc ${default_user_path}/.zshrc ) # diagnostics apt-get install -y htop iotop iftop nmon powertop stress lm-sensors \ gddrescue smartmontools kpartx nmap # programming apt-get install -y git build-essential # networking apt-get install -y axel wget ethtool fping # misc. tools apt-get install -y apt-file aptitude hexedit manpages-de # configure vim touch ${root_user_path}/.vimrc ${default_user_path}/.vimrc for config in "filetype plugin indent on" "set tabstop=4" "set shiftwidth=4" \ "set expandtab" "syntax enable" "set softtabstop=4" \ "set number" "set showcmd" "set cursorline"; do grep "$config" ${root_user_path}/.vimrc || echo "$config" >> ${root_user_path}/.vimrc grep "$config" ${default_user_path}/.vimrc || echo "$config" >> ${default_user_path}/.vimrc done # configure user files chown ${default_user}:${default_user} ${default_user_path}/.vimrc ${default_user_path}/.zshrc # configure tmux cat > /etc/tmux.conf <