#!/bin/bash

# Lukas Zapletal`s Debian/Ubuntu server fundamental config

if [ -f ~/.fundamentaled ]; then
	echo "This system was already fundamentaled ... exiting.";
	exit;
fi

# package fundamentals
echo "Installing fundamental packages..."
apt-get -qy install vim mc less sudo

# bash fundamentals
echo "Fundamentaling bash..."
echo "alias ll='ls -l'" >> ~/.bashrc
echo "alias la='ls -la'" >> ~/.bashrc
echo 'alias mc="mc -b"' >> ~/.bashrc
echo 'alias agu="sudo apt-get update"' >> ~/.bashrc
echo 'alias agp="sudo apt-get upgrade"' >> ~/.bashrc
echo 'alias agi="sudo apt-get install"' >> ~/.bashrc
echo 'alias agr="sudo apt-get remove"' >> ~/.bashrc
echo 'alias agrp="sudo --purge apt-get remove"' >> ~/.bashrc
echo 'alias acs="apt-cache search"' >> ~/.bashrc
echo 'alias qq="cd ~/DOWNLOAD"' >> ~/.bashrc
echo 'alias log="tail -n 100 -f /var/log/messages"' >> ~/.bashrc
echo 'alias v="vim"' >> ~/.bashrc
echo 'LC_ALL=C; export LC_ALL' >> ~/.bashrc

# midnight fundamentals
if [ -f ~/.mc/ini ]; then
	echo "Fundamentaling mc..."
	cp -f ~/.mc/ini ~/.mc/ini.backup
	cat ~/.mc/ini.backup | sed 's/list_mode=\w*/list_mode=brief/g'\
	| sed 's/sort_order=\w*/sort_order=extension/g' > ~/.mc/ini
fi

# that`s all folks...
echo "Done. Please re-login."
touch ~/.fundamentaled
