89 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
			
		
		
	
	
			89 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Bash
		
	
	
		
			Executable file
		
	
	
	
	
#!/usr/bin/env bash
 | 
						|
 | 
						|
# Provisions arch linux. Should be run from a non-root user, after the bootstrap
 | 
						|
# script (and reboot).
 | 
						|
 | 
						|
set -e
 | 
						|
 | 
						|
PWD=$(dirname $0)
 | 
						|
 | 
						|
pacman='sudo pacman --needed --noconfirm'
 | 
						|
pacaur='pacaur --needed --noconfirm'
 | 
						|
 | 
						|
exists() { command -v "$1" >/dev/null; }
 | 
						|
 | 
						|
 | 
						|
########################################
 | 
						|
#
 | 
						|
# Bootstrap
 | 
						|
#
 | 
						|
########################################
 | 
						|
 | 
						|
if ! ping -c1 google.com >/dev/null; 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 git curl tree rsync openssh dnsutils
 | 
						|
 | 
						|
# Set up pacaur (AUR helper)
 | 
						|
if ! exists pacaur; then
 | 
						|
    TEMP="$(mktemp -d)"
 | 
						|
    function cleanup {
 | 
						|
        rm -rf "$TEMP"
 | 
						|
    }
 | 
						|
    trap cleanup EXIT
 | 
						|
 | 
						|
    pushd "$TEMP"
 | 
						|
    curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=cower && makepkg --needed --noconfirm --skippgpcheck -sri
 | 
						|
    curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=pacaur && makepkg --needed --noconfirm --skippgpcheck -sri
 | 
						|
    popd
 | 
						|
 | 
						|
    if ! exists pacaur; then
 | 
						|
        >&2 echo "Pacaur wasn't successfully installed"
 | 
						|
        exit 3
 | 
						|
    fi
 | 
						|
fi
 | 
						|
 | 
						|
 | 
						|
## Bootstrap
 | 
						|
# Helpful utilities
 | 
						|
$pacaur -S ripgrep tmux hub gist bc keybase-bin cronie
 | 
						|
sudo systemctl enable cronie.service
 | 
						|
 | 
						|
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.d/99-sysctl.conf && sudo sysctl --system
 | 
						|
 | 
						|
if [[ -z $SERVER ]]; then
 | 
						|
    if exists crontab; then
 | 
						|
        [[ -f $PWD/crontab ]] && crontab "$PWD/crontab"
 | 
						|
    fi
 | 
						|
 | 
						|
    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
 | 
						|
 | 
						|
    # desktop essentials
 | 
						|
    $pacaur -S \
 | 
						|
        xorg-xinit xorg-server \
 | 
						|
        lightdm lightdm-webkit2-greeter \
 | 
						|
        bspwm sxhkd compton rvxt-unicode rvxt-unicode-terminfo \
 | 
						|
        xcb-proto polybar \
 | 
						|
        dunst libnotify \
 | 
						|
        feh sxiv maim slop-opengl neofetch-git pass youtube-dl xdotool at \
 | 
						|
        redshift chromium chromium-widevine \
 | 
						|
        alsa-utils \
 | 
						|
        dictd dict-gcide \
 | 
						|
        arc-gtk-theme
 | 
						|
 | 
						|
    sudo systemctl enable atd.service
 | 
						|
 | 
						|
    # fonts
 | 
						|
    $pacaur -S ttf-fira-{mono,sans} ttf-dejavu ttf-liberation ttf-font-awesome
 | 
						|
fi
 |