From 8c15959571568b231afe1eb3358ca3da7c00b026 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Sun, 8 Nov 2026 18:55:19 +0900 Subject: cmd/hsu: move Rosa OS hsurc This file is generated by the operating system. Pointing it to /system requires ugly tricks to bind mount over it. Signed-off-by: Ophestra --- cmd/earlyinit/hsu.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 cmd/earlyinit/hsu.go (limited to 'cmd/earlyinit/hsu.go') diff --git a/cmd/earlyinit/hsu.go b/cmd/earlyinit/hsu.go new file mode 100644 index 00000000..ea25c1a9 --- /dev/null +++ b/cmd/earlyinit/hsu.go @@ -0,0 +1,32 @@ +package main + +import ( + "os" + "strconv" +) + +// updateHsu replaces the hsurc file. +func updateHsu(pairs [][2]uint32) error { + w, err := os.OpenFile( + "/misc/hsurc", + os.O_CREATE|os.O_TRUNC|os.O_WRONLY, + 0400, + ) + if err != nil { + return err + } + + buf := make([]byte, 0, os.Getpagesize()) + for _, pair := range pairs { + buf = buf[:0] + buf = strconv.AppendUint(buf, uint64(pair[0]), 10) + buf = append(buf, ' ') + buf = strconv.AppendUint(buf, uint64(pair[1]), 10) + buf = append(buf, '\n') + if _, err = w.Write(buf); err != nil { + _ = w.Close() + return err + } + } + return w.Close() +} -- cgit v1.3.1