os/arch: rewrite and minimalize install script

This commit is contained in:
Henrik Lissner 2016-12-16 22:24:15 -05:00
parent 6b8989d1a1
commit 9cb8ce5625

View file

@ -1,16 +1,12 @@
#!/bin/bash #!/usr/bin/env bash
PWD=$(dirname $0) PWD=$(dirname $0)
pacman="sudo pacman --needed --noconfirm -S"
pacaur="sudo pacaur --needed --noconfirm -y" pacman='sudo pacman --needed --noconfirm'
pacaur='pacaur --needed --noconfirm'
exists() { command -v "$1" >/dev/null; } exists() { command -v "$1" >/dev/null; }
install() {
echo "==> Installing: $@"
sudo pacmaur --needed --noconfirm -S $@
}
######################################## ########################################
# #
@ -21,37 +17,47 @@ install() {
if ! echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1; then 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!" >&2 echo "No internet connection detected!"
exit 1 exit 1
elif [[ $(id -u) == 0 ]]; then
>&2 echo "Should not be run as root!"
exit 2
fi fi
## Datetime # Essential utilities
sudo timedatectl set-ntp true $pacman -S wget curl tree rsync openssh dnsutils
sudo timedatectl set-timezone America/Toronto
# Use localtime b/c I expect to dualboot with windows (hisssss)
sudo hwclock --systohc --localtime
# Set locale # Set up pacaur (AUR helper)
sed -i '/^#en_US\.UTF-8/s/^#//' /etc/locale.gen if ! exists pacaur; then
locale-gen
ln -sfv /usr/share/zoneinfo/America/Toronto /etc/localtime
# Be verbose about package updates
sed -i 's/^#\(VerbosePkgLists.*\)/\1/' /etc/pacman.conf
## AUR helper
install git
if ! command -v pacaur >/dev/null; then
pushd $(mktemp -d) pushd $(mktemp -d)
gpg --recv-keys --keyserver hkp://pgp.mit.edu 1EB2638FF56C0C53 curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=cower && makepkg --skippgpcheck -sri
git clone https://aur.archlinux.org/cower.git && cd cower && makepkg -sri curl -o PKGBUILD https://aur.archlinux.org/cgit/aur.git/plain/PKGBUILD?h=pacaur && makepkg --skippgpcheck -sri
git clone https://aur.archlinux.org/pacaur.git && cd pacaur && makepkg -sri
TEMP=$(pwd) TEMP=$(pwd)
popd popd
rm -rf "$TEMP" rm -rf "$TEMP"
if ! exists pacaur; then
>&2 echo "Pacaur wasn't successfully installed"
exit 3
fi
fi fi
## Fontconfig
## 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 server
$pacman -S xorg-init xorg-server
# fontconfig
if ! grep infinality /etc/pacman.conf >/dev/null; then if ! grep infinality /etc/pacman.conf >/dev/null; then
echo <<EOL >>/etc/pacman.conf echo <<EOL | sudo tee -a /etc/pacman.conf
[infinality-bundle] [infinality-bundle]
Server = http://bohoomil.com/repo/\$arch Server = http://bohoomil.com/repo/\$arch
@ -61,32 +67,23 @@ Server = http://bohoomil.com/repo/multilib/\$arch
[infinality-bundle-fonts] [infinality-bundle-fonts]
Server = http://bohoomil.com/repo/fonts Server = http://bohoomil.com/repo/fonts
EOL EOL
fi
sudo pacman-key -r 962DDE58 sudo pacman-key -r 962DDE58
sudo pacman-key -lsign-key 962DDE58 sudo pacman-key --lsign-key 962DDE58
sudo pacman -Sy sudo pacman -Sy
install ttf-droid-ib ttf-opensans otf-fira-{mono,sans}-ibx terminus-font-td1 $pacaur -S ttf-droid-ib ttf-opensans otf-fira-{mono,sans}-ibx terminus-font-td1
fi
########################################
#
# GUI+Desktop
#
########################################
# Essentials
install nvidia \
xorg-init xorg-server \
rxvt-unicode \
bspwm sxhkd compton xdotool \
dosfstools ntfs-3g \
wget curl tree rsync openssh dnsutils
# Window manager # Window manager
install bspwm sxhkd compton lightdm lightdm-webkit2-greeter xdotool $pacaur -S bspwm sxhkd compton
# Taskbar # Taskbar
install lemonbar-xft-git siji-git xtitle sutils-git $pacaur -S lemonbar-xft-git siji-git xtitle sutils-git
# Music player
$pacaur -S mpd mpc ncmpcpp
# Utilities
$pacaur -S rofi feh maim slop neofetch-git pass youtube-dl xdotool
# Apps
$pacaur -S redshift chromium termite
# Install pacman hooks # Install pacman hooks
hookdest=/etc/pacman.d/hooks hookdest=/etc/pacman.d/hooks
@ -94,82 +91,4 @@ mkdir -p "$hookdest"
for hook in $PWD/$hookdest/*.hook; do for hook in $PWD/$hookdest/*.hook; do
[[ -f $hookdest/${hook##*/} ]] || sudo ln -svf $hook $hookdest/ [[ -f $hookdest/${hook##*/} ]] || sudo ln -svf $hook $hookdest/
done done
fi
# Configure lightdm
sudo sed -i 's/^#\?\(user-session=\).*/\1bspwm/;
s/^#\?\(greeter-allow-guest=\).*/\1false/;
s/^#\?\(greeter-session=\).*/\1lightdm-webkit2-greeter/' \
/etc/lightdm/lightdm.conf
sudo sed -i 's/^#\?\(webkit-theme = \).*/\1vnought/' \
/etc/lightdm/lightdm-webkit2-greeter.conf
[ -d /usr/share/lightdm-webkit/themes/vnought ] || \
sudo git clone https://github.com/hlissner/lightdm-webkit2-vnought /usr/share/lightdm-webkit/themes/vnought
########################################
#
# System/Shell
#
########################################
# Tools
install hub # convient git wrapper
install bc # my calculator
install rsync # replaces dropbox
install pass # password manager
install maim slop # screenshots + selection
install neofetch-git # for unixporn
install rofi # dmenu replacement
install mpd mpc ncmpcpp # music server + player
install redshift # display color shift based on time of day
install feh # wallpaper setter + image previewer
install the_silver_searcher # fast file searching
install tmux # terminal multiplexer
install fasd # quick filesystem navigation
install git-crypt
install youtube-dl
# cron
install cronie
[[ -f $PWD/crontab ]] && crontab $PWD/crontab
sudo systemctl enable cronie.service
########################################
#
# Apps & Customization
#
########################################
# Applications
install rxvt-unicode
install termite
install obs-studio
install chromium firefox # browsers
# virtual machines
install virtualbox-host-dkms virtualbox
# GTK theme
[[ -d /usr/share/themes/Arc-Dark ]] || install gtk-theme-arc
########################################
#
# Security
#
########################################
# SSH: no root login + only pubkey auth
sudo sed -i 's/^#\?\(PasswordAuthentication \).*/\1no/; \
s/^#\?\(PermitRootLogin ).*/\1no/; \
s/^#\?\(X11Forwarding ).*/\1yes/; \
' \
/etc/ssh/sshd_config
# Fix permissions
sudo chmod 700 /etc/iptables
# Prompts for password!
gpg -d $PWD/.config/panel/panel.secrets.gpg > $PWD/.config/panel/panel.secrets