diff options
author | Ed Tanous <ed.tanous@intel.com> | 2019-07-31 20:59:18 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-07-31 20:59:18 +0300 |
commit | b4f66bacb1b8e661d794fa7a189e2f66f5092e2e (patch) | |
tree | 5a8302cd349fdb68dadca003483c61917d4a6add /meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh | |
parent | 43a183cc0926da36e3a218efa02ab4838ace316f (diff) | |
parent | dd755025e33af27b059ea7ef3afbe850e4880b08 (diff) | |
download | openbmc-b4f66bacb1b8e661d794fa7a189e2f66f5092e2e.tar.xz |
Merge branch 'master' of ssh://git-amr-1.devtools.intel.com:29418/openbmc-openbmc into intel
Diffstat (limited to 'meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh')
-rw-r--r-- | meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.sh | 12 |
1 files changed, 8 insertions, 4 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..42a85b873 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() { @@ -9,6 +13,7 @@ sync_hostname() { MAPPER_PATH='/xyz/openbmc_project/object_mapper' INVENTORY_PATH='/xyz/openbmc_project/inventory' BMC_ITEM_IFACE='xyz.openbmc_project.Inventory.Item.Bmc' + INV_ASSET_IFACE='xyz.openbmc_project.Inventory.Decorator.Asset' BMC_ITEM_PATH=$(busctl --no-pager --verbose call \ ${MAPPER_IFACE} \ @@ -26,13 +31,13 @@ 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 BMC_SN=$(busctl get-property ${BMC_ITEM_SERVICE} \ ${BMC_ITEM_PATH} \ - ${BMC_ITEM_IFACE} SerialNumber) + ${INV_ASSET_IFACE} SerialNumber) # 's "002B0DH1000"' BMC_SN=${BMC_SN#*\"} BMC_SN=${BMC_SN%\"*} @@ -43,4 +48,3 @@ sync_hostname() { [ "$(hostname)" = "{MACHINE}" ] && sync_hostname systemctl disable first-boot-set-hostname.service - |