summaryrefslogtreecommitdiff
path: root/meta-ibs/meta-common/recipes-ibs/firmware-watchdog/firmware-watchdog/virtual-asset-tag
blob: 590425f9efa39a92b2d757672b2233d25fc28b93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
#
# Detect Virtualization:
#

model="CP2.*"
spi_flash_model="mx25l25635e"
interface=xyz.openbmc_project.FruDevice
asset_tag_var=PRODUCT_ASSET_TAG

# no more than 20 chars:
# ---------------------
asset_tag_val='"Virtual BMC"'

run_cmd() {
  local cmd="${*}";
  eval $cmd
}

get_model_path() {
  local path=$(/usr/bin/busctl tree ${interface} | grep "/FruDevice/${model}" | sed 's,^[ \t`-]*,,' | sed 's,[ \t]*$,,')
  echo "${path}"
}

if `dmesg | grep -q "aspeed-smc 1e620000.spi: ${spi_flash_model}"` ; then
  run_cmd /usr/bin/busctl set-property ${interface} $(get_model_path) ${interface} ${asset_tag_var} s ${asset_tag_val}
fi