diff --git a/conf/type/__user/gencode-remote b/conf/type/__user/gencode-remote index 8979c56e..bbf373d4 100755 --- a/conf/type/__user/gencode-remote +++ b/conf/type/__user/gencode-remote @@ -24,6 +24,22 @@ name="$__object_id" +# We need to shorten options for both usermod and useradd since on some +# systems (such as *BSD, Darwin) those commands do not handle GNU style long +# options. +shorten_property() { + RET= + case "$1" in + comment) RET="-c";; + home) RET="-d";; + gid) RET="-g";; + groups) RET="-G";; + password) RET="-p";; + shell) RET="-s";; + uid) RET="-u";; + esac +} + cd "$__object/parameter" if grep -q "^${name}:" "$__object/explorer/passwd"; then for property in $(ls .); do @@ -67,7 +83,8 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then fi if [ "$new_value" != "$current_value" ]; then - set -- "$@" "--$property" \'$new_value\' + shorten_property $property + set -- "$@" "$RET" \'$new_value\' fi done @@ -79,7 +96,8 @@ if grep -q "^${name}:" "$__object/explorer/passwd"; then else for property in $(ls .); do new_value="$(cat "$property")" - set -- "$@" "--$property" \'$new_value\' + shorten_property $property + set -- "$@" "$RET" \'$new_value\' done echo useradd "$@" "$name"