sahd;ljasl;dkj

This commit is contained in:
Sasha Koshka 2023-06-01 03:44:33 -04:00
parent 7726d732d4
commit 1978e263d6
1 changed files with 5 additions and 3 deletions

View File

@ -76,7 +76,7 @@ func main () {
delUserCommand := flag.NewFlagSet("deluser", flag.ExitOnError) delUserCommand := flag.NewFlagSet("deluser", flag.ExitOnError)
delUserService := delUserCommand.String ("s", "router", delUserService := delUserCommand.String ("s", "router",
"Service to delete the user for") "Service to delete the user for")
delUserRmData := delUserCommand.Bool ("rmd", false, delUserRmData := delUserCommand.Bool ("D", false,
"Whether to remove the service's data directory") "Whether to remove the service's data directory")
authCommand := flag.NewFlagSet("auth", flag.ExitOnError) authCommand := flag.NewFlagSet("auth", flag.ExitOnError)
@ -153,13 +153,15 @@ func execAdduser (service string) {
addgroup, _ := exec.LookPath("addgroup") addgroup, _ := exec.LookPath("addgroup")
tryCommand (exec.Command(addgroup, fullName, "-S"), tryCommand (exec.Command(addgroup, fullName, "-S"),
"could not add group") "could not add group")
tryCommand (exec.Command(adduser, fullName, "-SHDG", fullName), tryCommand (exec.Command (
adduser, fullName, "-SHDG", fullName, "-h", dataDir),
"could not add user") "could not add user")
} else if useradd, err := exec.LookPath("useradd"); err == nil { } else if useradd, err := exec.LookPath("useradd"); err == nil {
// GNU // GNU
tryCommand (exec.Command ( tryCommand (exec.Command (
useradd, fullName, "-rUM", useradd, fullName, "-rUM",
"--shell", "/sbin/nologin"), "could not add user") "--shell", "/sbin/nologin",
"-d", dataDir), "could not add user")
} else { } else {
cli.Sayf("could not add user: no command adduser or useradd\n") cli.Sayf("could not add user: no command adduser or useradd\n")
os.Exit(1) os.Exit(1)