+ tools.helpers.run.user(args, command)
+
+ # Create empty file
+ open(os.path.join(lxc_path, "config_session"), mode="w").close()
+
+def generate_session_lxc_config(args, session):
+ nodes = []
+ def make_entry(src, dist=None, mnt_type="none", options="rbind,create=file 0 0"):
+ if any(x in src for x in ["\n", "\r"]):
+ logging.warning("User-provided mount path contains illegal character: " + src)
+ return False
+ if dist is None and (not os.path.exists(src) or
+ str(os.stat(src).st_uid) != session["user_id"]):
+ logging.warning("User-provided mount path is not owned by user: " + src)
+ return False
+ return add_node_entry(nodes, src, dist, mnt_type, options, check=False)
+
+ # Make sure XDG_RUNTIME_DIR exists
+ if not make_entry("tmpfs", session["xdg_runtime_dir"], options="create=dir 0 0"):
+ raise OSError("Failed to create XDG_RUNTIME_DIR mount point")
+
+ wayland_socket = os.path.realpath(os.path.join(session["xdg_runtime_dir"], session["wayland_display"]))
+ if not make_entry(wayland_socket):
+ raise OSError("Failed to bind Wayland socket")
+
+ pulse_socket = os.path.join(session["pulse_runtime_path"], "native")
+ make_entry(pulse_socket)
+
+ if not make_entry(session["waydroid_data"], "data", options="rbind 0 0"):
+ raise OSError("Failed to bind userdata")