X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mjo-overlay.git;a=blobdiff_plain;f=eclass%2Fsys-user.eclass;h=95417c79a8516ec4f53031cfe6c442d43e3eb77f;hp=3f20c57cc54f3a64b7e981a80e77bde66efb93e0;hb=06ebf3a15fd51455f6c62ef075602a5d6d189be7;hpb=842e88aba410d442084c0ba49d265609c76e94ed diff --git a/eclass/sys-user.eclass b/eclass/sys-user.eclass index 3f20c57..95417c7 100644 --- a/eclass/sys-user.eclass +++ b/eclass/sys-user.eclass @@ -73,6 +73,13 @@ sys-user_src_unpack() { :; } 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 @@ -109,7 +116,7 @@ sys-user_pkg_pretend() { # 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 @@ -129,7 +136,7 @@ sys-user_src_configure() { # 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