args.cache = {}
args.work = config.defaults["work"]
args.config = args.work + "/waydroid.cfg"
- args.log = args.work + "/tools.log"
+ args.log = args.work + "/waydroid.log"
args.sudo_timer = True
args.timeout = 1800
- if not os.path.isfile(args.config):
- if args.action and args.action != "init":
- print('ERROR: WayDroid is not initialized, run "waydroid init"')
- return 0
- elif os.geteuid() == 0 and args.action == "init":
+ if os.geteuid() == 0:
+ if not os.path.exists(args.work):
os.mkdir(args.work)
- else:
- args.log = "/tmp/tools.log"
+ elif not os.path.exists(args.log):
+ args.log = "/tmp/tools.log"
tools_logging.init(args)
+ 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:
+ print('ERROR: WayDroid is not initialized, run "waydroid init"')
+ return 0
+
# Initialize or require config
if args.action == "init":
actionNeedRoot(args.action)
actions.container_manager.start(args)
elif args.subaction == "stop":
actions.container_manager.stop(args)
+ elif args.subaction == "restart":
+ actions.container_manager.restart(args)
elif args.subaction == "freeze":
actions.container_manager.freeze(args)
elif args.subaction == "unfreeze":
actions.app_manager.remove(args)
elif args.subaction == "launch":
actions.app_manager.launch(args)
+ elif args.subaction == "intent":
+ actions.app_manager.intent(args)
elif args.subaction == "list":
actions.app_manager.list(args)
else:
helpers.lxc.logcat(args)
elif args.action == "show-full-ui":
actions.app_manager.showFullUI(args)
+ elif args.action == "first-launch":
+ actions.remote_init_client(args)
+ if actions.initializer.is_initialized(args):
+ actions.app_manager.showFullUI(args)
elif args.action == "status":
actions.status.print_status(args)
elif args.action == "log":
if args.clear_log:
helpers.run.user(args, ["truncate", "-s", "0", args.log])
- helpers.run.user(
- args, ["tail", "-n", args.lines, "-F", args.log], output="tui")
+ try:
+ helpers.run.user(
+ args, ["tail", "-n", args.lines, "-F", args.log], output="tui")
+ except KeyboardInterrupt:
+ pass
else:
logging.info("Run waydroid -h for usage information.")