dotfiles/install.sh

155 lines
3.3 KiB
Bash
Raw Normal View History

#!/bin/bash
set -e
# install.sh
# This script installs my basic setup for a debian laptop
USERNAME=fschl
apt_sources() {
cat <<-EOF > /etc/apt/sources.list
2015-12-20 23:49:15 +01:00
deb http://ftp.de.debian.org/debian/ stable main contrib non-free
deb-src http://ftp.de.debian.org/debian/ stable main contrib non-free
2015-12-20 23:49:15 +01:00
deb http://security.debian.org/ stable/updates main contrib non-free
deb-src http://security.debian.org/ stable/updates main contrib non-free
2015-12-20 23:49:15 +01:00
# stable-updates, previously known as 'volatile'
deb http://ftp.de.debian.org/debian/ stable-updates main contrib non-free
deb-src http://ftp.de.debian.org/debian/ stable-updates main contrib non-free
2016-07-01 01:37:22 +02:00
deb http://ftp.de.debian.org/debian/ stable-proposed-updates main
deb http://ftp.de.debian.org/debian/ testing main
EOF
2015-12-20 23:49:15 +01:00
}
base_applications() {
2016-07-01 01:37:22 +02:00
echo "update and installing baseapps..."
apt-get update
apt-get upgrade
apt-get install -y \
alsa-utils \
apt-transport-https \
automake \
bash-completion \
2016-08-26 13:46:08 +02:00
bmon \
bzip2 \
ca-certificates \
cmake \
coreutils \
curl \
gcc \
git \
gnupg \
gnupg-agent \
gnupg-curl \
grep \
2015-12-20 23:49:15 +01:00
htop \
2016-08-26 13:46:08 +02:00
iotop \
locales \
make \
mount \
net-tools \
2015-12-20 23:49:15 +01:00
pulseaudio \
2016-08-26 13:46:08 +02:00
rsync \
ssh \
sudo \
tar \
tree \
xclip \
zip \
--no-install-recommends
2016-07-01 01:37:22 +02:00
echo "... DONE... cleaning up\n\n"
apt-get autoremove
apt-get autoclean
apt-get clean
2016-08-10 16:33:19 +02:00
echo "... setting capslock to control"
sed -i "s/^XKBOPTIONS=.*/XKBOPTIONS=\"ctrl:nocaps\"/" /etc/default/keyboard
}
install_i3() {
2016-07-01 01:37:22 +02:00
echo "update and installing i3wm..."
apt-get update
apt-get install -y \
feh \
i3 \
i3lock \
i3status \
rxvt-unicode-256color \
scrot \
slim \
2015-12-20 23:49:15 +01:00
xorg \
--no-install-recommends
2016-07-01 01:37:22 +02:00
echo "... DONE... cleaning up\n\n"
apt-get autoremove
apt-get autoclean
apt-get clean
2015-12-20 23:49:15 +01:00
}
install_docker() {
2016-07-01 01:37:22 +02:00
echo "installing docker from get.docker.com | sh..."
2015-12-20 23:49:15 +01:00
adduser -aG docker "$USERNAME"
curl -sSL https://get.docker.com/ | sh
2016-07-01 01:37:22 +02:00
}
install_compose() {
VERS="1.7.1"
echo "installing docker-compose $VERS ... curling from github"
curl -SL https://github.com/docker/compose/releases/download/$VERS/docker-compose-Linux-x86_64 \
2015-12-20 23:49:15 +01:00
-o /usr/bin/docker-compose
chmod +x /usr/bin/docker-compose
2016-07-01 01:37:22 +02:00
echo "... done"
/usr/bin/docker-compose version
}
get_dotfiles() {
(
git clone https://github.com/fschl/dotfiles.git "/home/$USERNAME/dotfiles"
2016-03-08 10:37:50 +01:00
cd "/home/$USERNAME/dotfiles" && make
git clone https://github.com/fschl/dockerfiles.git "/home/$USERNAME/dockerfiles"
2015-12-20 23:49:15 +01:00
git clone https://github.com/fschl/.emacs.d.git "/home/$USERNAME/.emacs.d"
)
}
main() {
2016-07-01 01:37:22 +02:00
local cmd=$1
2016-07-01 01:37:22 +02:00
if [[ -z "$cmd" ]]; then
apt_sources
2016-07-01 01:37:22 +02:00
base_applications
install_docker
install_i3
fi
if [[ $cmd == "compose" ]]; then
install_compose
elif [[ $cmd == "dotfiles" ]]; then
get_dotfiles
fi
2015-12-20 23:49:15 +01:00
}
main "$@"