mirror of
https://github.com/arthur-pbty/arthur-os.git
synced 2026-08-01 20:28:16 +02:00
22 lines
536 B
Bash
Executable File
22 lines
536 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# omarchy:summary=Remove all the named packages from the system if they're installed (otherwise ignore).
|
|
# omarchy:args=<packages...>
|
|
# omarchy:requires-sudo=true
|
|
|
|
installed=()
|
|
declare -A seen=()
|
|
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
|
|
fi
|
|
done
|
|
|
|
if (( ${#installed[@]} > 0 )); then
|
|
sudo pacman -Rns --noconfirm "${installed[@]}"
|
|
fi
|