summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am3
-rw-r--r--configure.ac55
-rw-r--r--manager.c25
-rw-r--r--manager.h1
-rw-r--r--service.c16
5 files changed, 91 insertions, 9 deletions
diff --git a/Makefile.am b/Makefile.am
index 0c0e4def24..fd5dede5e0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -23,7 +23,8 @@ AM_CPPFLAGS = \
-include $(top_builddir)/config.h \
-DSYSTEM_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/system\" \
-DSYSTEM_DATA_UNIT_PATH=\"$(pkgdatadir)/system\" \
- -DSYSTEM_SYSVINIT_PATH=\"$(sysconfdir)/init.d\" \
+ -DSYSTEM_SYSVINIT_PATH=\"$(SYSTEM_SYSVINIT_PATH)\" \
+ -DSYSTEM_RCND_PATH=\"$(SYSTEM_SYSVRCND_PATH)\" \
-DSESSION_CONFIG_UNIT_PATH=\"$(pkgsysconfdir)/session\" \
-DSESSION_DATA_UNIT_PATH=\"$(pkgdatadir)/session\" \
-DCGROUP_AGENT_PATH=\"$(pkglibexecdir)/systemd-cgroups-agent\"
diff --git a/configure.ac b/configure.ac
index 0521649916..d8974156a2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,4 +76,59 @@ AC_SUBST(CGROUP_LIBS)
AM_PROG_VALAC()
AC_SUBST(VAPIDIR)
+AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO],[Specify the distribution to target: One of fedora, suse, debian, or none]))
+if test "z$with_distro" = "z"; then
+ if test "$cross_compiling" = yes; then
+ AC_MSG_WARN([Target distribution cannot be reliably detected when cross-compiling. You should specify it with --with-distro (see $0 --help for recognized distros)])
+ else
+ AC_CHECK_FILE(/etc/redhat-release,with_distro="fedora")
+ AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
+ AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
+ fi
+ if test "z$with_distro" = "z"; then
+ with_distro=`uname -s`
+ fi
+fi
+with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]' `
+
+echo "hallo"
+
+case $with_distro in
+ fedora)
+ SYSTEM_SYSVINIT_PATH=/etc/rc.d/init.d
+ SYSTEM_SYSVRCND_PATH=/etc/rc.d
+ ;;
+ suse)
+ SYSTEM_SYSVINIT_PATH=/etc/init.d
+ SYSTEM_SYSVRCND_PATH=/etc/init.d
+ ;;
+ debian)
+ SYSTEM_SYSVINIT_PATH=/etc/init.d
+ SYSTEM_SYSVRCND_PATH=/etc
+ ;;
+ none)
+ SYSTEM_SYSVINIT_PATH=/etc/fix/the/configure/script
+ SYSTEM_SYSVRCND_PATH=/etc/fix/the/configure/script
+ ;;
+ *)
+ AC_MSG_ERROR([Your distribution (${with_distro}) is not yet supported, SysV init scripts could not be found! (patches welcome); you can specify --with-distro=none to skip this check])
+ ;;
+esac
+
+echo "hallo"
+
+AC_SUBST(SYSTEM_SYSVINIT_PATH)
+AC_SUBST(SYSTEM_RCND_PATH)
+
+AM_CONDITIONAL(TARGET_FEDORA, test x"$with_distro" = xfedora)
+AM_CONDITIONAL(TARGET_SUSE, test x"$with_distro" = xsuse)
+AM_CONDITIONAL(TARGET_DEBIAN, test x"$with_distro" = xdebian)
+
AC_OUTPUT([Makefile])
+
+echo "
+ $PACKAGE_NAME $VERSION
+
+ SysV init scripts: ${SYSTEM_SYSVINIT_PATH}
+ SysV rc?.d directories: ${SYSTEM_SYSVRCND_PATH}
+"
diff --git a/manager.c b/manager.c
index 6c73acf403..7adaa4ed0b 100644
--- a/manager.c
+++ b/manager.c
@@ -232,10 +232,24 @@ static int manager_find_paths(Manager *m) {
NULL)))
return -ENOMEM;
}
+
+ if ((e = getenv("SYSTEMD_SYSVRCND_PATH")))
+ if (!(m->sysvrcnd_path = split_path_and_make_absolute(e)))
+ return -ENOMEM;
+
+ if (strv_isempty(m->sysvrcnd_path)) {
+ strv_free(m->sysvrcnd_path);
+
+ if (!(m->sysvrcnd_path = strv_new(
+ SYSTEM_SYSVRCND_PATH, /* /etc/rcN.d/ */
+ NULL)))
+ return -ENOMEM;
+ }
}
strv_uniq(m->unit_path);
strv_uniq(m->sysvinit_path);
+ strv_uniq(m->sysvrcnd_path);
assert(!strv_isempty(m->unit_path));
if (!(t = strv_join(m->unit_path, "\n\t")))
@@ -253,6 +267,16 @@ static int manager_find_paths(Manager *m) {
} else
log_debug("Ignoring SysV init scripts.");
+ if (!strv_isempty(m->sysvrcnd_path)) {
+
+ if (!(t = strv_join(m->sysvrcnd_path, "\n\t")))
+ return -ENOMEM;
+
+ log_debug("Looking for SysV rcN.d links in:\n\t%s", t);
+ free(t);
+ } else
+ log_debug("Ignoring SysV rcN.d links.");
+
return 0;
}
@@ -363,6 +387,7 @@ void manager_free(Manager *m) {
strv_free(m->unit_path);
strv_free(m->sysvinit_path);
+ strv_free(m->sysvrcnd_path);
free(m->cgroup_controller);
free(m->cgroup_hierarchy);
diff --git a/manager.h b/manager.h
index 00d5ea1927..84cf18c3d3 100644
--- a/manager.h
+++ b/manager.h
@@ -146,6 +146,7 @@ struct Manager {
char **unit_path;
char **sysvinit_path;
+ char **sysvrcnd_path;
/* Data specific to the device subsystem */
struct udev* udev;
diff --git a/service.c b/service.c
index 1ee0f05d3e..23f8592b9b 100644
--- a/service.c
+++ b/service.c
@@ -36,13 +36,13 @@
#define LINE_MAX 4096
static const char * const rcnd_table[] = {
- "../rc0.d", SPECIAL_RUNLEVEL0_TARGET,
- "../rc1.d", SPECIAL_RUNLEVEL1_TARGET,
- "../rc2.d", SPECIAL_RUNLEVEL2_TARGET,
- "../rc3.d", SPECIAL_RUNLEVEL3_TARGET,
- "../rc4.d", SPECIAL_RUNLEVEL4_TARGET,
- "../rc5.d", SPECIAL_RUNLEVEL5_TARGET,
- "../rc6.d", SPECIAL_RUNLEVEL6_TARGET
+ "/rc0.d", SPECIAL_RUNLEVEL0_TARGET,
+ "/rc1.d", SPECIAL_RUNLEVEL1_TARGET,
+ "/rc2.d", SPECIAL_RUNLEVEL2_TARGET,
+ "/rc3.d", SPECIAL_RUNLEVEL3_TARGET,
+ "/rc4.d", SPECIAL_RUNLEVEL4_TARGET,
+ "/rc5.d", SPECIAL_RUNLEVEL5_TARGET,
+ "/rc6.d", SPECIAL_RUNLEVEL6_TARGET
};
@@ -218,7 +218,7 @@ static int priority_from_rcd(Service *s, const char *init_script) {
char **p;
unsigned i;
- STRV_FOREACH(p, UNIT(s)->meta.manager->sysvinit_path)
+ STRV_FOREACH(p, UNIT(s)->meta.manager->sysrcnd_path)
for (i = 0; i < ELEMENTSOF(rcnd_table); i += 2) {
char *path;
DIR *d;