Blame 0040-Do-not-use-deprecated-egrep-fgrep.patch

Harald Hoyer b38677
From 9430ae301e3599d355e8b128a7faffa81dade6ff Mon Sep 17 00:00:00 2001
Harald Hoyer b38677
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta@iki.fi>
Harald Hoyer b38677
Date: Mon, 28 Mar 2016 11:38:34 +0300
Harald Hoyer b38677
Subject: [PATCH] Do not use deprecated egrep/fgrep
Harald Hoyer b38677
Harald Hoyer b38677
---
Harald Hoyer b38677
 dracut-init.sh                               |  8 ++++----
Harald Hoyer b38677
 install/dracut-install.c                     |  2 +-
Harald Hoyer b38677
 modules.d/00systemd/module-setup.sh          | 10 +++++-----
Harald Hoyer b38677
 modules.d/02systemd-networkd/module-setup.sh |  8 ++++----
Harald Hoyer b38677
 modules.d/95debug/module-setup.sh            |  2 +-
Harald Hoyer b38677
 modules.d/95nfs/module-setup.sh              |  8 ++++----
Harald Hoyer b38677
 modules.d/95udev-rules/module-setup.sh       |  4 ++--
Harald Hoyer b38677
 modules.d/99base/module-setup.sh             |  4 ++--
Harald Hoyer b38677
 test/TEST-04-FULL-SYSTEMD/test.sh            |  2 +-
Harald Hoyer b38677
 9 files changed, 24 insertions(+), 24 deletions(-)
