From: Will Woods Date: Tue, 28 Aug 2012 13:43:52 +0000 (-0400) Subject: hide 'setsid --help' output in emergency_shell() X-Git-Tag: 024~85 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3bff70ef15dbda8b89ff5e998c79f6492e58b1ae;p=thirdparty%2Fdracut.git hide 'setsid --help' output in emergency_shell() When emergency_shell() happens, it does 'setsid --help' to figure out if the setsid binary supports the '-c' flag (to set the controlling tty). This output shows up in the logs (and on-screen if you're using rd.debug), which keeps confusing people looking for other problems. Using "case" instead of "strstr" lets us avoid this. --- diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index 60b4cb17a..fbe6f914a 100755 --- a/modules.d/99base/dracut-lib.sh +++ b/modules.d/99base/dracut-lib.sh @@ -890,7 +890,7 @@ _emergency_shell() _ctty=/dev/$_ctty fi [ -c "$_ctty" ] || _ctty=/dev/tty1 - strstr "$(setsid --help 2>/dev/null)" "ctty" && CTTY="-c" + case "$(/usr/bin/setsid --help 2>&1)" in *--ctty*) CTTY="--ctty";; esac setsid $CTTY /bin/sh -i -l 0<$_ctty 1>$_ctty 2>&1 fi }