-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.go
More file actions
41 lines (34 loc) · 801 Bytes
/
main.go
File metadata and controls
41 lines (34 loc) · 801 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"fmt"
"github.com/linux-immutability-tools/FsGuard/cmd"
"github.com/linux-immutability-tools/FsGuard/config"
"os"
"strings"
"syscall"
)
var (
Version = "0.1.0"
)
func main() {
pid := os.Getpid()
fmt.Println("PID of this process:", pid)
// This cannot be used until we find a way to execute a command while replacing the current process similiar to the exec command on linux
executable, err := os.Executable()
if err != nil {
panic(err)
}
if strings.TrimSpace(executable) == config.InitLocation {
cmd.ValidateCommand(nil, []string{config.FileListPath})
if config.RunPostInit {
execErr := syscall.Exec(config.PostInitExec, []string{}, os.Environ())
if execErr != nil {
panic(execErr)
}
return
} else {
return
}
}
cmd.Execute()
}