From a39a772cde3b325e4625e36fa4adf2d917d360de Mon Sep 17 00:00:00 2001 From: Bryan Joshua Pedini Date: Sun, 13 Apr 2025 21:25:52 +0200 Subject: [PATCH] added ignored, ignore, and unignore commands --- pman.sh | 61 +++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/pman.sh b/pman.sh index 369daf5..cf3c0a0 100755 --- a/pman.sh +++ b/pman.sh @@ -45,6 +45,29 @@ elif [ "$command_args" = "reflector" ]; then exit 1 fi su_needed=true +elif [ "$command_args" = "ignored" ]; then + command="echo" + command_args="$(cat /etc/pacman.d/ignorepkg | sed 's/IgnorePkg = //' | sort)" +elif [ "$command_args" = "ignore" ]; then + for pkg in "${@}"; do + if [ "$(grep -e "$pkg$" /etc/pacman.d/ignorepkg)" != "" ]; then + echo "$pkg is already ignored, skipping..." + continue + fi + command="tee" + command_args="-a /etc/pacman.d/ignorepkg" + su_needed=true + echo "IgnorePkg = $pkg" | execute_command &>/dev/null + done + exit 0 +elif [ "$command_args" = "unignore" ]; then + for pkg in "${@}"; do + command="sed" + su_needed=true + check_sudo + $command -i "/IgnorePkg = $pkg/d" /etc/pacman.d/ignorepkg + done + exit 0 fi # If command is empty, command is pacman @@ -137,25 +160,29 @@ case "$command_args" in echo echo "Usage: pman [args...]" echo "Available commands:" - echo " yay (aur) - yay | invoke yay " + echo " yay (aur) - yay | invoke yay " echo " (aur packages - all the normal operations except config are available)" - echo " aur (yay) - yay | same as \"yay\"" - echo " search - pacman -Ss | search packages" - echo " info - pacman -Si | show package information" - echo " localinfo - pacman -Qi | show local package information" - echo " provides - pacman -F | list packages that provide file" - echo " providefiles - pacman -Fl | list files provided by package" - echo " installed - pacman -Q | list installed packages" - echo " install - pacman -S | install packages" - echo " update - pacman -Sy | updates the repositories" - echo " upgradable - pacman -Qu | list available upgrades" - echo " upgrade - pacman -Syu | upgrades your system" - echo " remove - pacman -Rs | remove packages & dependencies" - echo " purge - pacman -Rns | remove packages, dependencies & conf" - echo " clean - pacman -Scc | remove all package files & trash" - echo " reflector - mirrorlist | refresh the mirrorlist with reflector (if used)" + echo " aur (yay) - yay | same as \"yay\"" + echo " search - pacman -Ss | search packages" + echo " info - pacman -Si | show package information" + echo " localinfo - pacman -Qi | show local package information" + echo " provides - pacman -F | list packages that provide file" + echo " providefiles - pacman -Fl | list files provided by package" + echo " installed - pacman -Q | list installed packages" + echo " install - pacman -S | install packages" + echo " update - pacman -Sy | updates the repositories" + echo " upgradable - pacman -Qu | list available upgrades" + echo " upgrade - pacman -Syu | upgrades your system" + echo " remove - pacman -Rs | remove packages & dependencies" + echo " purge - pacman -Rns | remove packages, dependencies & conf" + echo " clean - pacman -Scc | remove all package files & trash" + echo " reflector - mirrorlist | refresh the mirrorlist with reflector (if used)" echo " (do not use if file location differ from default /etc/pacman.d/mirrorlist)" - echo " config - /etc/pacman.conf | edits pacman configuration" + echo " ignored - /etc/pacman.d/ignorepkg | lists the packages which are ignored from update" + echo " (must create /etc/pacman.d/ignorepkg file and import it in /etc/pacman.conf)" + echo " ignore - /etc/pacman.d/ignorepkg | ignore package(s) from update" + echo " unignore - /etc/pacman.d/ignorepkg | un-ignore package(s) from update" + echo " config - /etc/pacman.conf | edits pacman configuration" exit 1 fi ;;