variabilized ignored packages file
This commit is contained in:
9
pman.sh
9
pman.sh
@@ -7,6 +7,7 @@ shift
|
|||||||
command=""
|
command=""
|
||||||
more_arguments=false
|
more_arguments=false
|
||||||
su_needed=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
|
# If sudo is needed and necessary (and installed), prepend it, if not installed throw error
|
||||||
check_sudo() {
|
check_sudo() {
|
||||||
@@ -48,15 +49,15 @@ elif [ "$command_args" = "reflector" ]; then
|
|||||||
su_needed=true
|
su_needed=true
|
||||||
elif [ "$command_args" = "ignored" ]; then
|
elif [ "$command_args" = "ignored" ]; then
|
||||||
command="echo"
|
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
|
elif [ "$command_args" = "ignore" ]; then
|
||||||
for pkg in "${@}"; do
|
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..."
|
echo "$pkg is already ignored, skipping..."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
command="tee"
|
command="tee"
|
||||||
command_args="-a /etc/pacman.d/ignorepkg"
|
command_args="-a $ignoredpkgs_file"
|
||||||
su_needed=true
|
su_needed=true
|
||||||
echo "IgnorePkg = $pkg" | execute_command &>/dev/null
|
echo "IgnorePkg = $pkg" | execute_command &>/dev/null
|
||||||
done
|
done
|
||||||
@@ -66,7 +67,7 @@ elif [ "$command_args" = "unignore" ]; then
|
|||||||
command="sed"
|
command="sed"
|
||||||
su_needed=true
|
su_needed=true
|
||||||
check_sudo
|
check_sudo
|
||||||
$command -i "/IgnorePkg = $pkg/d" /etc/pacman.d/ignorepkg
|
$command -i "/IgnorePkg = $pkg/d" $ignoredpkgs_file
|
||||||
done
|
done
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user