Add patch to disable resolve.conf symlink (#1043119)

This commit is contained in:
Colin Walters 2014-07-07 15:02:08 -04:00
parent 8403beacd6
commit a1b71bbfb4
2 changed files with 74 additions and 1 deletions

View File

@ -0,0 +1,65 @@
From 7824f773110be8a0cecb89f650e13db03b58d1e1 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Mon, 7 Jul 2014 08:27:43 -0400
Subject: [PATCH] resolved: Move symlink creation from tmpfiles to daemon
runtime
At least Fedora right now doesn't by default use resolved; the service
is disabled by default in the 90-default.preset file.
The change to unconditionally create the resolv.conf symlink broke
Anaconda and related tools (lorax) which expect it to be a regular
file. In particular, Anaconda expects to be able to persist
networking state from the installation environment to the target
system.
A simple fix is to just have resolved itself create it at runtime.
---
src/resolve/resolved-manager.c | 12 +++++++++++-
tmpfiles.d/etc.conf | 1 -
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/src/resolve/resolved-manager.c b/src/resolve/resolved-manager.c
index 3ed0603..1a6b3ac 100644
--- a/src/resolve/resolved-manager.c
+++ b/src/resolve/resolved-manager.c
@@ -192,9 +192,11 @@ static void append_dns(FILE *f, void *dns, unsigned char family, unsigned *count
int manager_update_resolv_conf(Manager *m) {
const char *path = "/run/systemd/resolve/resolv.conf";
+ const char *etcresolv_path = "/etc/resolv.conf";
_cleanup_free_ char *temp_path = NULL;
_cleanup_fclose_ FILE *f = NULL;
- _cleanup_free_ unsigned *indices = NULL;
+ _cleanup_free_ unsigned *indices = NULL;
+ struct stat st;
Address *address;
unsigned count = 0;
int n, r, i;
@@ -270,6 +272,14 @@ int manager_update_resolv_conf(Manager *m) {
return r;
}
+ /* Create /etc/resolv.conf as a link only if it doesn't exist */
+ if (lstat(etcresolv_path, &st) < 0) {
+ r = symlink(path, etcresolv_path);
+ if (r < 0 && errno != EEXIST) {
+ return r;
+ }
+ }
+
return 0;
}
diff --git a/tmpfiles.d/etc.conf b/tmpfiles.d/etc.conf
index e809dff..4937719 100644
--- a/tmpfiles.d/etc.conf
+++ b/tmpfiles.d/etc.conf
@@ -10,4 +10,3 @@
L /etc/os-release - - - - ../usr/lib/os-release
L /etc/localtime - - - - ../usr/share/zoneinfo/UTC
L+ /etc/mtab - - - - ../proc/self/mounts
-L /etc/resolv.conf - - - - ../run/systemd/resolve/resolv.conf
--
1.8.3.1

View File

@ -16,7 +16,7 @@
Name: systemd
Url: http://www.freedesktop.org/wiki/Software/systemd
Version: 215
Release: 2%{?gitcommit:.git%{gitcommit}}%{?dist}
Release: 3%{?gitcommit:.git%{gitcommit}}%{?dist}
# For a breakdown of the licensing, see README
License: LGPLv2+ and MIT and GPLv2+
Summary: A System and Service Manager
@ -40,6 +40,11 @@ Source6: yum-protect-systemd.conf
# GIT_DIR=~/src/systemd/.git git format-patch-ab -M -N --no-signature v215..v215-stable
# i=1; for p in 0*patch;do printf "Patch%03d: %s\n" $i $p; ((i++));done
# Presently not accepted upstream, but we disable systemd-resolved in
# the presets anyways, and this unbreaks anaconda/lorax/livecd-creator
# etc.
Patch0: 0001-resolved-Move-symlink-creation-from-tmpfiles-to-daem.patch
# kernel-install patch for grubby, drop if grubby is obsolete
Patch1000: kernel-install-grubby.patch
@ -760,6 +765,9 @@ getent passwd systemd-journal-gateway >/dev/null 2>&1 || useradd -r -l -u 191 -g
%{_datadir}/systemd/gatewayd
%changelog
* Mon Jul 07 2014 Colin Walters <walters@redhat.com> - 215-3
- Add patch to disable resolve.conf symlink (#1043119)
* Sat Jul 06 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 215-2
- Move systemd-journal-remote to systemd-journal-gateway package (#1114688)
- Disable /etc/mtab handling temporarily (#1116158)