]> glassweightruler.freedombox.rocks Git - waydroid.git/commitdiff
lxc: Allow shell and logcat from frozen
authorAlessandro Astone <ales.astone@gmail.com>
Mon, 2 Jan 2023 21:11:11 +0000 (22:11 +0100)
committerAlessandro Astone <ales.astone@gmail.com>
Mon, 2 Jan 2023 21:11:11 +0000 (22:11 +0100)
tools/helpers/lxc.py

index 50c3c168e67f63e85aff616d61e4f1d0f5daba25..cac4bb5dbc6551147275c9f13582029b51517fa7 100644 (file)
@@ -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)