New dependency of insserv
Dmitry Bogatov
KAction at debian.org
Wed Nov 28 18:48:10 GMT 2018
Hi!
While packaging newest version of insserv (1.18.0), I noticed that it
now depends on dbus.
Well, any chance to make it optional? I believe this patch will do:
diff --git a/insserv.c b/insserv.c
index 1fffd72..faca0c5 100644
--- a/insserv.c
+++ b/insserv.c
@@ -118,9 +118,12 @@ static inline void oneway(char *restrict stop)
/* Upstart suport */
static const char *upstartjob_path = "/lib/init/upstart-job";
+#ifdef WANT_SYSTEMD
/* Systemd support */
static DBusConnection *sbus;
+#endif /* WANT_SYSTEMD */
+
/*
* For a description of regular expressions see regex(7).
*/
@@ -174,8 +177,10 @@ static boolean set_override = false;
static boolean set_insconf = false;
/* Wether systemd is active or not */
+#if WANT_SYSTEMD
static boolean systemd = false;
static boolean is_overridden_by_systemd(const char *);
+#endif /* WANT_SYSTEMD */
/* Search results points here */
typedef struct lsb_struct {
@@ -1702,6 +1707,7 @@ static uchar scan_script_defaults(int dfd, const char *restrict const path,
}
#endif /* SUSE */
+#ifdef WANT_SYSTEMD
if (systemd) {
const char *serv;
serv = path;
@@ -1711,6 +1717,7 @@ static uchar scan_script_defaults(int dfd, const char *restrict const path,
ret |= FOUND_LSB_SYSTEMD;
}
}
+#endif /* WANT_SYSTEMD */
if (NULL != (upstart_job = is_upstart_job(path))) {
xreset(upstart_job);
@@ -2193,6 +2200,7 @@ static void scan_conf(const char *restrict file)
regfree(&creg.isactive);
}
+#ifdef WANT_SYSTEMD
/*
* Maps between systemd and SystemV
*/
@@ -2209,6 +2217,9 @@ static const char* sdmap[] = {
"localfs", "boot.localfs"
};
+#endif /* WANT_SYSTEMD */
+
+#ifdef WANT_SYSTEMD
/*
* Here the systemd targets are imported as system facilities
*/
@@ -2344,6 +2355,8 @@ static void import_systemd_services(void)
}
}
+#endif /* WANT_SYSTEMD */
+
static void expand_faci(list_t *restrict rlist, list_t *restrict head,
int *restrict deep) attribute((noinline,nonnull(1,2,3)));
static void expand_faci(list_t *restrict rlist, list_t *restrict head, int *restrict deep)
@@ -2538,6 +2551,8 @@ out:
}
#endif /* SUSE */
+#ifdef WANT_SYSTEMD
+
/*
* Systemd integration
*/
@@ -2594,6 +2609,8 @@ static void forward_to_systemd (const char *initscript, const char *verb, boolea
}
}
+#endif /* WANT_SYSTEMD */
+
static struct option long_options[] =
{
{"verbose", 0, (int*)0, 'v'},
@@ -2852,6 +2869,7 @@ int main (int argc, char *argv[])
/*
* Systemd support
*/
+#ifdef WANT_SYSTEMD
if (access(SYSTEMD_BINARY_PATH, F_OK) == 0 && (sbus = systemd_open_conn())) {
for (c = 0; c < argc; c++)
@@ -2861,23 +2879,27 @@ int main (int argc, char *argv[])
systemd_close_conn(sbus);
systemd = true;
}
+#endif /* WANT_SYSTEMD */
/*
* Scan and set our configuration for virtual services.
*/
scan_conf(insconf);
+#ifdef WANT_SYSTEMD
/*
* Handle Systemd target as system facilities (<name>.target -> $<name>)
*/
if (systemd)
import_systemd_facilities();
+#endif
/*
* Expand system facilities to real services
*/
expand_conf();
+#ifdef WANT_SYSTEMD
/*
* Handle Systemd services (<name>.service -> <name>)
*/
@@ -2885,6 +2907,7 @@ int main (int argc, char *argv[])
import_systemd_services();
systemd_free(); /* Not used anymore */
}
+#endif
/*
* Initialize the regular scanner for the scripts.
diff --git a/systemd.c b/systemd.c
index 38cc85b..c8044b3 100644
--- a/systemd.c
+++ b/systemd.c
@@ -1,3 +1,4 @@
+#ifdef WANT_SYSTEMD
/*
* systemd.c Use dbus API of systemd to import dependencies from.
*
@@ -458,3 +459,4 @@ void systemd_free(void)
free(serv);
}
}
+#endif /* WANT_SYSTEMD */
diff --git a/systemd.h b/systemd.h
index c38e609..534eee5 100644
--- a/systemd.h
+++ b/systemd.h
@@ -1,3 +1,4 @@
+#ifdef WANT_SYSTEMD
/*
* systemd.h
*
@@ -52,3 +53,5 @@ extern list_t sdservs;
#define SDREL_BEFORE (1<<4) /* Before */
#define SDREL_AFTER (1<<5) /* After */
+#endif /* WANT_SYSTEMD */
+
More information about the Debian-init-diversity
mailing list