2021-03-13 16:07:10 -05:00
|
|
|
#! /bin/bash
|
|
|
|
|
2021-06-12 00:08:39 -04:00
|
|
|
# Install all required packages for this user. It only needs to be run once
|
|
|
|
# when setting up the HOME directory.
|
2021-03-13 20:31:06 -05:00
|
|
|
|
2021-06-12 00:08:39 -04:00
|
|
|
# ASSUME
|
|
|
|
# - git repos referenced here are pulled/updated
|
|
|
|
# - makepkg is installed/configured
|
|
|
|
# - yay is installed/configured
|
2021-03-13 16:07:10 -05:00
|
|
|
|
2021-06-12 00:08:39 -04:00
|
|
|
# NOTE to run without a sudo prompt, call with a user that has pacman
|
|
|
|
# permissions in sudoers.
|
2021-03-13 16:07:10 -05:00
|
|
|
|
2021-06-12 00:08:39 -04:00
|
|
|
pkgsrc_dir="$1"
|
2021-06-12 00:55:48 -04:00
|
|
|
|
|
|
|
if [[ -z "${2+set}" ]]; then
|
|
|
|
install_root="$HOME"
|
|
|
|
else
|
|
|
|
install_root="$2"
|
|
|
|
fi
|
|
|
|
|
2021-06-12 00:08:39 -04:00
|
|
|
makepkg_tmp=/tmp/bootstrap-makepkg
|
2021-03-13 16:07:10 -05:00
|
|
|
|
2021-03-13 16:57:45 -05:00
|
|
|
mk_makepkg_dir() {
|
2021-03-13 18:18:01 -05:00
|
|
|
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"
|
2021-03-13 16:07:10 -05:00
|
|
|
}
|
|
|
|
|
2021-06-12 00:08:39 -04:00
|
|
|
try_update() {
|
2021-06-12 00:40:37 -04:00
|
|
|
if ! yay -Syy; then
|
2021-06-12 00:08:39 -04:00
|
|
|
echo "Failed to update pacman cache as user $(whoami). Exiting."
|
2021-03-13 16:57:45 -05:00
|
|
|
return 1
|
2021-03-13 16:07:10 -05:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-03-13 16:57:45 -05:00
|
|
|
call_makepkg() {
|
2021-03-13 18:18:01 -05:00
|
|
|
cd "$makepkg_tmp/$1" || return 1
|
2021-06-12 00:40:37 -04:00
|
|
|
makepkg -s -r -i -f --noconfirm
|
2021-03-13 16:57:45 -05:00
|
|
|
}
|
|
|
|
|
2021-06-12 00:08:39 -04:00
|
|
|
run_install_scripts() {
|
2021-06-12 00:55:48 -04:00
|
|
|
"$install_root/.config/rofi-extras/install_deps"
|
|
|
|
"$install_root/.config/xmonad/install_deps"
|
2021-06-12 00:08:39 -04:00
|
|
|
}
|
2021-03-13 20:31:06 -05:00
|
|
|
|
2021-06-12 00:08:39 -04:00
|
|
|
run_yay() {
|
2021-03-13 16:07:10 -05:00
|
|
|
dunst_pkgs=(dunst)
|
2021-06-12 00:08:39 -04:00
|
|
|
emacs_pkgs=(emacs)
|
2021-03-13 16:07:10 -05:00
|
|
|
gtk_pkgs=(zuki-themes)
|
2021-06-12 00:08:39 -04:00
|
|
|
## TODO this requires some system-level config and thus should be an
|
|
|
|
## ansible role
|
|
|
|
# nvidia_pkgs=(optimus-manager)
|
|
|
|
## TODO docker rootless should be an ansible role since it needs some
|
|
|
|
## systemwide configuration
|
|
|
|
# r_pkgs=(r docker-rootless-extras-bin gcc-fortran texlive-bin tk)
|
|
|
|
r_pkgs=(r gcc-fortran texlive-bin tk)
|
2021-03-13 16:07:10 -05:00
|
|
|
redshift_pkgs=(redshift)
|
2021-06-12 00:08:39 -04:00
|
|
|
seafile_pkgs=(seafile-client)
|
2021-06-17 01:17:06 -04:00
|
|
|
urxvt_pkgs=(rxvt-unicode urxvt-perls)
|
2021-03-13 16:07:10 -05:00
|
|
|
zsh_pkgs=(zsh zsh-completions zsh-syntax-highlighting)
|
|
|
|
|
|
|
|
## AUR pkgs needed for spotify
|
|
|
|
spotify_pkgs=(gconf)
|
|
|
|
|
2021-06-12 00:55:48 -04:00
|
|
|
yay --needed --noconfirm --norebuild --removemake -S \
|
2021-03-13 16:07:10 -05:00
|
|
|
"${dunst_pkgs[@]}" \
|
|
|
|
"${emacs_pkgs[@]}" \
|
|
|
|
"${gtk_pkgs[@]}" \
|
|
|
|
"${r_pkgs[@]}" \
|
|
|
|
"${redshift_pkgs[@]}" \
|
|
|
|
"${seafile_pkgs[@]}" \
|
|
|
|
"${urxvt_pkgs[@]}" \
|
|
|
|
"${zsh_pkgs[@]}" \
|
|
|
|
"${spotify_pkgs[@]}"
|
|
|
|
}
|
|
|
|
|
|
|
|
run_makepkg() {
|
|
|
|
## these are all packages that have some personal customizations and/or are
|
|
|
|
## not in the AUR
|
2021-06-17 01:17:06 -04:00
|
|
|
## TODO the clevo thingy requires a systemd file to turn on/off
|
2021-03-13 16:07:10 -05:00
|
|
|
call_makepkg "clevo-xsm-wmi-dkms"
|
|
|
|
call_makepkg "conky-lua"
|
|
|
|
call_makepkg "spotify"
|
|
|
|
call_makepkg "xkb-hypermode"
|
|
|
|
}
|
|
|
|
|
2021-03-13 16:57:45 -05:00
|
|
|
rm_makepkg_dir() {
|
2021-03-13 18:18:01 -05:00
|
|
|
echo "Removing temporary makepkg build directory at $makepkg_tmp"
|
|
|
|
rm -r -f "$makepkg_tmp"
|
2021-03-13 16:57:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
clean_up() {
|
|
|
|
rm_makepkg_dir
|
|
|
|
exit
|
|
|
|
}
|
|
|
|
|
2021-03-13 17:05:36 -05:00
|
|
|
trap 'clean_up' ERR
|
2021-03-13 16:57:45 -05:00
|
|
|
|
2021-06-12 01:01:40 -04:00
|
|
|
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
|
2021-06-12 00:55:48 -04:00
|
|
|
echo "Usage: bootstrap_pkgs CUSTOM_PKGBUILD_SRC [INSTALL_ROOT]"
|
2021-03-13 16:07:10 -05:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-06-12 00:08:39 -04:00
|
|
|
try_update
|
2021-03-13 17:34:59 -05:00
|
|
|
|
2021-06-12 00:55:48 -04:00
|
|
|
run_install_scripts
|
|
|
|
|
2021-03-13 17:37:23 -05:00
|
|
|
run_yay
|
2021-03-13 16:07:10 -05:00
|
|
|
|
2021-03-13 16:57:45 -05:00
|
|
|
mk_makepkg_dir
|
2021-03-13 16:07:10 -05:00
|
|
|
run_makepkg
|
2021-03-13 17:05:36 -05:00
|
|
|
rm_makepkg_dir
|