os/arch: revise install script

This commit is contained in:
Henrik Lissner 2016-11-15 21:48:06 +01:00
parent 5ef4b4239f
commit fcc4be6eb6

View file

@ -2,19 +2,72 @@
PWD=$(dirname $0)
pacman="sudo pacman --needed --noconfirm -S"
pacaur="sudo pacaur --needed --noconfirm -s"
pacaur="sudo pacaur --needed --noconfirm -y"
## Bootstrap
$pacman git
if ! command -v pacaur >/dev/null
then
exists() { command -v "$1" >/dev/null; }
install() {
echo "==> Installing: $@"
sudo pacmaur --needed --noconfirm -S $@
}
########################################
#
# 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
fi
## Datetime
sudo timedatectl set-ntp true
sudo timedatectl set-timezone America/Toronto
# Use localtime b/c I expect to dualboot with windows (hisssss)
sudo hwclock --systohc --localtime
# Set locale
sed -i '/^#en_US\.UTF-8/s/^#//' /etc/locale.gen
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)
gpg --recv-keys --keyserver hkp://pgp.mit.edu 1EB2638FF56C0C53
git clone https://aur.archlinux.org/cower.git && cd cower && makepkg -sri
git clone https://aur.archlinux.org/pacaur.git && cd pacaur && makepkg -sri
TEMP=$(pwd)
popd
rm -rf "$TEMP"
fi
## Fontconfig
if ! grep infinality /etc/pacman.conf >/dev/null; then
echo <<EOL >>/etc/pacman.conf
[infinality-bundle]
Server = http://bohoomil.com/repo/\$arch
[infinality-bundle-multilib]
Server = http://bohoomil.com/repo/multilib/\$arch
[infinality-bundle-fonts]
Server = http://bohoomil.com/repo/fonts
EOL
fi
sudo pacman-key -r 962DDE58
sudo pacman-key -lsign-key 962DDE58
sudo pacman -Sy
install ttf-droid-ib ttf-opensans otf-fira-{mono,sans}-ibx terminus-font-td1
########################################
#
@ -22,16 +75,27 @@ fi
#
########################################
$pacman xorg-init xorg-server xorg-xandr xorg-xrdb xorg-xmodmap \
xorg-fonts-75dpi xorg-xset xorg-xfd xdotool
$pacaur xdo-git
# Essentials
install nvidia \
xorg-init xorg-server \
rxvt-unicode \
bspwm sxhkd compton xdotool \
dosfstools ntfs-3g \
wget curl tree rsync openssh dnsutils
# Fonts
$pacman ttf-dejavu ttf-inconsolata ttf-liberation ttf-ubuntu-font-family terminus-font
# Taskbar
$pacaur lemonbar lemonbar-xft-git siji-git clock sutils-git
# Window manager
$pacman lightdm lightdm-webkit2-greeter bspwm sxhkd compton
install bspwm sxhkd compton lightdm lightdm-webkit2-greeter xdotool
# Taskbar
install lemonbar-xft-git siji-git xtitle sutils-git
# Install pacman hooks
hookdest=/etc/pacman.d/hooks
mkdir -p "$hookdest"
for hook in $PWD/$hookdest/*.hook; do
[[ -f $hookdest/${hook##*/} ]] || sudo ln -svf $hook $hookdest/
done
# Configure lightdm
sudo sed -i 's/^#\?\(user-session=\).*/\1bspwm/;
s/^#\?\(greeter-allow-guest=\).*/\1false/;
s/^#\?\(greeter-session=\).*/\1lightdm-webkit2-greeter/' \
@ -42,60 +106,33 @@ sudo sed -i 's/^#\?\(webkit-theme = \).*/\1vnought/' \
sudo git clone https://github.com/hlissner/lightdm-webkit2-vnought /usr/share/lightdm-webkit/themes/vnought
########################################
#
# System/Shell
#
########################################
# Essentials
$pacman wget curl make tmux rsync tree the_silver_searcher bc xsel
# Install hooks
hookdest=/etc/pacman.d/hooks
for hook in $PWD/pacman.d/hooks/*.hook
do
[ -f $hookdest/$(basename "$hook") ] || ln -svf $hook $hookdest/
done
# Install crontab
$pacman cronie
[ -f $PWD/crontab ] && crontab $PWD/crontab
# Utilities
$pacman feh youtube-dl rofi mpd mpc ncmpcpp redshift
$pacaur git-crypt fasd
########################################
#
# Networking
#
########################################
ETH=$(basename $(echo /sys/class/net/enp*))
WLP=$(basename $(echo /sys/class/net/wlp*))
$pacman dhcpcd netctl
# Speed up connections on boot
if ! grep "^noarp$" /etc/dhcpcd.conf
then
echo "\nnoarp" | sudo tee -a /etc/dhcpcd.conf
fi
if [[ $ETH ]]; then
$pacman ifplug
sudo systemctl enable netctl-ifplugd@$ETH.service
sudo systemctl start netctl-ifplugd@$ETH.service
fi
if [[ $WLP ]]; then
$pacman wpa_supplicant wpa_actiond dialog
sudo wifi-menu
fi
# 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
########################################
@ -105,8 +142,34 @@ fi
########################################
# Applications
$pacman rxvt-unicode firefox obs-studio chromium
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 ]] || $pacaur gtk-theme-arc
[[ -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