xmonad-config/scripts/runtime_pkgs

30 lines
849 B
Bash
Executable File

#!/bin/bash
# Print list of packages to be installed via pacman
filter_type () {
# echo "$1" | jq --raw-output "select(.type==\"$2\") | .name" | sort | uniq
echo "$1" | sed -n "/$2/p" | cut -f2
}
raw=$(echo -e "$(xmonad --deps)\n$(xmobar --deps)")
# these are extra packages that pertain to processes outside xmonad but are
# still required/desired to make it work correctly
xmonad_pkgs=(xorg-xinit xorg-server autorandr picom)
mapfile -t official < <(filter_type "$raw" "Official")
mapfile -t local < <(filter_type "$raw" "AUR")
if ! pacman -Si "${official[@]}" > /dev/null; then
echo "At least one official package doesn't exist."
exit 1
fi
if ! yay -Si "${local[@]}" > /dev/null; then
echo "At least one local package doesn't exist."
exit 1
fi
echo "${xmonad_pkgs[@]}" "${official[@]}" "${local[@]}" | tr ' ' '\n'