From 593bca9fb9065cc368ba771e31564754dfb217b5 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 19 Feb 2016 11:31:18 +0100 Subject: [PATCH] When deploying, always make /etc/resolve.conf a symlink into the monitor dir This way we can use the deployed etc dir instead of having to create our own. --- common/xdg-app-dir.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/common/xdg-app-dir.c b/common/xdg-app-dir.c index 71a331fb4..7ac4e43dd 100644 --- a/common/xdg-app-dir.c +++ b/common/xdg-app-dir.c @@ -1911,7 +1911,8 @@ xdg_app_dir_deploy (XdgAppDir *self, files_etc = g_file_resolve_relative_path (checkoutdir, "files/etc"); if (g_file_query_exists (files_etc, cancellable)) { - char *etcfiles[] = {"passwd", "group", "resolv.conf", "machine-id" }; + char *etcfiles[] = {"passwd", "group", "machine-id" }; + g_autoptr(GFile) etc_resolve_conf = g_file_get_child (files_etc, "resolv.conf"); int i; for (i = 0; i < G_N_ELEMENTS(etcfiles); i++) { @@ -1935,6 +1936,15 @@ xdg_app_dir_deploy (XdgAppDir *self, NULL, cancellable, error)) goto out; } + + if (g_file_query_exists (etc_resolve_conf, cancellable) && + !g_file_delete (etc_resolve_conf, cancellable, error)) + goto out; + + if (!g_file_make_symbolic_link (etc_resolve_conf, + "/run/host/monitor/resolv.conf", + cancellable, error)) + goto out; } keyfile = g_key_file_new ();