helm/os/arch/install
2017-04-25 19:56:26 -04:00

81 lines
2 KiB
Bash
Executable file

#!/usr/bin/env bash
set -e
shopt -s nullglob
PWD=$(dirname $0)
pacman='sudo pacman --needed --noconfirm'
pacaur='pacaur --needed --noconfirm'
exists() { command -v "$1" >/dev/null; }
########################################
#
# Bootstrap
#
########################################
if ! echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1; then
>&2 echo "No internet connection detected!"
exit 1
elif [[ $(id -u) == 0 ]]; then
>&2 echo "Should not be run as root!"
exit 2
fi
# Essential utilities
$pacman -S wget curl tree rsync openssh dnsutils
# Set up pacaur (AUR helper)
if ! exists pacaur; then
pushd $(mktemp -d)
curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=cower && makepkg --skippgpcheck -sri
curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=pacaur && makepkg --skippgpcheck -sri
TEMP=$(pwd)
popd
rm -rf "$TEMP"
if ! exists pacaur; then
>&2 echo "Pacaur wasn't successfully installed"
exit 3
fi
fi
## Bootstrap
# Helpful utilities
$pacaur -S the_silver_searcher fasd tmux hub bc keybase cronie
sudo systemctl enable cronie.service
if [[ -z $SERVER ]]; then
# crontab
if exists crontab; then
[[ -f $PWD/crontab ]] && crontab $PWD/crontab
fi
# desktop essentials
$pacman -S xorg-init xorg-server
# Desktop manager
$pacaur -S lightdm lightdm-webkit2-greeter
# Window manager
$pacaur -S bspwm sxhkd compton
# Taskbar
$pacaur -S lemonbar-xft-git sutils-git dunst libnotify
# Utilities
$pacaur -S rofi feh sxiv maim slop-opengl neofetch-git pass youtube-dl xdotool
# Apps
$pacaur -S redshift firefox termite
# Audio
$pacaur -S alsa-utils
# Dictionary
$pacaur -S dictd dict-gcide
hookdest=/etc/pacman.d/hooks
sudo mkdir -p "$hookdest"
for hook in $PWD/$hookdest/*.hook; do
[[ -f $hookdest/${hook##*/} ]] || sudo ln -svf $hook $hookdest/
done
fi