Add groups to users properly
This commit is contained in:
parent
aa311a5ad5
commit
e39d0dc2c2
1 changed files with 8 additions and 3 deletions
|
@ -5,10 +5,11 @@ set -l users (getUsers)
|
||||||
|
|
||||||
|
|
||||||
for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
|
for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
|
||||||
function getUserConfig -S -a config
|
function getUserConfig -V name -a config
|
||||||
getConfig "valhalla.users.$name.$config" $argv[2..]
|
getConfig "valhalla.users.$name.$config" $argv[2..]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
set -l groups (getUserConfig groups --apply 'builtins.concatStringsSep ","');
|
||||||
set -l displayName (getUserConfig displayName --json)
|
set -l displayName (getUserConfig displayName --json)
|
||||||
set -l shell (getUserConfig defaultShell --json)
|
set -l shell (getUserConfig defaultShell --json)
|
||||||
|
|
||||||
|
@ -17,8 +18,12 @@ for name in (echo "$users" | jq '.[]' --raw-output0 | string split0)
|
||||||
echo "--comment"
|
echo "--comment"
|
||||||
echo "$displayName" | jq --raw-output
|
echo "$displayName" | jq --raw-output
|
||||||
end
|
end
|
||||||
) --groups (getUserConfig groups --apply 'builtins.concatStringsSep ","') \
|
) (
|
||||||
"$name"
|
if [ -n "$groups" ]
|
||||||
|
echo "--groups"
|
||||||
|
echo "$groups"
|
||||||
|
end
|
||||||
|
) "$name"
|
||||||
|
|
||||||
if echo "$shell" | jq --exit-status > /dev/null
|
if echo "$shell" | jq --exit-status > /dev/null
|
||||||
sudo chsh "$name" --shell (which (echo "$shell" | jq --raw-output))
|
sudo chsh "$name" --shell (which (echo "$shell" | jq --raw-output))
|
||||||
|
|
Loading…
Reference in a new issue