X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/waydroid.git/blobdiff_plain/fc08b71b971ad6a4a9d6575d3a3b2271f26a8ed1..1be063fca4e4b517ec4d4c0d8703a3f6be1cf049:/tools/helpers/lxc.py?ds=sidebyside diff --git a/tools/helpers/lxc.py b/tools/helpers/lxc.py index 50c3c16..cac4bb5 100644 --- a/tools/helpers/lxc.py +++ b/tools/helpers/lxc.py @@ -367,8 +367,11 @@ def unfreeze(args): tools.helpers.run.user(args, command) def shell(args): - if status(args) != "RUNNING": - logging.error("WayDroid container is {}".format(status(args))) + state = status(args) + if state == "FROZEN": + unfreeze(args) + elif state != "RUNNING": + logging.error("WayDroid container is {}".format(state)) return command = ["lxc-attach", "-P", tools.config.defaults["lxc"], "-n", "waydroid", "--"] @@ -377,11 +380,18 @@ def shell(args): else: command.append("/system/bin/sh") subprocess.run(command, env={"PATH": os.environ['PATH'] + ":/system/bin:/vendor/bin"}) + if state == "FROZEN": + freeze(args) def logcat(args): - if status(args) != "RUNNING": - logging.error("WayDroid container is {}".format(status(args))) + state = status(args) + if state == "FROZEN": + unfreeze(args) + elif state != "RUNNING": + logging.error("WayDroid container is {}".format(state)) return command = ["lxc-attach", "-P", tools.config.defaults["lxc"], "-n", "waydroid", "--", "/system/bin/logcat"] subprocess.run(command) + if state == "FROZEN": + freeze(args)