From 06993895ddb444ce2ae48a0cd27b60c5ad326d82 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 29 Apr 2017 17:30:11 -0400 Subject: [PATCH] os/+arch: update install/bootstrap scripts --- os/+arch/bootstrap | 24 +++++++++++++++++------ os/+arch/install | 49 +++++++++++++++------------------------------- 2 files changed, 34 insertions(+), 39 deletions(-) diff --git a/os/+arch/bootstrap b/os/+arch/bootstrap index 7d88d0e0..7c8a2958 100755 --- a/os/+arch/bootstrap +++ b/os/+arch/bootstrap @@ -4,7 +4,6 @@ # connection, and the harddrives to be set up (and one of the mounted to /mnt). MOUNT=/mnt -USERNAME=hlissner exists() { command -v "$1" >/dev/null; } 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 >&2 echo "$MOUNT isn't mounted" 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!" exit 3 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 pac base base-devel intel-ucode # device mounting drivers @@ -28,10 +44,6 @@ pac dosfstools ntfs-3g exfat-utils hfsprogs # nc pac gnu-netcat -# hostname -read -p "Enter computer hostname: " host -echo "$host" > "$MOUNT/etc/hostname" - # networking support WIRELESS_DEV=$(ip link | grep wlp | awk '{print $2}'| sed 's/://' | sed '1!d') if [[ $WIRELESS_DEV ]]; then diff --git a/os/+arch/install b/os/+arch/install index d3d278d4..1d1d6ae6 100755 --- a/os/+arch/install +++ b/os/+arch/install @@ -1,7 +1,9 @@ #!/usr/bin/env bash +# Provisions arch linux. Should be run from a non-root user, after the bootstrap +# script (and reboot). + set -e -shopt -s nullglob 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!" exit 1 elif [[ $(id -u) == 0 ]]; then @@ -26,7 +28,7 @@ elif [[ $(id -u) == 0 ]]; then fi # Essential utilities -$pacman -S wget curl tree rsync openssh dnsutils +$pacman -S wget git curl tree rsync openssh dnsutils # Set up pacaur (AUR helper) if ! exists pacaur; then @@ -46,37 +48,18 @@ fi ## Bootstrap # Helpful utilities -$pacaur -S the_silver_searcher fasd tmux hub bc keybase cronie -sudo systemctl enable cronie.service +$pacaur -S the_silver_searcher tmux hub bc keybase-bin 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 xcb-proto polybar - # Notifications - $pacaur -S 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 + $pacaur -S \ + xorg-xinit xorg-server \ + lightdm lightdm-webkit2-greeter \ + bspwm sxhkd compton \ + xcb-proto polybar \ + dunst libnotify \ + feh sxiv maim slop-opengl neofetch-git pass youtube-dl xdotool \ + redshift firefox \ + alsa-utils \ + dictd dict-gcide fi