]> glassweightruler.freedombox.rocks Git - waydroid.git/blobdiff - tools/actions/container_manager.py
Add first-launch command
[waydroid.git] / tools / actions / container_manager.py
index 058893965e595b2d92a6675828d568065a7f973c..f242b862bbd63de07ef1a6d8074cecdca2ecc2d0 100644 (file)
@@ -86,14 +86,11 @@ def start(args):
         cfg = tools.config.load(args)
         android_api = 0
         try:
-            mnt = "/tmp/waydroid-" + str(uuid.uuid1())
-            helpers.mount.mount(args, cfg["waydroid"]["images_path"] + "/system.img", mnt)
-            android_api = int(helpers.props.file_get(args, mnt + "/system/build.prop",
+            android_api = int(helpers.props.file_get(args,
+                    tools.config.defaults["rootfs"] + "/system/build.prop",
                     "ro.build.version.sdk"))
         except:
             logging.error("Failed to parse android version from system.img")
-        finally:
-            helpers.mount.umount_all(args, mnt);
 
         if android_api < 28:
             binder_protocol = "aidl"
@@ -117,8 +114,6 @@ def start(args):
         stop(args)
         sys.exit(0)
 
-    set_aidl_version()
-
     status = helpers.lxc.status(args)
     if status == "STOPPED":
         # Load binder and ashmem drivers
@@ -164,6 +159,8 @@ def start(args):
         # Mount rootfs
         helpers.images.mount_rootfs(args, cfg["waydroid"]["images_path"])
 
+        set_aidl_version()
+
         # Mount data
         helpers.mount.bind(args, session_cfg["session"]["waydroid_data"],
                            tools.config.defaults["data"])
@@ -172,8 +169,9 @@ def start(args):
         if which("start"):
             command = ["start", "cgroup-lite"]
             tools.helpers.run.user(args, command, check=False)
-        command = ["umount", "-l", "/sys/fs/cgroup/schedtune"]
-        tools.helpers.run.user(args, command, check=False)
+        if os.path.ismount("/sys/fs/cgroup/schedtune"):
+            command = ["umount", "-l", "/sys/fs/cgroup/schedtune"]
+            tools.helpers.run.user(args, command, check=False)
 
         #TODO: remove NFC hacks
         if which("stop"):