summaryrefslogtreecommitdiffstats
path: root/src.etc
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2014-03-13 23:40:07 (EDT)
committer P. J. McDermott <pjm@nac.net>2014-03-13 23:40:07 (EDT)
commit03fa1b027e4d92df4be3b5d1cca5bae38ba19707 (patch)
tree64aa07a4d3379f1de439ace63abd1abdffb4333e /src.etc
parentc007674154570c98c5fd36868af2d346a4c6e0e9 (diff)
Fix grep commands in init scripts.
The exit status of a pipeline is the exit status of the last command in the pipeline. If the last command is ":", the exit status will always be 0, regardless of whether grep finds the specified pattern. So just use grep's -q command. According to the documentation for GNU grep, some older grep implementations lacked this option. But we're only running these scripts on BusyBox grep, which unconditionally includes this option.
Diffstat (limited to 'src.etc')
-rwxr-xr-xsrc.etc/init.d/mdev4
-rwxr-xr-xsrc.etc/init.d/mountdevsubfs4
-rwxr-xr-xsrc.etc/init.d/mounttmpfs8
3 files changed, 8 insertions, 8 deletions
diff --git a/src.etc/init.d/mdev b/src.etc/init.d/mdev
index 9a896f4..8052c3b 100755
--- a/src.etc/init.d/mdev
+++ b/src.etc/init.d/mdev
@@ -4,7 +4,7 @@ start()
{
printf 'Enabling device hotplugging... '
- if ! mount | grep -F ' /dev ' 2>&1 | :; then
+ if ! mount | grep -Fq ' /dev '; then
mount -t tmpfs -o noexec,nosuid,mode=0755 tmpfs /dev
fi
@@ -20,7 +20,7 @@ stop()
printf '\n' >/proc/sys/kernel/hotplug
- if mount | grep -F ' /dev ' 2>&1 | :; then
+ if mount | grep -Fq ' /dev '; then
umount /dev
fi
diff --git a/src.etc/init.d/mountdevsubfs b/src.etc/init.d/mountdevsubfs
index 7e2fa87..5f44355 100755
--- a/src.etc/init.d/mountdevsubfs
+++ b/src.etc/init.d/mountdevsubfs
@@ -5,7 +5,7 @@ start()
printf 'Mounting device file systems... '
[ -d /dev/pts ] || mkdir -m 0755 /dev/pts
- if ! mount | grep -F ' /dev/pts ' 2>&1 | :; then
+ if ! mount | grep -Fq ' /dev/pts '; then
mount -t devpts -o noexec,nosuid,gid=5,mode=0620 devpts /dev/pts
fi
@@ -18,7 +18,7 @@ stop()
{
printf 'Unmounting device file systems... '
- if mount | grep -F ' /dev/pts ' 2>&1 | :; then
+ if mount | grep -Fq ' /dev/pts '; then
umount /dev/pts
fi
diff --git a/src.etc/init.d/mounttmpfs b/src.etc/init.d/mounttmpfs
index 902ad1d..96b398e 100755
--- a/src.etc/init.d/mounttmpfs
+++ b/src.etc/init.d/mounttmpfs
@@ -4,14 +4,14 @@ start()
{
printf 'Mounting temporary file systems... '
- if ! mount | grep -F ' /run ' 2>&1 | :; then
+ if ! mount | grep -Fq ' /run '; then
mount -t tmpfs -o nodev,noexec,nosuid,mode=0755 tmpfs /run
fi
[ -d /run/lock ] || mkdir -m 1777 /run/lock
[ -d /run/shm ] || mkdir -m 1777 /run/shm
- if ! mount | grep -F ' /tmp ' 2>&1 | :; then
+ if ! mount | grep -Fq ' /tmp '; then
mount -t tmpfs -o nodev,nosuid,mode=1777 tmpfs /tmp
fi
@@ -22,11 +22,11 @@ stop()
{
printf 'Unmounting temporary file systems... '
- if mount | grep -F ' /run ' 2>&1 | :; then
+ if mount | grep -Fq ' /run '; then
umount /run
fi
- if mount | grep -F ' /tmp ' 2>&1 | :; then
+ if mount | grep -Fq ' /tmp '; then
umount /run
fi