Signed-off-by: Bryan Frimin <bryan@probo.com>
This commit is contained in:
Bryan Frimin
2026-05-26 10:12:37 -07:00
parent e6f988834d
commit e040851a4c
20 changed files with 219 additions and 1 deletions

View File

@@ -34,6 +34,7 @@ func collectOSVersion() string {
}
out, _ = runQuiet(ctx, "uname", "-sr")
return out
}
@@ -54,6 +55,7 @@ func collectSerialNumber() string {
defer cancel()
out, _ := runQuiet(ctx, "/usr/sbin/ioreg", "-d2", "-c", "IOPlatformExpertDevice")
return extractValue(out, "IOPlatformSerialNumber")
}
@@ -65,6 +67,7 @@ func extractValue(s, key string) string {
}
rest := s[idx:]
eq := strings.Index(rest, "=")
if eq < 0 {
return ""
@@ -73,8 +76,10 @@ func extractValue(s, key string) string {
rest = strings.TrimSpace(rest[eq+1:])
rest = strings.TrimPrefix(rest, "<")
rest = strings.TrimPrefix(rest, ">")
if strings.HasPrefix(rest, "\"") {
rest = rest[1:]
before, _, ok := strings.Cut(rest, "\"")
if !ok {
return ""