-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.go
41 lines (32 loc) · 952 Bytes
/
main.go
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"
"os"
"runtime"
)
func main() {
fmt.Printf("%sp%si%sn%si%st%s %s0.1%s (c) 2018-2019 Maksim Pinigin\n", COLOR_LIGHT_GREEN, COLOR_LIGHT_RED, COLOR_LIGHT_CYAN, COLOR_LIGHT_PURPLE, COLOR_YELLOW, COLOR_RESET, COLOR_WHITE, COLOR_RESET)
if os.Getpid() != 1 {
fmt.Printf("Running in %stest%s mode\n", COLOR_LIGHT_RED, COLOR_RESET)
testMode = true
}
servicesPids = make(map[string]int)
var loadConfResult bool
switch runtime.GOOS {
case "linux", "freebsd":
loadConfResult = LoadConfig("/etc/pinit/configuration.json")
case "windows":
loadConfResult = LoadConfig("C:\\pinit\\configuration.json")
default:
FatalError("Unsupported operating system. Built on " + runtime.GOOS, nil)
os.Exit(3)
}
if loadConfResult != true {
fmt.Println("pinit: Fatal error: unknown error loadConfResult = false")
os.Exit(2)
}
servicesPath = config["services_path"].(string)
InterruptHandle()
Init()
select { }
}