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.
Change-Id: Ic7211931844f950b822d656b1217add90dbbbb3b
Signed-off-by: Alexander Filippov <a.filippov@yadro.com>
diff --git a/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh b/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh
index 9f751a6..9668ed5 100755
--- a/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh
+++ b/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 @@
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