FIX make install script actually install make deps

This commit is contained in:
Nathan Dwarshuis 2022-07-21 23:24:12 -04:00
parent 91cfc41238
commit a8814368ae
1 changed files with 40 additions and 18 deletions

View File

@ -1,10 +1,22 @@
#!/bin/bash #!/bin/bash
## Install all pkgs required for xmonad to run at full capacity ## Build xmonad and install packages to make it run at full capacity
# these are extra packages that pertain to processes outside xmonad but are prebuild () {
# still required/desired to make it work correctly # TODO this can be integrated into stack with nix
xmonad_pkgs=(autorandr picom) # for x11
make_pkgs=(libx11 libxrandr libxss alsa-lib)
# for x11-xft
make_pkgs+=(libxft)
# for xmobar
make_pkgs+=(libxpm)
sudo pacman --noconfirm -S "${make_pkgs[@]}"
}
build () {
stack install
}
query='.[].success | query='.[].success |
objects | objects |
@ -15,24 +27,34 @@ select(. != null) |
select(. != null) | select(. != null) |
add | select(. != null)' add | select(. != null)'
raw=$(xmonad --deps | jq "$query")
jq_type () { jq_type () {
echo "$1" | jq --raw-output "select(.type==\"$2\") | .name" | sort | uniq echo "$1" | jq --raw-output "select(.type==\"$2\") | .name" | sort | uniq
} }
mapfile -t official < <(jq_type "$raw" "Official") postbuild () {
mapfile -t local < <(jq_type "$raw" "AUR") # these are extra packages that pertain to processes outside xmonad but are
# still required/desired to make it work correctly
xmonad_pkgs=(xinit autorandr picom)
if ! pacman -Si "${official[@]}" > /dev/null; then raw=$(xmonad --deps | jq "$query")
echo "At least one official package doesn't exist."
exit 1
fi
if ! yay -Si "${local[@]}"; then mapfile -t official < <(jq_type "$raw" "Official")
echo "At least one local package doesn't exist." mapfile -t local < <(jq_type "$raw" "AUR")
exit 1
fi
sudo pacman --noconfirm -S "${xmonad_pkgs[@]}" "${official[@]}" if ! pacman -Si "${official[@]}" > /dev/null; then
yay --needed --noconfirm --norebuild --removemake -S "${local[@]}" echo "At least one official package doesn't exist."
exit 1
fi
if ! yay -Si "${local[@]}"; then
echo "At least one local package doesn't exist."
exit 1
fi
sudo pacman --noconfirm -S "${xmonad_pkgs[@]}" "${official[@]}"
yay --needed --noconfirm --norebuild --removemake -S "${local[@]}"
}
prebuild
build
postbuild