Merge pull request #1270 from jeburks2/wwclient_dmidecode

Asset-tag fixes in dhcpd.conf.ww and wwclient
This commit is contained in:
Christian Goll
2024-06-24 16:42:29 +02:00
committed by GitHub
4 changed files with 13 additions and 2 deletions

View File

@@ -126,6 +126,15 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
localUUID, _ = sysinfoDump.UUID()
x := smbiosDump.SystemEnclosure()
tag = strings.ReplaceAll(x.AssetTagNumber(), " ", "_")
if tag == "Unknown" {
dmiOut, err := exec.Command("dmidecode", "-s", "chassis-asset-tag").Output()
if err == nil {
chassisAssetTag := strings.TrimSpace(string(dmiOut))
if chassisAssetTag != "" {
tag = chassisAssetTag
}
}
}
} else {
// Raspberry Pi serial and DUID locations
// /sys/firmware/devicetree/base/serial-number