From 40edd8d3c9e6f8f3bbef64a010c03be008e8abc1 Mon Sep 17 00:00:00 2001 From: Daniel Flanagan Date: Sat, 7 Nov 2020 22:23:52 -0600 Subject: [PATCH] Overhaul provisioning script system --- bin/init-dotfiles | 3 +- env/arch-linux/provision.d/00-add-user.bash | 17 +++++++ .../provision.d/10-install-yay.bash | 11 ++++ .../20-install-packages.bash} | 51 +++++++++++++++++-- .../50-install-tmux-plugins.bash} | 2 +- .../optional}/amd.bash | 0 env/arch-linux/provision.sh | 2 + env/arch-linux/provisioning/0-adduser.bash | 15 ------ env/arch-linux/provisioning/1-pacaur.bash | 36 ------------- env/arch-linux/provisioning/2-essentials.bash | 47 ----------------- env/arch-linux/provisioning/4-comms.bash | 13 ----- 11 files changed, 79 insertions(+), 118 deletions(-) create mode 100755 env/arch-linux/provision.d/00-add-user.bash create mode 100755 env/arch-linux/provision.d/10-install-yay.bash rename env/arch-linux/{provisioning/3-extras.bash => provision.d/20-install-packages.bash} (50%) rename env/arch-linux/{provisioning/tmux-plugins.bash => provision.d/50-install-tmux-plugins.bash} (92%) rename env/arch-linux/{provisioning => provision.d/optional}/amd.bash (100%) create mode 100755 env/arch-linux/provision.sh delete mode 100755 env/arch-linux/provisioning/0-adduser.bash delete mode 100755 env/arch-linux/provisioning/1-pacaur.bash delete mode 100755 env/arch-linux/provisioning/2-essentials.bash delete mode 100755 env/arch-linux/provisioning/4-comms.bash diff --git a/bin/init-dotfiles b/bin/init-dotfiles index 481d401..f402da8 100755 --- a/bin/init-dotfiles +++ b/bin/init-dotfiles @@ -70,9 +70,10 @@ distro_specific_root_setup() { if test $is_nixos -eq 1; then symlink_nixos "$root_home$dotfiles/env/nix/" add_unstable_channel - nixos-rebuild switch + nixos-rebuild switch # this should create the `daniel` user elif test $is_arch_linux -eq 1; then # TODO: install any necessary packages for remaining setup portion + "$root_home$dotfiles/env/arch-linux/provision.d/00-add-user.bash" printf '' fi } diff --git a/env/arch-linux/provision.d/00-add-user.bash b/env/arch-linux/provision.d/00-add-user.bash new file mode 100755 index 0000000..ddecd05 --- /dev/null +++ b/env/arch-linux/provision.d/00-add-user.bash @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +u=daniel +ud="/home/$u" + +# user exists - we will assume setup has already run +if getent passwd "$u"; then exit 0; fi + +groupadd admin 2>/dev/null +mkdir --parents "$ud/.home" "$ud/dl" +useradd --home-dir "$ud/.home" \ + --groups "admin,users" \ + --shell "/bin/bash" \ + "$u" +chown --recursive "$u:$u" "$ud" +echo "Setting password for user '$u'" +passwd "$u" diff --git a/env/arch-linux/provision.d/10-install-yay.bash b/env/arch-linux/provision.d/10-install-yay.bash new file mode 100755 index 0000000..1b40b67 --- /dev/null +++ b/env/arch-linux/provision.d/10-install-yay.bash @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +REPOSITORY_PATH="/tmp/provisioning" +pacman -S --needed git base-devel +mkdir -p "$REPOSITORY_PATH" +rm -rf "$REPOSITORY_PATH/yay" +git clone https://aur.archlinux.org/yay.git +cd yay +makepkg -si +yay -S yay +rm -rf "$REPOSITORY_PATH/yay" diff --git a/env/arch-linux/provisioning/3-extras.bash b/env/arch-linux/provision.d/20-install-packages.bash similarity index 50% rename from env/arch-linux/provisioning/3-extras.bash rename to env/arch-linux/provision.d/20-install-packages.bash index b7fc06f..fb355d2 100755 --- a/env/arch-linux/provisioning/3-extras.bash +++ b/env/arch-linux/provision.d/20-install-packages.bash @@ -5,10 +5,9 @@ if egrep -q '^\[multilib\]$' /etc/pacman.conf; then else echo "Enabling Multilib Repository (with sudo)..." sudo sh -c 'echo -e "\n\n[multilib]\nInclude = /etc/pacman.d/mirrorlist" >> /etc/pacman.conf' - yay -Sy fi -yay -S \ +yay -Sy \ xf86-input-libinput \ bluez bluez-libs bluez-utils bluez-tools `# Bluetooth` \ pigz `# Multi-core gzipping` \ @@ -44,6 +43,48 @@ yay -S \ libinput libinput-gestures `# Trackpad Control` \ efibootmgr efivar `# UEFI Boot CLI Stuff` \ glu mesa wxgtk2 libpng `# Various` \ - gammastep `# Redshift for Wayland` - -curl -L -o "$HOME/.emoji.txt" https://lyte.dev/uploads/emoji.txt + gammastep `# Redshift for Wayland` \ + weechat `# IRC Client` \ + aria2 `# Downloads Manager` \ + tree `# Handy Filesystem Viewing Utility` \ + dmenu `# Application Launcher` \ + ripgrep `# Code Search Utilities` \ + fd `# File Search` \ + sd `# Easy Find/Replace` \ + fzf `# Fuzzy File Finder` \ + htop `# Process Management and System Resources Monitoring` \ + openssh mosh `# Remote Access` \ + openssl `# Crypto` \ + asdf-vm `# Runtime Version Manager` \ + python python-pip `# Python 3 Language` \ + pass `# Password Management` \ + firefox-developer-edition `# Default Web Browser` \ + rsync `# File Transfer` \ + alsa-utils `# Audio Utilities` \ + alsa-plugins `# Plugins for ALSA` \ + pulseaudio pavucontrol pulsemixer `# Audio Backend and Controls` \ + neovim `# Text Editors` \ + unzip `# Simple Unzipping` \ + tmux `# Terminal Multiplexer` \ + kitty `# Almost Better Terminal Emulator` \ + feh `# Image Viewer & Wallpaper Manager` \ + wlroots-git sway-git `# Wayland Compositor` \ + swaylock-git swayidle-git `# Auto-Locking for Sway` \ + kanshi-git `# Monitor Management for Sway` \ + waybar-git mako-git `# Sway Bar & Notifications` \ + slurp grim wl-clipboard `# Sway Screen Selection & Clipping` \ + ttf-iosevka `# Primary Fonts` \ + ttf-font-awesome `# Icon Font` \ + curl `# HTTP Utility` \ + w3m `# Viewing Images in Terminals` \ + jq `# CLI for Interacting with JSON` \ + ranger `# CLI File Manager` \ + httpie `# httpie and neovim dependencies` \ + docker docker-compose `# Yummy containers` \ + inotify-tools `# Watching` \ + fish `# Shell` \ + time `# GNU time` \ + fortune-mod fortune-mod-archlinux `# Fortune` \ + diff-so-fancy `# Fancy Diffs` \ + oath-toolkit `# One-Time Passwords` \ + sysstat `# System Statistics` diff --git a/env/arch-linux/provisioning/tmux-plugins.bash b/env/arch-linux/provision.d/50-install-tmux-plugins.bash similarity index 92% rename from env/arch-linux/provisioning/tmux-plugins.bash rename to env/arch-linux/provision.d/50-install-tmux-plugins.bash index 95a3041..51c07af 100755 --- a/env/arch-linux/provisioning/tmux-plugins.bash +++ b/env/arch-linux/provision.d/50-install-tmux-plugins.bash @@ -1,6 +1,6 @@ #!/usr/bin/env bash -mkdir -p "$HOME/.config/systemd/user" +mkdir -p "$XDG_CONFIG_HOME/systemd/user" [ ! -d "$XDG_CONFIG_HOME/tmux/plugins/tpm" ] && \ git clone https://github.com/tmux-plugins/tpm "$XDG_CONFIG_HOME/tmux/plugins/tpm" diff --git a/env/arch-linux/provisioning/amd.bash b/env/arch-linux/provision.d/optional/amd.bash similarity index 100% rename from env/arch-linux/provisioning/amd.bash rename to env/arch-linux/provision.d/optional/amd.bash diff --git a/env/arch-linux/provision.sh b/env/arch-linux/provision.sh new file mode 100755 index 0000000..ac6fb46 --- /dev/null +++ b/env/arch-linux/provision.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env sh +for file in "$(dirname "$0")/provision.d"/*; do "$file"; done diff --git a/env/arch-linux/provisioning/0-adduser.bash b/env/arch-linux/provisioning/0-adduser.bash deleted file mode 100755 index f6866f9..0000000 --- a/env/arch-linux/provisioning/0-adduser.bash +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -USERNAME=daniel -GROUPS="admin,users" - -groupadd admin 2>/dev/null -mkdir --parents "/home/$USERNAME/.home" -mkdir --parents "/home/$USERNAME/dl" -useradd --home-dir "/home/$USERNAME/.home" \ - --groups "${GROUPS}" \ - --shell "/bin/bash" \ - "$USERNAME" -chown --recursive "$USERNAME:$USERNAME" "/home/$USERNAME" -echo "Setting password for user '$USERNAME'" -passwd "$USERNAME" diff --git a/env/arch-linux/provisioning/1-pacaur.bash b/env/arch-linux/provisioning/1-pacaur.bash deleted file mode 100755 index 1080282..0000000 --- a/env/arch-linux/provisioning/1-pacaur.bash +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -# TODO: this script is out of date! - -# installs pacaur on a fresh arch install - -# install the dependencies -sudo pacman -S git curl openssl perl expac yajl meson gmock gtest jq make pkginfo --noconfirm - -# setup a temporary place to install the packages from -REPOSITORY_PATH="/tmp/provisioning" -mkdir -p "$REPOSITORY_PATH" - -# clone the repositories -rm -rf "$REPOSITORY_PATH/auracle-git" -rm -rf "$REPOSITORY_PATH/pacaur" -git clone https://aur.archlinux.org/auracle-git.git "$REPOSITORY_PATH/auracle-git" -git clone https://aur.archlinux.org/pacaur.git "$REPOSITORY_PATH/pacaur" - -# build and install auracle -cd "$REPOSITORY_PATH/auracle-git" -makepkg -i --noconfirm -cd - - -# build and install pacaur -cd "$REPOSITORY_PATH/pacaur" -makepkg -i --noconfirm -cd - - -# cleanup -rm -rf "$REPOSITORY_PATH/auracle-git" -rm -rf "$REPOSITORY_PATH/pacaur" - -# once installed, let the package manager manage itself and its dependencies -pacaur -S auracle-git pacaur --noconfirm --noedit - diff --git a/env/arch-linux/provisioning/2-essentials.bash b/env/arch-linux/provisioning/2-essentials.bash deleted file mode 100755 index 0949e52..0000000 --- a/env/arch-linux/provisioning/2-essentials.bash +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/env sh - -yay -S \ - weechat `# IRC Client` \ - aria2 `# Downloads Manager` \ - tree `# Handy Filesystem Viewing Utility` \ - dmenu `# Application Launcher` \ - ripgrep `# Code Search Utilities` \ - fd `# File Search` \ - sd `# Easy Find/Replace` \ - fzf `# Fuzzy File Finder` \ - htop `# Process Management and System Resources Monitoring` \ - openssh mosh `# Remote Access` \ - openssl `# Crypto` \ - asdf-vm `# Runtime Version Manager` \ - python python-pip `# Python 3 Language` \ - pass `# Password Management` \ - firefox-developer-edition `# Default Web Browser` \ - rsync `# File Transfer` \ - alsa-utils `# Audio Utilities` \ - alsa-plugins `# Plugins for ALSA` \ - pulseaudio pavucontrol pulsemixer `# Audio Backend and Controls` \ - neovim `# Text Editors` \ - unzip `# Simple Unzipping` \ - tmux `# Terminal Multiplexer` \ - kitty `# Almost Better Terminal Emulator` \ - feh `# Image Viewer & Wallpaper Manager` \ - wlroots-git sway-git `# Wayland Compositor` \ - swaylock-git swayidle-git `# Auto-Locking for Sway` \ - kanshi-git `# Monitor Management for Sway` \ - waybar-git mako-git `# Sway Bar & Notifications` \ - slurp grim wl-clipboard `# Sway Screen Selection & Clipping` \ - ttf-iosevka `# Primary Fonts` \ - ttf-font-awesome `# Icon Font` \ - curl `# HTTP Utility` \ - w3m `# Viewing Images in Terminals` \ - jq `# CLI for Interacting with JSON` \ - ranger `# CLI File Manager` \ - httpie `# httpie and neovim dependencies` \ - docker docker-compose `# Yummy containers` \ - inotify-tools `# Watching` \ - fish `# Shell` \ - time `# GNU time` \ - fortune-mod fortune-mod-archlinux `# Fortune` \ - diff-so-fancy `# Fancy Diffs` \ - oath-toolkit `# One-Time Passwords` \ - sysstat `# System Statistics` diff --git a/env/arch-linux/provisioning/4-comms.bash b/env/arch-linux/provisioning/4-comms.bash deleted file mode 100755 index 2750941..0000000 --- a/env/arch-linux/provisioning/4-comms.bash +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -yay -S weechat-poljar-matrix-git weechat-discord-git wee-slack - -wcpm="/usr/lib/weechat/python/matrix" -hwcp="${HOME}/.weechat/python" -ln -s "${wcpm}/" "${hwcp}/" -ln -s "${wcpm}.py" "${hwcp}/" -ln -s "${wcpm}.py" "${hwcp}/autoload/" -ln -s "/usr/lib/weechat/python/wee_slack.py" "${hwcp}/" -ln -s "/usr/lib/weechat/python/wee_slack.py" "${hwcp}/autoload/" - -# Scripts are in /usr/lib/weechat/python/matrix/contrib/