From 03fa1b027e4d92df4be3b5d1cca5bae38ba19707 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 13 Mar 2014 23:40:07 -0400 Subject: 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. --- (limited to 'src.etc/init.d/mountdevsubfs') 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 -- cgit v0.9.1