introduce basic fact collection

This commit is contained in:
2025-07-20 23:14:21 -04:00
parent 62336753c6
commit 3a47fa6706
58 changed files with 2801 additions and 107 deletions

View File

@@ -4,13 +4,31 @@ import (
"context"
"fmt"
"io"
"log"
"os"
"os/signal"
"os/user"
"git.dubyatp.xyz/orphanage/client/server"
)
func check_superuser() bool {
current, err := user.Current()
if err != nil {
log.Fatal(err)
}
if current.Uid != "0" {
return false
} else {
return true
}
}
func run(ctx context.Context, w io.Writer, args []string) error {
if !check_superuser() {
log.Fatal("orphan must run as superuser")
}
ctx, cancel := signal.NotifyContext(ctx, os.Interrupt)
defer cancel()