Harald Hoyer b38677
Harald Hoyer b38677
diff --git a/dracut-init.sh b/dracut-init.sh
Harald Hoyer b38677
index fc35d7b..a67aca2 100644
Harald Hoyer b38677
--- a/dracut-init.sh
Harald Hoyer b38677
+++ b/dracut-init.sh
Harald Hoyer b38677
@@ -328,15 +328,15 @@ inst_rule_group_owner() {
Harald Hoyer b38677
 
Harald Hoyer b38677
     if grep -qE 'OWNER=?"[^ "]+' "$1"; then
Harald Hoyer b38677
         for i in $(grep -E 'OWNER=?"[^ "]+' "$1" | sed -r 's/.*OWNER=?"([^ "]+).*/\1/'); do
Harald Hoyer b38677
-            if ! egrep -q "^$i:" "$initdir/etc/passwd" 2>/dev/null; then
Harald Hoyer b38677
-                egrep "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer b38677
+            if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then
Harald Hoyer b38677
+                grep -E "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer b38677
             fi
Harald Hoyer b38677
         done
Harald Hoyer b38677
     fi
Harald Hoyer b38677
     if grep -qE 'GROUP=?"[^ "]+' "$1"; then
Harald Hoyer b38677
         for i in $(grep -E 'GROUP=?"[^ "]+' "$1" | sed -r 's/.*GROUP=?"([^ "]+).*/\1/'); do
Harald Hoyer b38677
-            if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then
Harald Hoyer b38677
-                egrep "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group"
Harald Hoyer b38677
+            if ! grep -Eq "^$i:" "$initdir/etc/group" 2>/dev/null; then
Harald Hoyer b38677
+                grep -E "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group"
Harald Hoyer b38677
             fi
Harald Hoyer b38677
         done
Harald Hoyer b38677
     fi
Harald Hoyer b38677
diff --git a/install/dracut-install.c b/install/dracut-install.c
Harald Hoyer b38677
index 8f65d8d..3b48ba8 100644
Harald Hoyer b38677
--- a/install/dracut-install.c
Harald Hoyer b38677
+++ b/install/dracut-install.c
Harald Hoyer b38677
@@ -287,7 +287,7 @@ static int library_install(const char *src, const char *lib)
Harald Hoyer b38677
 
Harald Hoyer b38677
         /* Also try to install the same library from one directory above.
Harald Hoyer b38677
            This fixes the case, where only the HWCAP lib would be installed
Harald Hoyer b38677
-           # ldconfig -p|fgrep libc.so
Harald Hoyer b38677
+           # ldconfig -p|grep -F libc.so
Harald Hoyer b38677
            libc.so.6 (libc6,64bit, hwcap: 0x0000001000000000, OS ABI: Linux 2.6.32) => /lib64/power6/libc.so.6
Harald Hoyer b38677
            libc.so.6 (libc6,64bit, hwcap: 0x0000000000000200, OS ABI: Linux 2.6.32) => /lib64/power6x/libc.so.6
Harald Hoyer b38677
            libc.so.6 (libc6,64bit, OS ABI: Linux 2.6.32) => /lib64/libc.so.6
Harald Hoyer b38677
diff --git a/modules.d/00systemd/module-setup.sh b/modules.d/00systemd/module-setup.sh
Harald Hoyer b38677
index ed59beb..deb5e06 100755
Harald Hoyer b38677
--- a/modules.d/00systemd/module-setup.sh
Harald Hoyer b38677
+++ b/modules.d/00systemd/module-setup.sh
Harald Hoyer b38677
@@ -179,11 +179,11 @@ install() {
Harald Hoyer b38677
 
Harald Hoyer b38677
     # install adm user/group for journald
Harald Hoyer b38677
     inst_multiple nologin
Harald Hoyer b38677
-    egrep '^systemd-journal:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer b38677
-    egrep '^adm:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer b38677
-    egrep '^systemd-journal:' /etc/group >> "$initdir/etc/group"
Harald Hoyer b38677
-    egrep '^wheel:' /etc/group >> "$initdir/etc/group"
Harald Hoyer b38677
-    egrep '^adm:' /etc/group >> "$initdir/etc/group"
Harald Hoyer b38677
+    grep '^systemd-journal:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer b38677
+    grep '^adm:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer b38677
+    grep '^systemd-journal:' /etc/group >> "$initdir/etc/group"
Harald Hoyer b38677
+    grep '^wheel:' /etc/group >> "$initdir/etc/group"
Harald Hoyer b38677
+    grep '^adm:' /etc/group >> "$initdir/etc/group"
Harald Hoyer b38677
 
Harald Hoyer b38677
     ln_r $systemdutildir/systemd "/init"
Harald Hoyer b38677
     ln_r $systemdutildir/systemd "/sbin/init"
Harald Hoyer b38677
diff --git a/modules.d/02systemd-networkd/module-setup.sh b/modules.d/02systemd-networkd/module-setup.sh
Harald Hoyer b38677
index 58842c0..b86751e 100755
Harald Hoyer b38677
--- a/modules.d/02systemd-networkd/module-setup.sh
Harald Hoyer b38677
+++ b/modules.d/02systemd-networkd/module-setup.sh
Harald Hoyer b38677
@@ -48,10 +48,10 @@ install() {
Harald Hoyer b38677
 
Harald Hoyer b38677
     # inst_dir /var/lib/systemd/clock
Harald Hoyer b38677
 
Harald Hoyer b38677
-    egrep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer b38677
-    egrep '^systemd-network:' /etc/group >> "$initdir/etc/group"
Harald Hoyer b38677
-    # egrep '^systemd-timesync:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer b38677
-    # egrep '^systemd-timesync:' /etc/group >> "$initdir/etc/group"
Harald Hoyer b38677
+    grep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer b38677
+    grep '^systemd-network:' /etc/group >> "$initdir/etc/group"
Harald Hoyer b38677
+    # grep '^systemd-timesync:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer b38677
+    # grep '^systemd-timesync:' /etc/group >> "$initdir/etc/group"
Harald Hoyer b38677
 
Harald Hoyer b38677
     _arch=$(uname -m)
Harald Hoyer b38677
     inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
Harald Hoyer b38677
diff --git a/modules.d/95debug/module-setup.sh b/modules.d/95debug/module-setup.sh
Harald Hoyer b38677
index ce5e8e8..97b2a30 100755
Harald Hoyer b38677
--- a/modules.d/95debug/module-setup.sh
Harald Hoyer b38677
+++ b/modules.d/95debug/module-setup.sh
Harald Hoyer b38677
@@ -18,6 +18,6 @@ install() {
Harald Hoyer b38677
                   tcpdump cp less hostname mkdir \
Harald Hoyer b38677
                   fsck fsck.ext2 fsck.ext4 fsck.ext3 fsck.ext4dev fsck.vfat e2fsck
Harald Hoyer b38677
 
Harald Hoyer b38677
-    egrep '^tcpdump:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer b38677
+    grep '^tcpdump:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
Harald Hoyer b38677
 }
Harald Hoyer b38677
 
Harald Hoyer b38677
diff --git a/modules.d/95nfs/module-setup.sh b/modules.d/95nfs/module-setup.sh
Harald Hoyer b38677
index 9b5b8c8..aefbc2a 100755
Harald Hoyer b38677
--- a/modules.d/95nfs/module-setup.sh
Harald Hoyer b38677
+++ b/modules.d/95nfs/module-setup.sh
Harald Hoyer b38677
@@ -105,14 +105,14 @@ install() {
Harald Hoyer b38677
 
Harald Hoyer b38677
     # Rather than copy the passwd file in, just set a user for rpcbind
Harald Hoyer b38677
     # We'll save the state and restart the daemon from the root anyway
Harald Hoyer b38677
-    egrep '^nfsnobody:|^rpc:|^rpcuser:' /etc/passwd >> "$initdir/etc/passwd"
Harald Hoyer b38677
-    egrep '^nogroup:|^rpc:|^nobody:' /etc/group >> "$initdir/etc/group"
Harald Hoyer b38677
+    grep -E '^nfsnobody:|^rpc:|^rpcuser:' /etc/passwd >> "$initdir/etc/passwd"
Harald Hoyer b38677
+    grep -E '^nogroup:|^rpc:|^nobody:' /etc/group >> "$initdir/etc/group"
Harald Hoyer b38677
 
Harald Hoyer b38677
     # rpc user needs to be able to write to this directory to save the warmstart
Harald Hoyer b38677
     # file
Harald Hoyer b38677
     chmod 770 "$initdir/var/lib/rpcbind"
Harald Hoyer b38677
-    egrep -q '^rpc:' /etc/passwd \
Harald Hoyer b38677
-        && egrep -q '^rpc:' /etc/group \
Harald Hoyer b38677
+    grep -q '^rpc:' /etc/passwd \
Harald Hoyer b38677
+        && grep -q '^rpc:' /etc/group \
Harald Hoyer b38677
         && chown rpc.rpc "$initdir/var/lib/rpcbind"
Harald Hoyer b38677
     dracut_need_initqueue
Harald Hoyer b38677
 }
Harald Hoyer b38677
diff --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh
Harald Hoyer b38677
index 6a0625a..a59eca2 100755
Harald Hoyer b38677
--- a/modules.d/95udev-rules/module-setup.sh
Harald Hoyer b38677
+++ b/modules.d/95udev-rules/module-setup.sh
Harald Hoyer b38677
@@ -63,8 +63,8 @@ install() {
Harald Hoyer b38677
 
Harald Hoyer b38677
     {
Harald Hoyer b38677
         for i in cdrom tape dialout floppy; do
Harald Hoyer b38677
-            if ! egrep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then
Harald Hoyer b38677
-                if ! egrep "^$i:" /etc/group 2>/dev/null; then
Harald Hoyer b38677
+            if ! grep -q "^$i:" "$initdir/etc/group" 2>/dev/null; then
Harald Hoyer b38677
+                if ! grep "^$i:" /etc/group 2>/dev/null; then
Harald Hoyer b38677
                         case $i in
Harald Hoyer b38677
                             cdrom)   echo "$i:x:11:";;
Harald Hoyer b38677
                             dialout) echo "$i:x:18:";;
Harald Hoyer b38677
diff --git a/modules.d/99base/module-setup.sh b/modules.d/99base/module-setup.sh
Harald Hoyer b38677
index cc94d00..5fbf6f7 100755
Harald Hoyer b38677
--- a/modules.d/99base/module-setup.sh
Harald Hoyer b38677
+++ b/modules.d/99base/module-setup.sh
Harald Hoyer b38677
@@ -27,8 +27,8 @@ install() {
Harald Hoyer b38677
     fi
Harald Hoyer b38677
 
Harald Hoyer b38677
     #add common users in /etc/passwd, it will be used by nfs/ssh currently
Harald Hoyer b38677
-    egrep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo  'root:x:0:0::/root:/bin/sh' >> "$initdir/etc/passwd"
Harald Hoyer b38677
-    egrep '^nobody:' /etc/passwd >> "$initdir/etc/passwd"
Harald Hoyer b38677
+    grep '^root:' "$initdir/etc/passwd" 2>/dev/null || echo  'root:x:0:0::/root:/bin/sh' >> "$initdir/etc/passwd"
Harald Hoyer b38677
+    grep '^nobody:' /etc/passwd >> "$initdir/etc/passwd"
Harald Hoyer b38677
 
Harald Hoyer b38677
     # install our scripts and hooks
Harald Hoyer b38677
     inst_script "$moddir/init.sh" "/init"
Harald Hoyer b38677
diff --git a/test/TEST-04-FULL-SYSTEMD/test.sh b/test/TEST-04-FULL-SYSTEMD/test.sh
Harald Hoyer b38677
index f5a9d48..c7e08bf 100755
Harald Hoyer b38677
--- a/test/TEST-04-FULL-SYSTEMD/test.sh
Harald Hoyer b38677
+++ b/test/TEST-04-FULL-SYSTEMD/test.sh
Harald Hoyer b38677
@@ -197,7 +197,7 @@ EOF
Harald Hoyer b38677
         ln -fs /proc/self/mounts $initdir/etc/mtab
Harald Hoyer b38677
 
Harald Hoyer b38677
         # install any Execs from the service files
Harald Hoyer b38677
-        egrep -ho '^Exec[^ ]*=[^ ]+' $initdir/lib/systemd/system/*.service \
Harald Hoyer b38677
+        grep -Eho '^Exec[^ ]*=[^ ]+' $initdir/lib/systemd/system/*.service \
Harald Hoyer b38677
             | while read i || [ -n "$i" ]; do
Harald Hoyer b38677
             i=${i##Exec*=}; i=${i##-}
Harald Hoyer b38677
             inst_multiple -o $i