__ipset: do not make use of grep -P flag as it is marked as experimental

This commit is contained in:
mhameed 2021-01-09 12:54:36 +00:00
parent fcd3b245e7
commit 37e9e8c2a3
4 changed files with 6 additions and 6 deletions

View file

@ -19,7 +19,7 @@
#
name="$__object_id"
if ipset -t list | grep -qP "Name: $name"; then
if ipset -t list | grep -qFx "Name: $name"; then
ipset list "$name" | sed '0,/^Members:/d'
else
echo "x_missing_x"

View file

@ -19,8 +19,8 @@
#
name="$__object_id"
if ipset -t list | grep -qP "Name: $name"; then
ipset -t list "$name" | grep -P "^Type: " | awk '{print $2}'
if ipset -t list | grep -qFx "Name: $name"; then
ipset -t list "$name" | grep "^Type: " | awk '{print $2}'
else
echo "x_missing_x"
fi

View file

@ -22,7 +22,7 @@ mkdir -p /etc/ipset.d/
if [ -n "$1" ]; then
ipset save "$1" > "/etc/ipset.d/${1}.saved"
else
ipset -t list | grep -P "^Name:" | awk '{print $2}' | while read s; do
ipset -t list | grep "^Name:" | awk '{print $2}' | while read s; do
ipset save $s > /etc/ipset.d/$s.saved
done
fi

View file

@ -54,7 +54,7 @@ esac
if [ "$state_should" = "present" ]; then
if [ -f "$p/add" ]; then
while read -r value; do
if ! grep -q "$value" "$e/content"; then
if ! grep -qFx "$value" "$e/content"; then
echo "ipset -! add $name $value"
needToSave=1
fi
@ -63,7 +63,7 @@ if [ "$state_should" = "present" ]; then
if [ -f "$p/del" ]; then
while read -r value; do
if grep -q "$value" "$e/content"; then
if grep -qFx "$value" "$e/content"; then
echo "ipset -! del $name $value"
needToSave=1
fi