From c493d0b1477ad6bad86afb90c00ba418ceaba405 Mon Sep 17 00:00:00 2001 From: opfez Date: Sat, 5 Jun 2021 14:26:58 +0200 Subject: [PATCH] fix removing dependency packages --- pkgtxt | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/pkgtxt b/pkgtxt index cf89680..b2c00df 100755 --- a/pkgtxt +++ b/pkgtxt @@ -56,11 +56,17 @@ update() { esac done - # installing all missing packages - pacman -S --noconfirm $(cat $to_install) 2>/dev/null + # remove all packages to remove + while IFS='' read -r LINE || [ -n "${LINE}" ]; do + if pacman -Qii "$LINE" | grep "^Required By.*None$"; then + pacman -Rs --noconfirm "$LINE" + else + pacman -D --asdeps "$LINE" + fi + done < $to_remove - # removing all packages to remove - pacman -Rs --noconfirm $(cat $to_remove) 2>/dev/null + # install all missing packages + pacman -S --noconfirm $(cat $to_install) 2>/dev/null remove_tmps