From: Alessandro Astone Date: Mon, 2 Jan 2023 21:11:11 +0000 (+0100) Subject: lxc: Allow shell and logcat from frozen X-Git-Tag: 1.4.0~62 X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/waydroid.git/commitdiff_plain/54dbd9258fbd735f06758df4a08ef38d15b4d87d lxc: Allow shell and logcat from frozen --- 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)