variabilized ignored packages file

This commit is contained in:
bryanpedini committed 2026-05-30 09:20:13 +02:00
1 parent 5cc5556c51
commit 82b344bbce
1 file changed
+5 -4
+5 -4
View File
@@ -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