106 lines
2.5 KiB
Bash
106 lines
2.5 KiB
Bash
#! /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
|
|
|
|
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."
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
call_makepkg() {
|
|
cd "$makepkg_tmp/$1" || return 1
|
|
MAKEFLAGS="-j$(nproc)" makepkg -s -r -i -f --noconfirm
|
|
}
|
|
|
|
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)" \
|
|
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"
|
|
}
|
|
|
|
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 [ "$#" -ne 2 ]; then
|
|
echo "Must supply custom package dir. Exiting"
|
|
exit 1
|
|
fi
|
|
|
|
try_update
|
|
|
|
run_yay
|
|
|
|
mk_makepkg_dir
|
|
run_makepkg
|
|
rm_makepkg_dir
|