(feat) filter out installed pacman packages

This commit is contained in:
b1ek 2024-02-13 21:00:17 +10:00
parent a175bde161
commit af22f05c44
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 17 additions and 2 deletions

View File

@ -99,6 +99,7 @@ while [[ $# -gt 0 ]]; do
source $(getbrick $pkg) source $(getbrick $pkg)
inf "$(inf "$pkg - $(info)")" inf "$(inf "$pkg - $(info)")"
done done
inf 'done'
exit 0 exit 0
;; ;;
-*) -*)
@ -143,16 +144,30 @@ fi
PACDEPS=() PACDEPS=()
# so now lets install! yay # lets first collect the packages
for pkg in "${PKGS[@]}"; do for pkg in "${PKGS[@]}"; do
source $(getbrick $pkg) source $(getbrick $pkg)
IFS=' ' read -ra DEPS <<< $(pkgs) IFS=' ' read -ra DEPS <<< $(pkgs)
PACDEPS=("${PACDEPS[@]}" "${DEPS[@]}") PACDEPS=("${PACDEPS[@]}" "${DEPS[@]}")
done done
# so yeah lets do it
if [ "${#PACDEPS[@]}" != "0" ]; then if [ "${#PACDEPS[@]}" != "0" ]; then
# first, gotta filter out the ones that are already installed
INSTALLED=$(pacman -Qe)
TO_INSTALL=''
for pkg in $PACDEPS; do
if [[ ! -z $(echo $INSTALLED | grep $pkg) ]]; then
TO_INSTALL="$TO_INSTALL $pkg"
fi
done
inf "installing pacman packages:"
inf "$TO_INSTALL"
# welp lets install those # welp lets install those
sudo pacman -S --needed --noconfirm $(printf "%s\n" "${PACDEPS[@]}" | sort -u) sudo pacman -S --needed --noconfirm $TO_INSTALL
inf "installed all pacman deps" inf "installed all pacman deps"
else else
inf "no pacman deps to install" inf "no pacman deps to install"