+sys-user_pkg_pretend() {
+ # Sanity checks that would otherwise run code in global scope.
+ #
+ # First ensure that the user didn't say his UID is important and
+ # then fail to specify one.
+ if (( "${SYS_USER_UID}" == -1 )) &&
+ [[ "${SYS_USER_UID_IMPORTANT}" == "true" ]]; then
+ # Don't make no damn sense.
+ die "arbitrary UID requested with SYS_USER_UID_IMPORTANT=true"
+ fi
+
+ # Next ensure that no other username owns an important UID.
+ if [[ "${SYS_USER_UID_IMPORTANT}" == "true" ]]; then
+ # Ok, the UID is important. Make sure nobody else has it. Or
+ # rather, nobody else *with a different username* has it.
+ local oldname=$(egetent passwd "${SYS_USER_UID}" | cut -f1 -d':')
+ if [[ "${SYS_USER_NAME}" != "${oldname}" ]]; then
+ die "important UID ${SYS_USER_UID} already belongs to ${oldname}"
+ fi
+ fi