#!/bin/bash
#title           :debian-baseinstall.sh
#description     :Install some basics on Debian
#author          :Daniel Jäger
#date            :20161018
#version         :0.1
#usage           :wget http://scripts.djaeger.info/debian-baseinstall.sh -O - -q | bash
#===============================================================================

# Check if the script is run as root
if [[ $EUID -ne 0 ]]; then
   echo "This script must be run as root"
   exit 1
fi

apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get -y install sudo openssh-server git
adduser djaeger sudo

# Create and permanently activate SWAP-file of 1GB
dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
chmod 600 /var/swap.img
mkswap /var/swap.img
swapon /var/swap.img
echo "/var/swap.img    none    swap    sw    0    0" >> /etc/fstab