forked from Plemya-x/ALR
wip
This commit is contained in:
15
repo.go
15
repo.go
@ -31,6 +31,7 @@ import (
|
||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/config"
|
||||
database "gitea.plemya-x.ru/Plemya-x/ALR/internal/db"
|
||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/types"
|
||||
"gitea.plemya-x.ru/Plemya-x/ALR/internal/utils"
|
||||
"gitea.plemya-x.ru/Plemya-x/ALR/pkg/repos"
|
||||
)
|
||||
|
||||
@ -54,6 +55,8 @@ func AddRepoCmd() *cli.Command {
|
||||
},
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
utils.ExitIfNotRoot()
|
||||
|
||||
ctx := c.Context
|
||||
|
||||
name := c.String("name")
|
||||
@ -87,6 +90,11 @@ func AddRepoCmd() *cli.Command {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if utils.DropCapsToAlrUser() != nil {
|
||||
slog.Error(gotext.Get("Can't drop privileges"))
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
db := database.New(cfg)
|
||||
err = db.Init(ctx)
|
||||
if err != nil {
|
||||
@ -119,6 +127,8 @@ func RemoveRepoCmd() *cli.Command {
|
||||
},
|
||||
},
|
||||
Action: func(c *cli.Context) error {
|
||||
utils.ExitIfNotRoot()
|
||||
|
||||
ctx := c.Context
|
||||
|
||||
name := c.String("name")
|
||||
@ -179,6 +189,11 @@ func RefreshCmd() *cli.Command {
|
||||
Usage: gotext.Get("Pull all repositories that have changed"),
|
||||
Aliases: []string{"ref"},
|
||||
Action: func(c *cli.Context) error {
|
||||
if utils.DropCapsToAlrUser() != nil {
|
||||
slog.Error(gotext.Get("Can't drop privileges"))
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
ctx := c.Context
|
||||
cfg := config.New()
|
||||
err := cfg.Load()
|
||||
|
Reference in New Issue
Block a user