-sys-user_next_uid() {
- local euid;
- for (( euid = 101; euid <= 999; euid++ )); do
- [[ -z $(egetent passwd "${euid}") ]] && break
- done
- if (( "${euid}" == 999 )); then
- die "out of available UIDs!"
- else
- echo "${euid}"
- fi
+sys-user_create() {
+ # Create the user whose information is contained in the following
+ # variables:
+ #
+ # * SYS_USER_NAME
+ # * SYS_USER_UID
+ # * SYS_USER_SHELL
+ # * SYS_USER_HOME
+ # * SYS_USER_GROUPS
+ #
+ # We don't create a group with the same name; that should be the
+ # job of the matching sys-group package.
+ useradd --no-user-group \
+ ${SYS_USER_UID:+--uid }"${SYS_USER_UID}" \
+ ${SYS_USER_GROUPS:+--groups }"${SYS_USER_GROUPS}" \
+ --shell "${SYS_USER_SHELL}" \
+ --home-dir "${SYS_USER_HOME}" \
+ "${SYS_USER_NAME}"