From 54dbd9258fbd735f06758df4a08ef38d15b4d87d Mon Sep 17 00:00:00 2001 From: Alessandro Astone Date: Mon, 2 Jan 2023 22:11:11 +0100 Subject: [PATCH] lxc: Allow shell and logcat from frozen --- tools/helpers/lxc.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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) -- 2.47.3