Make package removal match exact installed names only
pacman -Q resolves provider names, so dropping a virtual package could remove whichever package provides it. Read pacman -Qq once and match requested names exactly, ignoring providers and duplicate arguments. Ports the provider-ignoring semantics of 9791b227 from master with a single pacman query instead of one per package. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
f7152cac17
commit
a4c13bdefb
+10
-7
@@ -5,14 +5,17 @@
|
||||
# omarchy:requires-sudo=true
|
||||
|
||||
installed=()
|
||||
declare -A seen=()
|
||||
declare -A installed_exact=()
|
||||
declare -A selected=()
|
||||
|
||||
while IFS= read -r package_name; do
|
||||
installed_exact[$package_name]=1
|
||||
done < <(pacman -Qq)
|
||||
|
||||
for pkg in "$@"; do
|
||||
if package_info=$(pacman -Q "$pkg" 2>/dev/null); then
|
||||
package_name=${package_info%% *}
|
||||
if [[ -z ${seen[$package_name]} ]]; then
|
||||
installed+=("$package_name")
|
||||
seen[$package_name]=1
|
||||
fi
|
||||
if [[ -n ${installed_exact[$pkg]} && -z ${selected[$pkg]} ]]; then
|
||||
installed+=("$pkg")
|
||||
selected[$pkg]=1
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user