This commit is contained in:
2025-04-13 17:11:38 +03:00
parent a51a8ab963
commit 3603dc45a4
5 changed files with 73 additions and 64 deletions

View File

@ -17,13 +17,13 @@
package utils
import (
"log/slog"
"os"
"os/user"
"strconv"
"syscall"
"github.com/leonelquinteros/gotext"
"github.com/urfave/cli/v2"
)
func GetUidGidAlrUserString() (string, string, error) {
@ -69,9 +69,9 @@ func DropCapsToAlrUser() error {
return nil
}
func ExitIfNotRoot() {
func ExitIfNotRoot() error {
if os.Getuid() != 0 {
slog.Error(gotext.Get("You need to be root"))
os.Exit(1)
return cli.Exit(gotext.Get("You need to be root to perform this action"), 1)
}
return nil
}