diff options
Diffstat (limited to 'meta-openpower/recipes-phosphor/network/first-boot-set-hostname')
2 files changed, 10 insertions, 4 deletions
diff --git a/meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.service b/meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.service index ce59b3377..45e73b50c 100644 --- a/meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.service +++ b/meta-openpower/recipes-phosphor/network/first-boot-set-hostname/first-boot-set-hostname.service @@ -2,6 +2,8 @@ Description=Init BMC Hostname Wants=mapper-wait@-xyz-openbmc_project-inventory.service After=mapper-wait@-xyz-openbmc_project-inventory.service +Wants=op-vpd-parser.service +After=op-vpd-parser.service [Service] ExecStart=/usr/bin/first-boot-set-hostname.sh 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 - |