UserCommands: add field CreateUserHome

This commit is contained in:
2025-03-11 15:30:07 -05:00
parent 95e85e8b45
commit 99c622b69f
5 changed files with 11 additions and 6 deletions

View File

@ -15,7 +15,7 @@ func (l LinuxUserManager) NewLinuxManager() *LinuxUserManager {
}
// AddUser adds a new user to the system.
func (l LinuxUserManager) AddUser(username, homeDir, shell string, isSystem bool, groups, args []string) (string, []string) {
func (l LinuxUserManager) AddUser(username, homeDir, shell string, createHome, isSystem bool, groups, args []string) (string, []string) {
baseArgs := []string{}
if isSystem {
@ -38,6 +38,11 @@ func (l LinuxUserManager) AddUser(username, homeDir, shell string, isSystem bool
baseArgs = append(baseArgs, args...)
}
if createHome {
baseArgs = append(baseArgs, "-m")
}
args = append(baseArgs, username)
cmd := "useradd"