__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" 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' ipset list "$name" | sed '0,/^Members:/d'
else else
echo "x_missing_x" echo "x_missing_x"

View file

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

View file

@ -22,7 +22,7 @@ mkdir -p /etc/ipset.d/
if [ -n "$1" ]; then if [ -n "$1" ]; then
ipset save "$1" > "/etc/ipset.d/${1}.saved" ipset save "$1" > "/etc/ipset.d/${1}.saved"
else 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 ipset save $s > /etc/ipset.d/$s.saved
done done
fi fi

View file

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