Package: localepurge
Followup-For: Bug #1019494
Control: tags -1 patch

Patch attached to use grep -E and grep -F in place of egrep and fgrep
>From 56b231c9c45b7cf28d47075d99e18b20e122e963 Mon Sep 17 00:00:00 2001
From: Your Name <y...@example.com>
Date: Fri, 4 Aug 2023 14:17:40 +0000
Subject: [PATCH] use grep -E and grep -F instead of egrep/fgrep

---
 debian/localepurge.config         |  2 +-
 etc/apt/apt.conf.d/99-localepurge |  2 +-
 usr/sbin/localepurge              | 16 ++++++++--------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/debian/localepurge.config b/debian/localepurge.config
index b01c4e6..78dc527 100644
--- a/debian/localepurge.config
+++ b/debian/localepurge.config
@@ -13,7 +13,7 @@ LOCALELIST=/var/cache/localepurge/localelist
 conf_has_key() {
     local key="$1"
 
-    if [ -f "$CONFIG_FILE" ] && fgrep --quiet --line-regexp \
+    if [ -f "$CONFIG_FILE" ] && grep -F --quiet --line-regexp \
              "$key" "$CONFIG_FILE"; then
         echo "true"
     else
diff --git a/etc/apt/apt.conf.d/99-localepurge 
b/etc/apt/apt.conf.d/99-localepurge
index ae10288..b5d3e2d 100644
--- a/etc/apt/apt.conf.d/99-localepurge
+++ b/etc/apt/apt.conf.d/99-localepurge
@@ -2,5 +2,5 @@
 
 DPkg
 {
-Post-Invoke {"if [ -x /usr/sbin/localepurge ] && [ $(ps w -p $PPID | egrep -c 
'(remove|purge)') != 1 ]; then /usr/sbin/localepurge; else exit 0; fi";};
+Post-Invoke {"if [ -x /usr/sbin/localepurge ] && [ $(ps w -p $PPID | grep -E 
-c '(remove|purge)') != 1 ]; then /usr/sbin/localepurge; else exit 0; fi";};
 };
diff --git a/usr/sbin/localepurge b/usr/sbin/localepurge
index 5012c61..c172021 100755
--- a/usr/sbin/localepurge
+++ b/usr/sbin/localepurge
@@ -19,7 +19,7 @@ if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
    echo "Documentation is either available via 'man localepurge'"
    echo "or by reading the docs in /usr/share/doc/localepurge."
    echo ""
-   if [ -f $NOPURGECONF ] && fgrep --quiet --line-regexp USE_DPKG $NOPURGECONF 
; then
+   if [ -f $NOPURGECONF ] && grep -F --quiet --line-regexp USE_DPKG 
$NOPURGECONF ; then
        echo "NB: localepurge has been configured to use dpkg.  Therefore,"
        echo "this script will not do anything."
    fi
@@ -34,11 +34,11 @@ if [ ! -f $NOPURGECONF ]
        echo " No $NOPURGECONF file present, exiting ..."
        exit 0
     else
-       if fgrep --quiet --line-regexp USE_DPKG $NOPURGECONF
+       if grep -F --quiet --line-regexp USE_DPKG $NOPURGECONF
             then
             # Do nothing, dpkg does all the work for us.
             exit 0
-       elif fgrep --quiet --line-regexp NEEDSCONFIGFIRST $NOPURGECONF
+       elif grep -F --quiet --line-regexp NEEDSCONFIGFIRST $NOPURGECONF
            then
                echo
                echo "    You have to configure \"localepurge\" with the 
command"
@@ -67,19 +67,19 @@ SHOWFREEDSPACE=0
 MANDELETE=0
 globaltot=0
 
-if fgrep --quiet --line-regexp DONTBOTHERNEWLOCALE $NOPURGECONF; then
+if grep -F --quiet --line-regexp DONTBOTHERNEWLOCALE $NOPURGECONF; then
     DONTBOTHERNEWLOCALE=1
 fi
 
-if fgrep --quiet --line-regexp SHOWFREEDSPACE $NOPURGECONF; then
+if grep -F --quiet --line-regexp SHOWFREEDSPACE $NOPURGECONF; then
     SHOWFREEDSPACE=1
 fi
 
-if fgrep --quiet --line-regexp MANDELETE $NOPURGECONF; then
+if grep -F --quiet --line-regexp MANDELETE $NOPURGECONF; then
     MANDELETE=1
 fi
 
-if fgrep --quiet --line-regexp VERBOSE $NOPURGECONF \
+if grep -F --quiet --line-regexp VERBOSE $NOPURGECONF \
     || [ "$1" = "-verbose" ] || [ "$1" = "-v" ] \
     || [ "$2" = "-verbose" ] || [ "$2" = "-v" ]; then
     VERBOSE=1
@@ -179,7 +179,7 @@ superfluouslocalepat=$(
 if ! ((SHOWFREEDSPACE)); then
     function get_used_space () { echo 0; }
 else
-    if fgrep --quiet --line-regexp QUICKNDIRTYCALC $NOPURGECONF; then
+    if grep -F --quiet --line-regexp QUICKNDIRTYCALC $NOPURGECONF; then
        function get_used_space ()
        {
            [ -d "$1" ] || return 1 # bail out if there's no such dir
-- 
2.39.2

Reply via email to