mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
users: use lib.escapeShellArgs
for sysadminctl -addUser
This commit is contained in:
parent
cb2e5fa6c5
commit
26f7e45fb1
2 changed files with 5 additions and 10 deletions
|
@ -162,12 +162,7 @@ in
|
|||
else
|
||||
if [ -z "$u" ]; then
|
||||
echo "creating user ${v.name}..." >&2
|
||||
sysadminctl -addUser '${v.name}' \
|
||||
-UID ${toString v.uid} \
|
||||
-GID ${toString v.gid} \
|
||||
-fullName '${v.description}' \
|
||||
-home '${v.home}' \
|
||||
-shell ${lib.escapeShellArg (shellPath v.shell)}
|
||||
sysadminctl -addUser ${lib.escapeShellArgs [ v.name "-UID" v.uid "-GID" v.gid "-fullName" v.description "-home" v.home "-shell" (shellPath v.shell) ]}
|
||||
dscl . -create '/Users/${v.name}' IsHidden ${if v.isHidden then "1" else "0"}
|
||||
${optionalString v.createHome "createhomedir -cu '${v.name}'"}
|
||||
fi
|
||||
|
|
|
@ -43,9 +43,9 @@
|
|||
grep -qv "dscl . -delete '/Groups/unknown.group'" ${config.out}/activate
|
||||
|
||||
# checking user creation in /activate
|
||||
grep -zoP "sysadminctl -addUser 'foo' (.|\n)* -UID 42000 (.|\n)* -GID 42000 (.|\n)* -fullName 'Foo user' (.|\n)* -home '/Users/foo' (.|\n)* -shell ${lib.escapeShellArg "/run/current-system/sw/bin/bash"}" ${config.out}/activate
|
||||
grep "sysadminctl -addUser ${lib.escapeShellArgs [ "foo" "-UID" 42000 "-GID" 42000 "-fullName" "Foo user" "-home" "/Users/foo" "-shell" "/run/current-system/sw/bin/bash" ]}" ${config.out}/activate
|
||||
grep "createhomedir -cu 'foo'" ${config.out}/activate
|
||||
grep -zoP "sysadminctl -addUser 'created.user' (.|\n)* -UID 42001 (.|\n)* -shell ${lib.escapeShellArg "/sbin/nologin"}" ${config.out}/activate
|
||||
grep "sysadminctl -addUser ${lib.escapeShellArgs [ "created.user" "-UID" 42001 ]} .* ${lib.escapeShellArgs [ "-shell" "/sbin/nologin" ]}" ${config.out}/activate
|
||||
grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate
|
||||
grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "created.user"}" ${config.out}/activate
|
||||
|
||||
|
@ -54,10 +54,10 @@
|
|||
|
||||
# checking user deletion in /activate
|
||||
grep "sysadminctl -deleteUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate
|
||||
grep -qv "sysadminctl -addUser 'deleted.user'" ${config.out}/activate
|
||||
grep -qv "sysadminctl -addUser ${lib.escapeShellArg "deleted.user"}" ${config.out}/activate
|
||||
|
||||
# checking unknown user in /activate
|
||||
grep -qv "sysadminctl -addUser 'unknown.user'" ${config.out}/activate
|
||||
grep -qv "sysadminctl -addUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate
|
||||
grep -qv "sysadminctl -deleteUser ${lib.escapeShellArg "unknown.user"}" ${config.out}/activate
|
||||
|
||||
set +v
|
||||
|
|
Loading…
Reference in a new issue