[rancid] grep fixes

Chuck Anderson cra at fea.st
Sun Feb 2 20:25:36 UTC 2025


Here is a patch to eliminate these warnings that are output on newer versions of "grep":

egrep: warning: egrep is obsolescent; using grep -E
grep: warning: stray \ before /
-------------- next part --------------
diff -up rancid-3.13/bin/control_rancid.in.grep rancid-3.13/bin/control_rancid.in
--- rancid-3.13/bin/control_rancid.in.grep	2020-08-06 15:05:38.000000000 -0400
+++ rancid-3.13/bin/control_rancid.in	2025-02-02 15:22:57.361469459 -0500
@@ -615,7 +615,7 @@ do
     if [ ! -s $router.new ] ; then
 	rm -f $router.new
     else
-	notcomment=`egrep -v "^[-*\!\;#]|\/\*" $router.new | wc -l`
+	notcomment=`grep -E -v "^[-*\!\;#]|/\*" $router.new | wc -l`
 	if [ $notcomment -gt 10 ]; then
 	    lines=1;
 	else
diff -up rancid-3.13/etc/rancid.conf.sample.in.grep rancid-3.13/etc/rancid.conf.sample.in
--- rancid-3.13/etc/rancid.conf.sample.in.grep	2020-05-13 19:42:39.000000000 -0400
+++ rancid-3.13/etc/rancid.conf.sample.in	2025-02-02 15:22:56.569460771 -0500
@@ -33,7 +33,7 @@ PATH=@bindir@:@ENV_PATH@; export PATH
 # you are doing, disable this check by commenting these lines.
 uid=`perl -e 'print "$>"'`
 if [ -e /proc/1/cgroup ] ; then
-    DOCKER=`cat /proc/1/cgroup | grep "cpu.*\/docker"`
+    DOCKER=`cat /proc/1/cgroup | grep "cpu.*/docker"`
 fi
 test "x$DOCKER" = "x" && test "$uid" -eq 0 && echo "Do not run $0 as root!" && exit 1
 #


More information about the Rancid-discuss mailing list