update-rc.d, systemd: redirect also stderr from type
authorMartin Jansa <martin.jansa@gmail.com>
Thu, 28 Mar 2013 14:28:41 +0000 (15:28 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 2 Apr 2013 17:16:24 +0000 (18:16 +0100)
* different shells different behavior?
  bash prints 'type: update-rc.d: not found' on stderr
  busybox's sh on stdout

(From OE-Core rev: 45e22312c48b23480bd6dff98702b0691a48f7d1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/systemd.bbclass
meta/classes/update-rc.d.bbclass

index 42fa554..69eeb9e 100644 (file)
@@ -27,7 +27,7 @@ if [ -n "$D" ]; then
     OPTS="--root=$D"
 fi
 
-if type systemctl >/dev/null; then
+if type systemctl >/dev/null 2>/dev/null; then
        systemctl $OPTS ${SYSTEMD_AUTO_ENABLE} ${SYSTEMD_SERVICE}
 
        if [ -z "$D" -a "${SYSTEMD_AUTO_ENABLE}" = "enable" ]; then
@@ -37,7 +37,7 @@ fi
 }
 
 systemd_prerm() {
-if type systemctl >/dev/null; then
+if type systemctl >/dev/null 2>/dev/null; then
        if [ -z "$D" ]; then
                systemctl stop ${SYSTEMD_SERVICE}
        fi
index 9f1e28a..0c2b94a 100644 (file)
@@ -18,7 +18,7 @@ if test "x$D" != "x"; then
 else
        OPT="-s"
 fi
-if type update-rc.d >/dev/null; then
+if type update-rc.d >/dev/null 2>/dev/null; then
        update-rc.d $OPT ${INITSCRIPT_NAME} ${INITSCRIPT_PARAMS}
 fi
 }
@@ -35,7 +35,7 @@ if test "$D" != ""; then
 else
        OPT=""
 fi
-if type update-rc.d >/dev/null; then
+if type update-rc.d >/dev/null 2>/dev/null; then
        update-rc.d $OPT ${INITSCRIPT_NAME} remove
 fi
 }