[arch-general] [PATCH] rc.sysinit: Get rid of grep

Kurt J. Bosch kjb-temp-2009 at alpenjodel.de
Mon Sep 20 17:35:14 EDT 2010


In my opinion there is no need to use grep in rc.sysinit.

 From 30b0a63ab9cbc93f79876e2ca7b2526d00ef6107 Mon Sep 17 00:00:00 2001
From: Kurt J. Bosch <kjb-temp-2009 at alpenjodel.de>
Date: Mon, 20 Sep 2010 23:31:44 +0200
Subject: [PATCH] rc.sysinit: Get rid of grep

---
  rc.sysinit |    6 +++---
  1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/rc.sysinit b/rc.sysinit
index 09d5e97..5b9864e 100755
--- a/rc.sysinit
+++ b/rc.sysinit
@@ -21,7 +21,7 @@ run_hook sysinit_start
  /bin/mountpoint -q /sys  || /bin/mount -n -t sysfs none /sys

  if ! /bin/mountpoint -q /dev; then
-  if grep -q devtmpfs /proc/filesystems 2>/dev/null; then
+  if [[ $( </proc/filesystems ) == *devtmpfs* ]]; then
      /bin/mount -n -t devtmpfs udev /dev -o mode=0755,size=10M,nosuid
    else
      /bin/mount -n -t tmpfs udev /dev -o mode=0755,size=10M,nosuid
@@ -36,7 +36,7 @@ fi

  # anything more serious than KERN_WARNING goes to the console
  # 'verbose' cmdline parameter enables more messages
-if /bin/grep -q " verbose" /proc/cmdline; then
+if [[ $( </proc/cmdline ) == *" verbose"* ]]; then
  	/bin/dmesg -n 8
  else
  	/bin/dmesg -n 3
@@ -117,7 +117,7 @@ run_hook sysinit_udevsettled
      status "Bringing up loopback interface" /sbin/ifconfig lo 127.0.0.1 up

  # If necessary, find md devices and manually assemble RAID arrays
-if [[ -f /etc/mdadm.conf ]] && /bin/grep -q ^ARRAY /etc/mdadm.conf; then
+if [[ -f /etc/mdadm.conf && $( </etc/mdadm.conf ) =~ .*^ARRAY ]]; then
  	status "Activating RAID arrays" /sbin/mdadm --assemble --scan
  fi

-- 
1.7.0.3



More information about the arch-general mailing list