Patchwork update-rc.d, systemd: redirect also stderr from type

login
register
mail settings
Submitter Martin Jansa
Date March 28, 2013, 2:28 p.m.
Message ID <1364480921-19234-1-git-send-email-Martin.Jansa@gmail.com>
Download mbox | patch
Permalink /patch/47083/
State Accepted
Commit c0910f26ea0d692c6d22f2e3f87cf710b31fdf0a
Headers show

Comments

Martin Jansa - March 28, 2013, 2:28 p.m.
* different shells different behavior?
  bash prints 'type: update-rc.d: not found' on stderr
  busybox's sh on stdout
---
 meta/classes/systemd.bbclass     | 4 ++--
 meta/classes/update-rc.d.bbclass | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

Patch

diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass
index 42fa554..69eeb9e 100644
--- a/meta/classes/systemd.bbclass
+++ b/meta/classes/systemd.bbclass
@@ -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
diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass
index 9f1e28a..0c2b94a 100644
--- a/meta/classes/update-rc.d.bbclass
+++ b/meta/classes/update-rc.d.bbclass
@@ -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
 }