X-Git-Url: https://glassweightruler.freedombox.rocks/gitweb/waydroid.git/blobdiff_plain/a3d741d7d54df55efe4f13318d9393960f1eaa1b..45ff58a6494a411788e6b4bbc6d1ca9735c5e018:/tools/helpers/lxc.py diff --git a/tools/helpers/lxc.py b/tools/helpers/lxc.py index a099801..ee84c61 100644 --- a/tools/helpers/lxc.py +++ b/tools/helpers/lxc.py @@ -130,20 +130,30 @@ def generate_nodes_lxc_config(args): def set_lxc_config(args): lxc_path = tools.config.defaults["lxc"] + "/waydroid" - config_file = "config_2" lxc_ver = get_lxc_version(args) if lxc_ver == 0: raise OSError("LXC is not installed") - elif lxc_ver <= 2: - config_file = "config_1" - config_path = tools.config.tools_src + "/data/configs/" + config_file + config_paths = tools.config.tools_src + "/data/configs/config_" + seccomp_profile = tools.config.tools_src + "/data/configs/waydroid.seccomp" + + config_snippets = [ config_paths + "base" ] + # lxc v1 is a bit special because some options got renamed later + if lxc_ver == 1: + config_snippets.append(config_paths + "1") + else: + for ver in range(2, 5): + snippet = config_paths + str(ver) + if lxc_ver >= ver and os.path.exists(snippet): + config_snippets.append(snippet) command = ["mkdir", "-p", lxc_path] tools.helpers.run.user(args, command) - command = ["cp", "-fpr", config_path, lxc_path + "/config"] + command = ["sh", "-c", "cat {} > \"{}\"".format(' '.join('"{0}"'.format(w) for w in config_snippets), lxc_path + "/config")] tools.helpers.run.user(args, command) command = ["sed", "-i", "s/LXCARCH/{}/".format(platform.machine()), lxc_path + "/config"] tools.helpers.run.user(args, command) + command = ["cp", "-fpr", seccomp_profile, lxc_path + "/waydroid.seccomp"] + tools.helpers.run.user(args, command) nodes = generate_nodes_lxc_config(args) config_nodes_tmp_path = args.work + "/config_nodes"