From 9868be7730f0e2c6623faaab150fbaf2f3bc98c3 Mon Sep 17 00:00:00 2001 From: Didier Roche Date: Tue, 2 Dec 2014 16:28:37 +0100 Subject: [PATCH] Fix some sysv init only units not starting if /e/X/d-d-m doesn't match anything if /etc/X11/default-display-manager doesn't match a systemd unit (or doesn't exist), be less agressive about what to mask: we let all sysvinit-only display-manager units enabled to fallback to previous behavior and let them starting. Closes: #771739 --- debian/patches/insserv.conf-generator.patch | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/debian/patches/insserv.conf-generator.patch b/debian/patches/insserv.conf-generator.patch index a720d7d57..b30260725 100644 --- a/debian/patches/insserv.conf-generator.patch +++ b/debian/patches/insserv.conf-generator.patch @@ -14,14 +14,16 @@ It has the following modifications: - it ensures that targets do not start other targets or services - it masks all sysvinit display managers (tagged with an insserv $x-display-manager) not matching /etc/X11/default-display-manager, and - doesn't generate units having systemd system units already. + doesn't generate units having systemd system units already. Note that + it's a noop if /etc/X11/default-display-manager doesn't exist or don't + match an existing unit systemd file. [0] https://build.opensuse.org/package/view_file/openSUSE:Factory/systemd/insserv-generator.patch --- Makefile.am | 9 + src/insserv-generator/Makefile | 28 +++ - src/insserv-generator/insserv-generator.c | 373 ++++++++++++++++++++++++++++++ - 3 files changed, 410 insertions(+) + src/insserv-generator/insserv-generator.c | 377 ++++++++++++++++++++++++++++++ + 3 files changed, 414 insertions(+) create mode 100644 src/insserv-generator/Makefile create mode 100644 src/insserv-generator/insserv-generator.c @@ -88,10 +90,10 @@ index 0000000..9d07505 +.PHONY: all clean diff --git a/src/insserv-generator/insserv-generator.c b/src/insserv-generator/insserv-generator.c new file mode 100644 -index 0000000..ecf43ba +index 0000000..9d417f0 --- /dev/null +++ b/src/insserv-generator/insserv-generator.c -@@ -0,0 +1,373 @@ +@@ -0,0 +1,378 @@ +/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ + +/*** @@ -216,12 +218,12 @@ index 0000000..ecf43ba + return 1; +} + -+ +/* if we have a display-manager which doesn't match /etc/X11/default-display-manager, and don't have + an unit file, we mask it to simulate the init script behavior */ +static int mask_display_manager_init(const char *name) { + static const char *default_dm_file = "/etc/X11/default-display-manager"; + _cleanup_free_ char *default_dm_path = NULL; ++ char *defaultdm_unit_path = NULL;; + const char *in_mem_symlink = NULL; + int r; + @@ -234,6 +236,11 @@ index 0000000..ecf43ba + default_dm = ""; + } + ++ /* if default dm isn't a systemd service, we roll back to previous behavior: let all non systemd units starting */ ++ defaultdm_unit_path = strappenda(SYSTEM_DATA_UNIT_PATH, "/", default_dm, ".service"); ++ if (access(defaultdm_unit_path, F_OK) < 0 && (errno == ENOENT)) ++ return 0; ++ + /* init script is default dm, nothing to do */ + if (streq(default_dm, name)) + return 0; -- 2.39.5