ENH split bootstrap scripts into make_dep, build, and runtime phases

This commit is contained in:
Nathan Dwarshuis 2022-08-01 00:28:53 -04:00
parent bddb8ce06f
commit 8616891c1f
3 changed files with 77 additions and 98 deletions

View File

@ -0,0 +1,24 @@
#! /bin/bash
# Print list of make dependencies for this dotfiles configuration
conf_dir={{ .paths.config }}
pkgs=$(cat "$conf_dir/xmonad/make_pkgs")
pkgs+="\n"
pkgs+=$(cat "$conf_dir/rofi-extras/make_pkgs")
pkgs+="\n"
pkgs+=$(cat "$conf_dir/xman/make_pkgs")
pkgs+="\n"
{{- if ne .features.conky_alias "none" }}
pkgs+=$(cat "$conf_dir/conky/make_pkgs")
pkgs+="\n"
{{- end }}
{{- if .development.emacs }}
pkgs+=$(cat "$conf_dir/emacs/make_pkgs")
pkgs+="\n"
{{- end}}
echo -e "$pkgs" | sort | uniq

View File

@ -1,98 +0,0 @@
#! /bin/bash
# Install all required packages for this user. It only needs to be run once
# when setting up the HOME directory.
# ASSUME
# - git repos referenced here are pulled/updated
# - makepkg is installed/configured
# - yay is installed/configured
# NOTE to run without a sudo prompt, call with a user that has pacman
# permissions in sudoers.
pkgsrc_dir="$1"
if [[ -z "${2+set}" ]]; then
install_root="$HOME"
else
install_root="$2"
fi
makepkg_tmp=/tmp/bootstrap-makepkg
mk_makepkg_dir() {
echo "Creating temporary makepkg build directory at $makepkg_tmp"
mkdir -p "$makepkg_tmp"
echo "Populated with packages from $pkgsrc_dir"
cp -r "$pkgsrc_dir"/* "$makepkg_tmp"
}
try_update() {
if ! yay -Syy; then
echo "Failed to update pacman cache as user $(whoami). Exiting."
return 1
fi
}
call_makepkg() {
cd "$makepkg_tmp/$1" || return 1
makepkg -s -r -i -f --noconfirm
}
run_install_scripts() {
"$install_root/.config/rofi-extras/install_deps"
"$install_root/.config/xmonad/install_deps"
}
run_yay() {
# notifications
pkgs=(dunst papirus-icon-theme)
# gtk
pkgs+=(zuki-themes)
# sleep enhancement
pkgs+=(redshift)
{{ if .features.seafile -}}
# seafile
pkgs+=(seafile-client)
{{- end }}
# elegant terminal
pkgs+=(rxvt-unicode urxvt-perls)
# shell
pkgs+=(zsh zsh-completions zsh-syntax-highlighting)
yay --needed --noconfirm --norebuild --removemake -S "${pkgs[@]}"
}
run_makepkg() {
## these are all packages that have some personal customizations and/or are
## not in the AUR
call_makepkg "xkb-hypermode"
}
rm_makepkg_dir() {
echo "Removing temporary makepkg build directory at $makepkg_tmp"
rm -r -f "$makepkg_tmp"
}
clean_up() {
rm_makepkg_dir
exit
}
trap 'clean_up' ERR
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
echo "Usage: bootstrap_pkgs CUSTOM_PKGBUILD_SRC [INSTALL_ROOT]"
exit 1
fi
try_update
run_install_scripts
run_yay
mk_makepkg_dir
run_makepkg
rm_makepkg_dir

View File

@ -0,0 +1,53 @@
#! /bin/bash
# Install all required packages for this user. It only needs to be run once
# when setting up the HOME directory.
# ASSUME
# - git repos referenced here are pulled/updated
conf_dir={{ .paths.config }}
list_rofi_pkgs() {
args=(--autorandr --bitwarden --devices --bluetooth)
{{ if .features.vpn -}}
args+=(--expressvpn)
{{- end }}
"$conf_dir/rofi-extras/scripts/runtime_pkgs" "${args[@]}"
}
# notifications
pkgs=(dunst papirus-icon-theme)
# gtk
pkgs+=(zuki-themes)
# sleep enhancement
pkgs+=(redshift)
{{- if .features.seafile }}
# seafile
pkgs+=(seafile-client)
{{- end }}
# elegant terminal
pkgs+=(rxvt-unicode urxvt-perls)
# shell
pkgs+=(zsh zsh-completions zsh-syntax-highlighting exa)
# xmonad
mapfile -t xmonad < <("$conf_dir/xmonad/scripts/runtime_pkgs")
pkgs=("${pkgs[@]}" "${xmonad[@]}")
# rofi extras
mapfile -t rofix < <(list_rofi_pkgs)
pkgs=("${pkgs[@]}" "${rofix[@]}")
# xman
pkgs+=(xcape)
{{- if .development.emacs }}
mapfile -t emacs < <("$conf_dir/xmonad/scripts/runtime_pkgs")
pkgs=("${pkgs[@]}" "${emacs[@]}")
{{- end }}