sys-user_src_compile() { :; }
sys-user_src_test() { :; }
+sys-user_getuid() {
+ # Output the real UID of the given user, or the empty string if the
+ # user does not exist on the system.
+ local username="${1}"
+ echo $(id --real --user "${username}")
+}
+
sys-user_next_uid() {
local euid;
for (( euid = 101; euid <= 999; euid++ )); do
# Finally, ensure that this username doesn't already exist with
# another UID if its UID is supposedly important.
if [[ -n $(egetent passwd "${SYS_USER_NAME}") ]]; then
- local olduid=$(id --real --user "${SYS_USER_NAME}")
+ local olduid=$(sys-user_getuid "${SYS_USER_NAME}")
if [[ "${SYS_USER_UID_IMPORTANT}" == "true" ]] && \
[[ "${SYS_USER_UID}" != "${olduid}" ]]; then
# The UID is important and specified, but there is already a
# prevents us from incrementing the UID on a reinstall, and doing
# so would break most packages that need a system user to exist.
if [[ "${SYS_USER_UID_IMPORTANT}" != "true" ]]; then
- SYS_USER_UID=$(id --real --user "${SYS_USER_NAME}")
+ SYS_USER_UID=$(sys-user_getuid "${SYS_USER_NAME}")
fi
if (( "${SYS_USER_HOME}" == -1 )); then