-sys-user_pkg_postinst() {
- if [[ -n "${REPLACING_VERSIONS}" ]]; then
- # This is an upgrade from a previous version of a sys-user
- # package. This case has to be handled carefully to make sure
- # that the pkg_prerm() of the old version doesn't remove the user
- # that this new version is going to add. At this point, in our
- # pkg_postinst(), the old version's pkg_prerm() phase should have
- # already happened.
- if [[ -n $(sys-user_getuid "${SYS_USER_NAME}") ]]; then
- die "User ${SYS_USER_NAME} already exists during an upgrade."
- else
- sys-user_modify || die "failed to add user ${SYS_USER_NAME}"
- fi
- fi
-}