[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1011515: libnss-gw-name uses perl in postrm script




Package: libnss-gw-name
Version: 0.3-4
Tags: patch

Dear maintainers of libnss-gw-name,

the current postrm script of `libnss-gw-name` requires Perl.

Using `perl` in maintscripts is problematic because Perl may no longer
be installed in the future by the time the user purges the `libnss-gw-name` package.

The specific use of `perl` in this maintscript can be replaced
with an equivalent `sed` invocation, as in the following patch (also
available at
<https://salsa.debian.org/gioele/libnss-gw-name/-/commit/f2d709d3>)


diff --git a/debian/postrm b/debian/postrm
index 1d20d42..d72984a 100644
--- a/debian/postrm
+++ b/debian/postrm
@@ -16,19 +16,7 @@ remove_nss_entry() {
         log "Could not find /etc/nsswitch.conf."
         return
     fi
-    perl -i -pe '
-        my @remove=(
-            "gw_name",
-        );
-        sub remove {
-            my $s=shift;
-            foreach my $bit (@remove) {
-                $s=~s/\s+\Q$bit\E//g;
-            }
-            return $s;
-        }
-        s/^(hosts:)(.*)/$1.remove($2)/e;
-    ' /etc/nsswitch.conf
+    sed -E -i /etc/nsswitch.conf -e '/^hosts:/s/\s+gw_name//g'
 }

 action="$1"

--
Gioele Barabucci


Reply to: