Commit ae43e491 authored by Michael Biebl's avatar Michael Biebl
Browse files

insserv-generator: ignore non-existing SysV init scripts

Update insserv generator to not create any drop-in files for services
where the corresponding SysV init script does not exist.
parent 6c44d3d9
......@@ -7,6 +7,8 @@ systemd (204-13) UNRELEASED; urgency=medium
the modalias rule. Thanks to Tommaso Colombo for the analysis.
* Cherry-pick upstream fix which prevents systemd from entering an infinite
loop when trying to break an ordering cycle. (Closes: #752259)
* Update insserv generator to not create any drop-in files for services
where the corresponding SysV init script does not exist.
-- Michael Biebl <biebl@debian.org> Fri, 27 Jun 2014 22:37:23 +0200
......
......@@ -17,8 +17,8 @@ It has the following modifications:
---
Makefile.am | 9 +
src/insserv-generator/Makefile | 28 +++
src/insserv-generator/insserv-generator.c | 310 ++++++++++++++++++++++++++++++
3 files changed, 347 insertions(+)
src/insserv-generator/insserv-generator.c | 321 ++++++++++++++++++++++++++++++
3 files changed, 358 insertions(+)
create mode 100644 src/insserv-generator/Makefile
create mode 100644 src/insserv-generator/insserv-generator.c
......@@ -85,10 +85,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..af5267c
index 0000000..904e8cb
--- /dev/null
+++ b/src/insserv-generator/insserv-generator.c
@@ -0,0 +1,310 @@
@@ -0,0 +1,321 @@
+/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
+
+/***
......@@ -271,6 +271,7 @@ index 0000000..af5267c
+ STRV_FOREACH (j, parsed+1) {
+ _cleanup_free_ char *unit = NULL;
+ _cleanup_free_ char *dep = NULL;
+ _cleanup_free_ char *initscript = NULL;
+
+ /* targets should not pull in and activate other targets so skip them */
+ if (*j[0] == '$')
......@@ -283,6 +284,16 @@ index 0000000..af5267c
+ if ((sysv_translate_facility(name, NULL, &dep) < 0) || !dep)
+ continue;
+
+ /* don't create any drop-in configs if the
+ * corresponding SysV init script does not exist */
+ initscript = strjoin("/etc/init.d/", name, NULL);
+ if (access(initscript, F_OK) < 0) {
+ strcat(initscript, ".sh");
+ if (access(initscript, F_OK) < 0) {
+ continue;
+ }
+ }
+
+ unit = strjoin(arg_dest, "/", dep, ".d/50-",basename(filename),"-",parsed[0],".conf", NULL);
+ if (!unit)
+ return log_oom();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment