FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux General Discussion

 
 
LinkBack Thread Tools
 
Old 09-20-2010, 09:35 PM
"Kurt J. Bosch"
 
Default rc.sysinit: Get rid of grep

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@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
 

Thread Tools




All times are GMT. The time now is 07:49 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org