From d68cc39ca908220bf970ee068a5db3738d008da0 Mon Sep 17 00:00:00 2001 From: Mateus Melchiades Date: Sat, 21 Oct 2023 12:56:54 -0300 Subject: [PATCH] Change adduser to useradd --- core/post_install.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/post_install.go b/core/post_install.go index 38059f5e..6308e105 100644 --- a/core/post_install.go +++ b/core/post_install.go @@ -30,14 +30,13 @@ func SetTimezone(targetRoot, tz string) error { } func AddUser(targetRoot, username, fullname string, groups []string, withPassword bool, password ...string) error { - // TODO: "adduser" isn't distro agnostic. Change to "useradd"? - adduserCmd := "adduser --quiet --disabled-password --shell /bin/bash --gecos \"%s\" %s" + adduserCmd := "useradd --shell /bin/bash %s && usermod -c \"%s\" %s" var err error if targetRoot != "" { - err = RunInChroot(targetRoot, fmt.Sprintf(adduserCmd, fullname, username)) + err = RunInChroot(targetRoot, fmt.Sprintf(adduserCmd, username, fullname, username)) } else { - err = RunCommand(fmt.Sprintf(adduserCmd, fullname, username)) + err = RunCommand(fmt.Sprintf(adduserCmd, username, fullname, username)) } if err != nil { return fmt.Errorf("Failed to create user: %s", err)