summary refs log tree commit diff stats
path: root/cmd/grus/main_openbsd.go
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-04-06 22:11:15 +0530
committerAndinus <andinus@nand.sh>2020-04-06 22:11:15 +0530
commitda2255557fa395eeabeff9a4f2949582f8811980 (patch)
treec48de12ff76b54f67303585190773e6551609f1d /cmd/grus/main_openbsd.go
parent69e919cd4e887a606dc1c007c2ce1f36b35477d1 (diff)
downloadgrus-da2255557fa395eeabeff9a4f2949582f8811980.tar.gz
Initial grus version
Diffstat (limited to 'cmd/grus/main_openbsd.go')
-rw-r--r--cmd/grus/main_openbsd.go40
1 files changed, 40 insertions, 0 deletions
diff --git a/cmd/grus/main_openbsd.go b/cmd/grus/main_openbsd.go
new file mode 100644
index 0000000..5222bbe
--- /dev/null
+++ b/cmd/grus/main_openbsd.go
@@ -0,0 +1,40 @@
+// +build openbsd
+
+package main
+
+import (
+	"log"
+	"os"
+
+	"golang.org/x/sys/unix"
+	"tildegit.org/andinus/grus/storage"
+	"tildegit.org/andinus/lynx"
+)
+
+func main() {
+	unveil()
+	grus()
+}
+
+func unveil() {
+	path := storage.GetDir()
+	err := os.MkdirAll(path, os.ModePerm)
+	if err != nil {
+		log.Fatalf("Unable to create directory: %s", path)
+	}
+
+	paths := make(map[string]string)
+
+	paths[path] = "rwc"
+
+	err = lynx.UnveilPathsStrict(paths)
+	if err != nil {
+		log.Fatal(err)
+	}
+
+	// Block further unveil calls.
+	err = unix.UnveilBlock()
+	if err != nil {
+		log.Fatal(err)
+	}
+}