nixpkgs/helpers/accounts.sh
Eelco Dolstra ec764b7c08 * Helper script to check for and create accounts.
svn path=/nixos/trunk/; revision=7171
2006-11-29 23:10:22 +00:00

21 lines
387 B
Bash

userExists() {
local name="$1"
if id -u "$name" > /dev/null 2>&1; then
return 0 # true
else
return 1 # false
fi
}
createUser() {
local name="$1"
local password="$2"
local uid="$3"
local gid="$4"
local gecos="$5"
local homedir="$6"
local shell="$7"
echo "$name:$password:$uid:$gid:$gecos:$homedir:$shell" >> /etc/passwd
}