- else
- userdel "${SYS_USER_NAME}" || \
- die "failed to remove user ${SYS_USER_NAME}"
- einfo "Removed user ${SYS_USER_NAME} from the system."
+ elif [[ -z "${REPLACING_VERSIONS}" ]]; then
+ # The user to remove exists, and this is not an upgrade. For
+ # Phase 1, we maintain the status quo and simply refuse to
+ # remove him (unless you know what you are doing).
+ if [[ "${I_KNOW_WHAT_I_AM_DOING}" == "yes" ]]; then
+ userdel "${SYS_USER_NAME}" || \
+ die "failed to remove user ${SYS_USER_NAME}"
+ einfo "Removed user ${SYS_USER_NAME} from the system."
+ else
+ die "refusing to remove package for system user ${SYS_USER_NAME}"
+ fi
+
+ # The missing case: if the user exists and this is an upgrade,
+ # we leave the user alone to be modified in
+ # sys-user_pkg_preinst().