rename to fortify and restructure
More sandbox features will be added and this will no longer track ego's features and behaviour. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
28
internal/system/retrieve.go
Normal file
28
internal/system/retrieve.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package system
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func Retrieve(verbose bool) {
|
||||
if V != nil {
|
||||
panic("system info retrieved twice")
|
||||
}
|
||||
|
||||
v := &Values{Share: path.Join(os.TempDir(), "fortify."+strconv.Itoa(os.Geteuid())), Verbose: verbose}
|
||||
|
||||
if r, ok := os.LookupEnv(xdgRuntimeDir); !ok {
|
||||
fmt.Println("Env variable", xdgRuntimeDir, "unset")
|
||||
|
||||
// too early for fatal
|
||||
os.Exit(1)
|
||||
} else {
|
||||
v.Runtime = r
|
||||
v.RunDir = path.Join(v.Runtime, "fortify")
|
||||
}
|
||||
|
||||
V = v
|
||||
}
|
||||
17
internal/system/value.go
Normal file
17
internal/system/value.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package system
|
||||
|
||||
const (
|
||||
xdgRuntimeDir = "XDG_RUNTIME_DIR"
|
||||
)
|
||||
|
||||
type Values struct {
|
||||
Share string
|
||||
Runtime string
|
||||
RunDir string
|
||||
Verbose bool
|
||||
}
|
||||
|
||||
var (
|
||||
V *Values
|
||||
MethodFlags [2]bool
|
||||
)
|
||||
Reference in New Issue
Block a user