talos/internal/pkg/smbios/smbios.go
Philipp Sauter 2deff6b6e1
feat: add support for variable substitution in talos.config kernel parameter
The URL to fetch the configuration for a talos node is given by the
talos.config kernel parameter. We add support for 4 variables ${uuid},
${serial}, ${mac} and ${hostname} which substitute the device UUID,
DMI-sourced serial number, MAC address of the first network interface to
be up and the hostname respectively.

Fixes #3272

Signed-off-by: Philipp Sauter <philipp.sauter@siderolabs.com>
2022-06-24 12:38:08 +02:00

27 lines
550 B
Go

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
package smbios
import (
"sync"
"github.com/talos-systems/go-smbios/smbios"
)
var (
syncSMBIOS sync.Once
connSMBIOS *smbios.SMBIOS
errSMBIOS error
)
// GetSMBIOSInfo returns the SMBIOS info.
func GetSMBIOSInfo() (*smbios.SMBIOS, error) {
syncSMBIOS.Do(func() {
connSMBIOS, errSMBIOS = smbios.New()
})
return connSMBIOS, errSMBIOS
}