From c2102a416e874aaf612dd21d87c11d89a67c0da4 Mon Sep 17 00:00:00 2001 From: Alexander Filippov Date: Mon, 10 Jun 2019 18:44:59 +0300 Subject: meta-openpower: fix logging in first-boot-set-* Makes the showing of the warnings in the first-boot-set-mac.sh and first-boot-set-hostname.sh are same If the script runs manually the warning messages are shown on STDERR. If the script runs as a systemd unit the warning messages are shown in a system journal. (From meta-openpower rev: f80fbdb15330f694e4f80992470605d46b998efd) Change-Id: I44bdc5ff3ad6bee3bcae2d2a0e574cac3353cdde Signed-off-by: Alexander Filippov Signed-off-by: Brad Bishop --- .../network/first-boot-set-mac/first-boot-set-mac.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'meta-openpower/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh') diff --git a/meta-openpower/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh b/meta-openpower/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh index 9f751a6c3..9668ed5f1 100755 --- a/meta-openpower/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh +++ b/meta-openpower/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh @@ -1,7 +1,11 @@ #!/bin/sh -eu show_error() { - logger -p user.error -t bmc-first-init $@ + if [ -n "${JOURNAL_STREAM-}" ]; then + echo "$@" | systemd-cat -t first-boot-set-mac -p emerg + else + echo "$@" >&2 + fi } sync_mac() { @@ -47,8 +51,8 @@ sync_mac() { fi } -if [ $# -eq 0 ] - then echo 'No Ethernet interface name is given' +if [ $# -eq 0 ]; then + show_error 'No Ethernet interface name is given' exit 1 fi -- cgit v1.2.3