samba.sh don't try to add a group if one isn't given

This commit is contained in:
David Personette 2017-01-20 16:44:05 -05:00
parent f42fb1fa2b
commit 76dacf8ce6

View File

@ -109,7 +109,7 @@ timezone() { local timezone="${1:-EST5EDT}"
# id) for user # id) for user
# Return: user added to container # Return: user added to container
user() { local name="${1}" passwd="${2}" id="${3:-""}" group="${4:-""}" user() { local name="${1}" passwd="${2}" id="${3:-""}" group="${4:-""}"
grep -q "^$group:" /etc/group || groupadd "$group" [[ "$group" ]] && { grep -q "^$group:" /etc/group || groupadd "$group"; }
useradd "$name" -M ${id:+-u $id} ${group:+-g $group} useradd "$name" -M ${id:+-u $id} ${group:+-g $group}
echo -e "$passwd\n$passwd" | smbpasswd -s -a "$name" echo -e "$passwd\n$passwd" | smbpasswd -s -a "$name"
} }