-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
executable file
·53 lines (40 loc) · 855 Bytes
/
main.go
File metadata and controls
executable file
·53 lines (40 loc) · 855 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
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"PostInstall/cmd"
"PostInstall/internal/database"
"PostInstall/internal/methods/packages"
"PostInstall/utils"
"context"
"fmt"
"os"
sys "golang.org/x/sys/unix"
"github.com/urfave/cli/v3"
)
var ErrNotRoot = fmt.Errorf("User is not root")
func init() {
utils.InitLogger()
packages.InitPackageMap()
database.OpenDB()
database.MakeTable()
}
func privCheck() bool {
if id := sys.Getuid(); id != 0 {
return false
}
return true
}
func main() {
// Initialize and show the UI
//ui.ShowUI()
// Temporarily, Let's Forget the UI exists just so i can focus on the CLI
isRoot := privCheck()
if isRoot != true {
utils.Logger.Error("error encounted", "error", ErrNotRoot)
fmt.Println(ErrNotRoot)
os.Exit(1)
}
cmd := &cli.Command{
Commands: cmd.InitCmds(),
}
cmd.Run(context.Background(), os.Args)
}