X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/waydroid.git/blobdiff_plain/a2804841ed52f812b1d666cb3df01239ee906f5f..63b9a09801ec8a963ead8abd1e49d844f6802155:/tools/__init__.py diff --git a/tools/__init__.py b/tools/__init__.py index df42752..65f0efc 100644 --- a/tools/__init__.py +++ b/tools/__init__.py @@ -5,7 +5,6 @@ import sys import logging import os import traceback -import subprocess from . import actions from . import config @@ -32,28 +31,21 @@ def main(): args.sudo_timer = True args.timeout = 1800 - if not actions.initializer.is_initialized(args): - if args.action and (args.action not in ("init", "first-launch", "log")): - if not args.wait_for_init: - print('ERROR: WayDroid is not initialized, run "waydroid init"') - return 0 + if os.geteuid() == 0: + if not os.path.exists(args.work): + os.mkdir(args.work) + elif not os.path.exists(args.log): + args.log = "/tmp/tools.log" - print('WayDroid waiting for initialization...') - while helpers.ipc.listen(channel="init") != "done": - pass + tools_logging.init(args) - elif os.geteuid() == 0 and args.action == "init": - if not os.path.exists(args.work): - os.mkdir(args.work) + if not actions.initializer.is_initialized(args) and \ + args.action and args.action not in ("init", "first-launch", "log"): + if args.wait_for_init: + actions.wait_for_init(args) else: - # This branch is taken if: - # - waydroid is not yet initialized - # - waydroid is invoked with no command or with log - if not os.path.exists(args.log): - # The log could have been already created if init was used and failed, if its not the case we use a temporary one - args.log = "/tmp/tools.log" - - tools_logging.init(args) + print('ERROR: WayDroid is not initialized, run "waydroid init"') + return 0 # Initialize or require config if args.action == "init": @@ -118,7 +110,7 @@ def main(): elif args.action == "show-full-ui": actions.app_manager.showFullUI(args) elif args.action == "first-launch": - subprocess.run(["pkexec", sys.argv[0], "init", "--gui"]) + actions.remote_init_client(args) if actions.initializer.is_initialized(args): actions.app_manager.showFullUI(args) elif args.action == "status":