Added patch from Dmitry Bogatov which makes communicating

with D-bus optional at compile time. This feature is
enabled by compiling with WANT_SYSTEMD defined.
This commit is contained in:
Jesse Smith 2018-12-01 19:25:50 -04:00
parent 6690aca0f7
commit 2d54e920e9
4 changed files with 31 additions and 0 deletions

View File

@ -17,6 +17,9 @@ November 2018 - jsmith@resonatingmedia.com
180_maxsymlinks
- Minor update to manual page to fix typo.
- Added patch from Dmitry Bogatov which makes communicating
with D-bus optional at compile time. This feature is
enabled by compiling with WANT_SYSTEMD defined.
-------------------------------------------------------------------
October 2018 - jsmith@resonatingmedia.com

View File

@ -126,9 +126,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).
*/
@ -182,8 +185,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 {
@ -1710,6 +1715,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;
@ -1719,6 +1725,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);
@ -2201,6 +2208,7 @@ static void scan_conf(const char *restrict file)
regfree(&creg.isactive);
}
#ifdef WANT_SYSTEMD
/*
* Maps between systemd and SystemV
*/
@ -2217,6 +2225,9 @@ static const char* sdmap[] = {
"localfs", "boot.localfs"
};
#endif /* WANT_SYSTEMD */
#ifdef WANT_SYSTEMD
/*
* Here the systemd targets are imported as system facilities
*/
@ -2352,6 +2363,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)
@ -2546,6 +2559,8 @@ out:
}
#endif /* SUSE */
#ifdef WANT_SYSTEMD
/*
* Systemd integration
*/
@ -2602,6 +2617,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'},
@ -2860,6 +2877,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++)
@ -2869,23 +2887,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>)
*/
@ -2893,6 +2915,7 @@ int main (int argc, char *argv[])
import_systemd_services();
systemd_free(); /* Not used anymore */
}
#endif
/*
* Initialize the regular scanner for the scripts.

View File

@ -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 */

View File

@ -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 */