summaryrefslogtreecommitdiff
path: root/meta-openpower/recipes-phosphor/network
diff options
context:
space:
mode:
authorAlexander Filippov <a.filippov@yadro.com>2019-06-10 18:44:59 +0300
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2019-06-19 23:25:18 +0300
commitc2102a416e874aaf612dd21d87c11d89a67c0da4 (patch)
tree19671490524a9e0eecb3217f981a00702aef9ffc /meta-openpower/recipes-phosphor/network
parentc6e6b3cfbcbcb55cabb2eceb6ba6cda2fde9d335 (diff)
downloadopenbmc-c2102a416e874aaf612dd21d87c11d89a67c0da4.tar.xz
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 <a.filippov@yadro.com> Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'meta-openpower/recipes-phosphor/network')
-rw-r--r--meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh9
-rwxr-xr-xmeta-openpower/recipes-phosphor/network/first-boot-set-mac/first-boot-set-mac.sh10
2 files changed, 13 insertions, 6 deletions
diff --git a/meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh b/meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh
index 541523760..cf67f8b47 100644
--- a/meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh
+++ b/meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh
@@ -1,7 +1,11 @@
#!/bin/sh -eu
show_error() {
- echo "$@" >&2
+ if [ -n "${JOURNAL_STREAM-}" ]; then
+ echo "$@" | systemd-cat -t first-boot-set-hostname -p emerg
+ else
+ echo "$@" >&2
+ fi
}
sync_hostname() {
@@ -26,7 +30,7 @@ sync_hostname() {
${BMC_ITEM_PATH} 2>/dev/null || true)
if [[ -z "${BMC_ITEM_SERVICE}" ]]; then
- echo "No BMC item found in the Inventory. Is VPD EEPROM empty?" >&2
+ show_error "No BMC item found in the Inventory. Is VPD EEPROM empty?"
return
fi
@@ -43,4 +47,3 @@ sync_hostname() {
[ "$(hostname)" = "{MACHINE}" ] && sync_hostname
systemctl disable first-boot-set-hostname.service
-
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