os/+arch: update install/bootstrap scripts

This commit is contained in:
Henrik Lissner 2017-04-29 17:30:11 -04:00
parent ae3b996674
commit 06993895dd
2 changed files with 34 additions and 39 deletions

View file

@ -4,7 +4,6 @@
# connection, and the harddrives to be set up (and one of the mounted to /mnt). # connection, and the harddrives to be set up (and one of the mounted to /mnt).
MOUNT=/mnt MOUNT=/mnt
USERNAME=hlissner
exists() { command -v "$1" >/dev/null; } exists() { command -v "$1" >/dev/null; }
arch() { arch-chroot "$MOUNT" /bin/bash -c "$1"; } arch() { arch-chroot "$MOUNT" /bin/bash -c "$1"; }
@ -16,11 +15,28 @@ if ! exists arch-chroot; then
elif ! grep "$MOUNT " /proc/mounts >/dev/null; then elif ! grep "$MOUNT " /proc/mounts >/dev/null; then
>&2 echo "$MOUNT isn't mounted" >&2 echo "$MOUNT isn't mounted"
exit 2 exit 2
elif ! echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1; then elif ! ping -c1 http://google.com >/dev/null; then
>&2 echo "No internet connection detected!" >&2 echo "No internet connection detected!"
exit 3 exit 3
fi fi
#
set -e
## Collect info
# hostname
read -rp "Hostname:\t" host
#
echo "$host" > "$MOUNT/etc/hostname"
# ensure keys are up to date
pacman-key --init
pacman-key --populate arch-linux
pacman-key --refresh-keys
pacman -Syy
# bootstrap # bootstrap
pac base base-devel intel-ucode pac base base-devel intel-ucode
# device mounting drivers # device mounting drivers
@ -28,10 +44,6 @@ pac dosfstools ntfs-3g exfat-utils hfsprogs
# nc # nc
pac gnu-netcat pac gnu-netcat
# hostname
read -p "Enter computer hostname: " host
echo "$host" > "$MOUNT/etc/hostname"
# networking support # networking support
WIRELESS_DEV=$(ip link | grep wlp | awk '{print $2}'| sed 's/://' | sed '1!d') WIRELESS_DEV=$(ip link | grep wlp | awk '{print $2}'| sed 's/://' | sed '1!d')
if [[ $WIRELESS_DEV ]]; then if [[ $WIRELESS_DEV ]]; then

View file

@ -1,7 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Provisions arch linux. Should be run from a non-root user, after the bootstrap
# script (and reboot).
set -e set -e
shopt -s nullglob
PWD=$(dirname $0) PWD=$(dirname $0)
@ -17,7 +19,7 @@ exists() { command -v "$1" >/dev/null; }
# #
######################################## ########################################
if ! echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1; then if ! ping -c1 google.com >/dev/null; then
>&2 echo "No internet connection detected!" >&2 echo "No internet connection detected!"
exit 1 exit 1
elif [[ $(id -u) == 0 ]]; then elif [[ $(id -u) == 0 ]]; then
@ -26,7 +28,7 @@ elif [[ $(id -u) == 0 ]]; then
fi fi
# Essential utilities # Essential utilities
$pacman -S wget curl tree rsync openssh dnsutils $pacman -S wget git curl tree rsync openssh dnsutils
# Set up pacaur (AUR helper) # Set up pacaur (AUR helper)
if ! exists pacaur; then if ! exists pacaur; then
@ -46,37 +48,18 @@ fi
## Bootstrap ## Bootstrap
# Helpful utilities # Helpful utilities
$pacaur -S the_silver_searcher fasd tmux hub bc keybase cronie $pacaur -S the_silver_searcher tmux hub bc keybase-bin
sudo systemctl enable cronie.service
if [[ -z $SERVER ]]; then if [[ -z $SERVER ]]; then
# crontab
if exists crontab; then
[[ -f $PWD/crontab ]] && crontab $PWD/crontab
fi
# desktop essentials # desktop essentials
$pacman -S xorg-init xorg-server $pacaur -S \
# Desktop manager xorg-xinit xorg-server \
$pacaur -S lightdm lightdm-webkit2-greeter lightdm lightdm-webkit2-greeter \
# Window manager bspwm sxhkd compton \
$pacaur -S bspwm sxhkd compton xcb-proto polybar \
# Taskbar dunst libnotify \
$pacaur -S xcb-proto polybar feh sxiv maim slop-opengl neofetch-git pass youtube-dl xdotool \
# Notifications redshift firefox \
$pacaur -S dunst libnotify alsa-utils \
# Utilities dictd dict-gcide
$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 fi