]> gitweb.michael.orlitzky.com - mjo-overlay.git/blobdiff - eclass/sys-user.eclass
sys-user.eclass: fix usermod flag name.
[mjo-overlay.git] / eclass / sys-user.eclass
index 6fb8f7ab17c96e289d5762ab109c0b5eb0c0c287..16d77c0ce7c746bcb814dba9a6b50f9c9777ef93 100644 (file)
@@ -83,7 +83,7 @@ sys-user_getuid() {
        # Output the real UID of the given user, or the empty string if the
        # user does not exist on the system.
        [[ $# -eq 1 ]] || die "usage: sys-user_getuid <username>"
-       echo $(id --real --user "${1}")
+       echo $(id --real --user "${1}" 2>/dev/null)
 }
 
 sys-user_getname() {
@@ -126,7 +126,7 @@ sys-user_modify() {
        usermod ${SYS_USER_UID:+--uid }"${SYS_USER_UID}" \
                        ${SYS_USER_GROUPS:+--append --groups }"${SYS_USER_GROUPS}" \
                        --shell "${SYS_USER_SHELL}" \
-                       --home-dir "${SYS_USER_HOME}" \
+                       --home "${SYS_USER_HOME}" \
                        "${SYS_USER_NAME}"
 }
 
@@ -178,7 +178,8 @@ sys-user_src_configure() {
        fi
 
        local current_name=$(sys-user_getname "${SYS_USER_UID}")
-       if [[ "${current_name}" != "${SYS_USER_NAME}" ]]; then
+       if [[ -n "${current_name}" ]] && \
+                  [[ "${current_name}" != "${SYS_USER_NAME}" ]]; then
                # This UID is already taken by another user, but this
                # specific UID was not important (we checked in
                # pkg_pretend), so fall back to an arbitrary one.