def main()

in files/sdw-notify.py [0:0]


def main():
    """
    Show security warning, if and only if a warning is not already displayed,
    the preflight updater is running, and certain checks suggest that the
    system has not been updated for a specified period
    """

    if Util.is_conflicting_process_running(Notify.CONFLICTING_PROCESSES):
        # Conflicting system process may be running in dom0. Logged.
        sys.exit(1)

    if Util.can_obtain_lock(Updater.LOCK_FILE) is False:
        # Preflight updater is already running. Logged.
        sys.exit(1)

    # Hold on to lock handle during execution
    lock_handle = Util.obtain_lock(Notify.LOCK_FILE)
    if lock_handle is None:
        # Can't write to lockfile or notifier already running. Logged.
        sys.exit(1)

    warning_should_be_shown = Notify.is_update_check_necessary()
    if warning_should_be_shown is None:
        # Data integrity issue with update timestamp. Logged.
        sys.exit(1)
    elif warning_should_be_shown is True:
        show_update_warning()