dotfiles/dot_bin/executable_bootstrap_pkgs

106 lines
2.5 KiB
Plaintext
Raw Normal View History

#! /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"
makepkg_tmp=/tmp/bootstrap-makepkg
2021-03-13 16:57:45 -05:00
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 ! pacman -Syy; then
echo "Failed to update pacman cache as user $(whoami). Exiting."
2021-03-13 16:57:45 -05:00
return 1
fi
}
2021-03-13 16:57:45 -05:00
call_makepkg() {
cd "$makepkg_tmp/$1" || return 1
MAKEFLAGS="-j$(nproc)" makepkg -s -r -i -f --noconfirm
2021-03-13 16:57:45 -05:00
}
run_install_scripts() {
~/.config/rofi-extras/install_deps
~/.config/xmonad/install_deps
}
run_yay() {
dunst_pkgs=(dunst)
emacs_pkgs=(emacs)
gtk_pkgs=(zuki-themes)
## 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)
redshift_pkgs=(redshift)
seafile_pkgs=(seafile-client)
urxvt_pkgs=(urxvt-tabbedex rxvt-unicode urxvt-perls)
zsh_pkgs=(zsh zsh-completions zsh-syntax-highlighting)
## AUR pkgs needed for spotify
spotify_pkgs=(gconf)
MAKEFLAGS="-j$(nproc)" \
2021-03-13 22:52:13 -05:00
yay --needed --noconfirm --norebuild --removemake -S \
"${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
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() {
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
if [ "$#" -ne 2 ]; then
echo "Must supply custom package dir. Exiting"
exit 1
fi
try_update
run_yay
2021-03-13 16:57:45 -05:00
mk_makepkg_dir
run_makepkg
2021-03-13 17:05:36 -05:00
rm_makepkg_dir