def main():
    prepare_only = (os.getenv('PREPAREONLY') is not None)
    manager_init()
    if (not prepare_only):
        managed_processes['ui'].start()
    manager_prepare()
    if prepare_only:
        return
    signal.signal(signal.SIGTERM, (lambda signum, frame: sys.exit(1)))
    try:
        manager_thread()
    except Exception:
        traceback.print_exc()
        crash.capture_exception()
    finally:
        manager_cleanup()
    if Params().get_bool('DoUninstall'):
        cloudlog.warning('uninstalling')
        HARDWARE.uninstall()
def main():
    prepare_only = (os.getenv('PREPAREONLY') is not None)
    manager_init()
    if (not prepare_only):
        managed_processes['ui'].start()
    manager_prepare()
    if prepare_only:
        return
    signal.signal(signal.SIGTERM, (lambda signum, frame: sys.exit(1)))
    try:
        manager_thread()
    except Exception:
        traceback.print_exc()
        crash.capture_exception()
    finally:
        manager_cleanup()
    if Params().get_bool('DoUninstall'):
        cloudlog.warning('uninstalling')
        HARDWARE.uninstall()