Skip to content

Commit

Permalink
Replaced egrep with grep -E. bsc#1203227
Browse files Browse the repository at this point in the history
  • Loading branch information
mchf committed Sep 9, 2022
1 parent 83d5f9d commit 91786a8
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/modules/Scanner.rb
Expand Up @@ -738,7 +738,7 @@ def DependantPrintQueueExists(backend_name)
# is required by a print queue for LPRng or for a third-party printing system.
if "hpaio" == backend_name
return ExecuteBashCommand(
"/usr/bin/lpstat -v | /bin/egrep -q ': hp:/|: hpfax:/'"
"/usr/bin/lpstat -v | /bin/grep -E -q ': hp:/|: hpfax:/'"
)
end
if "hpoj" == backend_name
Expand Down Expand Up @@ -2547,18 +2547,18 @@ def SetupNetworkScanningConfig
end

# Determine if any kind of firewall seems to be active by calling
# "iptables -n -L | egrep -q 'DROP|REJECT'"
# "iptables -n -L | grep -E -q 'DROP|REJECT'"
# to find out if there are currently dropping or rejecting packet filter rules.
# One might use a more specific test via
# "iptables -n -L | grep -v '^LOG' | egrep -q '^DROP|^REJECT'"
# "iptables -n -L | grep -v '^LOG' | grep -E -q '^DROP|^REJECT'"
# to match only for DROP and REJECT targets and exclude LOG targets
# but it does not cause real problems when there is a false positive result here
# because all what happens it that then a needless firewall info popup would be shown.
# If any kind of firewall seems to be active, show a popup message
# regarding scanning via network and firewall.
# @return true if any kind of firewall seems to be active
def ShowFirewallPopup
if ExecuteBashCommand("iptables -n -L | egrep -q 'DROP|REJECT'")
if ExecuteBashCommand("iptables -n -L | grep -E -q 'DROP|REJECT'")
Builtins.y2milestone("A firewall seems to be active.")
Popup.MessageDetails(
_("Check that your firewall allows scanning via network."),
Expand Down
2 changes: 1 addition & 1 deletion tools/autodetect_scanners
Expand Up @@ -54,7 +54,7 @@ else echo "Cannot execute /usr/bin/sane-find-scanner" 1>&2
exit 2
fi
# Only USB and SCSI scanners are taken into account:
egrep '^found SCSI |^found USB ' <$TMP_DATA_RAW | sort -u | sed -e 's/^found //' | tr \" \' >$TMP_DATA
grep -E '^found SCSI |^found USB ' <$TMP_DATA_RAW | sort -u | sed -e 's/^found //' | tr \" \' >$TMP_DATA

# Append the raw data for HP all-in-one devices via "hp-probe".
# The scanner unit in HP all-in-one USB devices works even without a CUPS queue
Expand Down
4 changes: 2 additions & 2 deletions tools/create_scanner_database
Expand Up @@ -41,7 +41,7 @@ cat /dev/null >$TMP_DATA
# Function to extract entries from a description file with SANE syntax.
# Quoted quotation marks '\"' (happens in comments) are replaced by ' ':
Extract()
{ cat $1 | sed -e 's/\\"/ /g' | egrep -o '^[[:space:]]*:backend[[:space:]]*"[^"]*"|^[[:space:]]*:version[[:space:]]*"[^"]*"|^[[:space:]]*:mfg[[:space:]]*"[^"]*"|^[[:space:]]*:model[[:space:]]*"[^"]*"|^[[:space:]]*:firmware[[:space:]]*"[^"]*"|^[[:space:]]*:interface[[:space:]]*"[^"]*"|^[[:space:]]*:usbid[[:space:]]*"0x[0-9A-Fa-f]*"[[:space:]]*"0x[0-9A-Fa-f]*"|^[[:space:]]*:status[[:space:]]*:[a-z]*|^[[:space:]]*:comment[[:space:]]*"[^"]*"'
{ cat $1 | sed -e 's/\\"/ /g' | grep -E -o '^[[:space:]]*:backend[[:space:]]*"[^"]*"|^[[:space:]]*:version[[:space:]]*"[^"]*"|^[[:space:]]*:mfg[[:space:]]*"[^"]*"|^[[:space:]]*:model[[:space:]]*"[^"]*"|^[[:space:]]*:firmware[[:space:]]*"[^"]*"|^[[:space:]]*:interface[[:space:]]*"[^"]*"|^[[:space:]]*:usbid[[:space:]]*"0x[0-9A-Fa-f]*"[[:space:]]*"0x[0-9A-Fa-f]*"|^[[:space:]]*:status[[:space:]]*:[a-z]*|^[[:space:]]*:comment[[:space:]]*"[^"]*"'
}

# Process the SANE description files:
Expand Down Expand Up @@ -125,7 +125,7 @@ Output()
[ -z "$USBID" ] && USBID='""'
[ -z "$COMMENT" ] && COMMENT='""'
if [ "$PACKAGE" = '"iscan"' -o "$PACKAGE" = '"iscan-free"' ]
then if echo "$COMMENT" | egrep -q 'requires a DFSG non-free module|requires DFSG non-free'
then if echo "$COMMENT" | grep -E -q 'requires a DFSG non-free module|requires DFSG non-free'
then PACKAGE='"iscan"'
else PACKAGE='"iscan-free"'
fi
Expand Down
2 changes: 1 addition & 1 deletion tools/determine_network_scanner_config
Expand Up @@ -37,7 +37,7 @@ SANED_CONFIG_FILE="/etc/sane.d/saned.conf"

# Function to extract entries from a SANE config file:
Extract()
{ egrep -v '^#|^[[:space:]]*$' $1 | tr -d '[:blank:]' | sort -u | tr -s '\n' ','
{ grep -E -v '^#|^[[:space:]]*$' $1 | tr -d '[:blank:]' | sort -u | tr -s '\n' ','
}

# Get and output the hosts in $NET_BACKEND_CONFIG_FILE
Expand Down

0 comments on commit 91786a8

Please sign in to comment.