(feat) filter out installed pacman packages
This commit is contained in:
parent
a175bde161
commit
af22f05c44
19
brick.sh
19
brick.sh
|
@ -99,6 +99,7 @@ while [[ $# -gt 0 ]]; do
|
|||
source $(getbrick $pkg)
|
||||
inf "$(inf "$pkg - $(info)")"
|
||||
done
|
||||
inf 'done'
|
||||
exit 0
|
||||
;;
|
||||
-*)
|
||||
|
@ -143,16 +144,30 @@ fi
|
|||
|
||||
PACDEPS=()
|
||||
|
||||
# so now lets install! yay
|
||||
# lets first collect the packages
|
||||
for pkg in "${PKGS[@]}"; do
|
||||
source $(getbrick $pkg)
|
||||
IFS=' ' read -ra DEPS <<< $(pkgs)
|
||||
PACDEPS=("${PACDEPS[@]}" "${DEPS[@]}")
|
||||
done
|
||||
|
||||
# so yeah lets do it
|
||||
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
|
||||
sudo pacman -S --needed --noconfirm $(printf "%s\n" "${PACDEPS[@]}" | sort -u)
|
||||
sudo pacman -S --needed --noconfirm $TO_INSTALL
|
||||
inf "installed all pacman deps"
|
||||
else
|
||||
inf "no pacman deps to install"
|
||||
|
|
Loading…
Reference in New Issue