mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-04-27 11:13:23 +02:00
Update App version to 0.1.2
Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
This commit is contained in:
20
network_mac.go
Normal file
20
network_mac.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package kvm
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
const ethernetMacAddressPath = "/userdata/ethaddr.txt"
|
||||
|
||||
func rpcSetEthernetMacAddress(macAddress string) (interface{}, error) {
|
||||
normalized, err := networkState.SetMACAddress(macAddress)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := os.WriteFile(ethernetMacAddressPath, []byte(normalized+"\n"), 0644); err != nil {
|
||||
return nil, fmt.Errorf("failed to write %s: %w", ethernetMacAddressPath, err)
|
||||
}
|
||||
return networkState.RpcGetNetworkState(), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user