diff --git a/pman.sh b/pman.sh index 798ff07..284a930 100755 --- a/pman.sh +++ b/pman.sh @@ -7,6 +7,7 @@ shift command="" more_arguments=false su_needed=false +ignoredpkgs_file="/etc/pacman.d/ignorepkg" # If sudo is needed and necessary (and installed), prepend it, if not installed throw error check_sudo() { @@ -48,15 +49,15 @@ elif [ "$command_args" = "reflector" ]; then su_needed=true elif [ "$command_args" = "ignored" ]; then command="echo" - command_args="$(cat /etc/pacman.d/ignorepkg | sed 's/IgnorePkg = //' | sort)" + command_args="$(cat $ignoredpkgs_file | sed 's/IgnorePkg = //' | sort)" elif [ "$command_args" = "ignore" ]; then for pkg in "${@}"; do - if [ "$(grep -e "$pkg$" /etc/pacman.d/ignorepkg)" != "" ]; then + if [ "$(grep -e "$pkg$" $ignoredpkgs_file)" != "" ]; then echo "$pkg is already ignored, skipping..." continue fi command="tee" - command_args="-a /etc/pacman.d/ignorepkg" + command_args="-a $ignoredpkgs_file" su_needed=true echo "IgnorePkg = $pkg" | execute_command &>/dev/null done @@ -66,7 +67,7 @@ elif [ "$command_args" = "unignore" ]; then command="sed" su_needed=true check_sudo - $command -i "/IgnorePkg = $pkg/d" /etc/pacman.d/ignorepkg + $command -i "/IgnorePkg = $pkg/d" $ignoredpkgs_file done exit 0 fi