From cbf71190625e34969684f4f9fdaa91931c1473f7 Mon Sep 17 00:00:00 2001 From: Thibault Godouet Date: Wed, 5 Dec 2012 19:22:57 +0000 Subject: [PATCH] Added systemd support --- Makefile.in | 24 ++++++++++++++---------- configure.in | 23 +++++++++++++++++++++++ script/.gitignore | 1 + script/fcron.init.systemd.in | 16 ++++++++++++++++ 4 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 script/fcron.init.systemd.in diff --git a/Makefile.in b/Makefile.in index 6390990..1830e04 100644 --- a/Makefile.in +++ b/Makefile.in @@ -53,6 +53,7 @@ BOOTINSTALL := @BOOTINSTALL@ ANSWERALL := @ANSWERALL@ USEPAM := @USEPAM@ FCRONDYN := @FCRONDYN@ +SYSTEMD_DIR := @SYSTEMD_DIR@ # Options # -DDEBUG even more verbose @@ -127,14 +128,20 @@ exe_list_test: exe_list.o u_list.o exe_list_test.o log.o subs.o -DFCRON_EDITOR="\"${FCRON_EDITOR}\"" -DBINDIREX="\"${DESTBIN}\"" \ -c $< -install: install-staged strip perms -ifeq ($(BOOTINSTALL), 1) +initscripts: if test ! -d script; then mkdir script ; fi - for F in sysVinit-launcher fcron.sh fcron.init.suse ; do \ + for F in sysVinit-launcher fcron.sh fcron.init.suse fcron.init.systemd ; do \ $(SRCDIR)/script/gen-in.pl $(SRCDIR)/script/$${F}.in script/$${F} ./ ; \ - done + done + +install: install-staged strip perms initscripts +ifeq ($(BOOTINSTALL), 1) $(SRCDIR)/script/boot-install "$(INSTALL) -o $(ROOTNAME)" $(DESTSBIN) $(DEBUG) $(FCRONTABS) $(ANSWERALL) $(SRCDIR) endif +ifneq ($(SYSTEMD_DIR), no) + if test ! -d $(DESTDIR)$(SYSTEMD_DIR); then $(INSTALL) -m 755 -d $(DESTDIR)$(SYSTEMD_DIR) ; fi + $(INSTALL) -m 644 files/fcron.init.systemd $(DESTDIR)$(SYSTEMD_DIR)/fcron.service +endif install-staged: all @@ -230,11 +237,7 @@ ifeq ($(FCRONDYN), 1) strip $(DESTDIR)$(DESTBIN)/fcrondyn endif -install-boot: install - if test ! -d script; then mkdir script ; fi - for F in sysVinit-launcher fcron.sh fcron.init.suse ; do \ - $(SRCDIR)/script/gen-in.pl $(SRCDIR)/script/$${F}.in script/$${F} ./ ; \ - done +install-boot: install initscripts $(SRCDIR)/script/boot-install "$(INSTALL) -o $(ROOTNAME)" $(DESTSBIN) $(DEBUG) $(FCRONTABS) $(ANSWERALL) $(SRCDIR) install-restart: install @@ -262,7 +265,8 @@ ciclean: clean vclean: ciclean rm -f config.log config.status config.h config.cache Makefile PREVIOUS_VERSION \ - files/fcron.conf script/fcron.init.suse script/fcron.sh script/sysVinit-launcher + files/fcron.conf script/fcron.init.suse script/fcron.init.systemd \ + script/fcron.sh script/sysVinit-launcher make -C doc clean diff --git a/configure.in b/configure.in index b726699..5dd78f3 100644 --- a/configure.in +++ b/configure.in @@ -390,6 +390,29 @@ DOCDIR="$docdir" AC_SUBST(DOCDIR) +dnl systemd init system +SYSTEMD_DIR="no" + +AC_CHECK_PROGS(PKG_CONFIG, $PKG_CONFIG pkg-config, , $PATH:/local/bin:/usr/local/bin:/opt/sfw/bin) +AC_MSG_CHECKING(for systemd) +AC_ARG_WITH([systemdsystemunitdir], +[ --with-systemdsystemunitdir=DIR Directory for systemd service files.], +[], [ if test "x" != "x$PKG_CONFIG"; then + with_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd` + fi]) +if test "x$with_systemdsystemunitdir" != xno; then + if test "x" != "x$with_systemdsystemunitdir"; then + SYSTEMD_DIR="$with_systemdsystemunitdir" + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + fi +else + AC_MSG_RESULT(disabled) +fi +AC_SUBST(SYSTEMD_DIR) + + dnl --------------------------------------------------------------------- dnl Users and groups ... diff --git a/script/.gitignore b/script/.gitignore index f0ef23b..68354c2 100644 --- a/script/.gitignore +++ b/script/.gitignore @@ -2,3 +2,4 @@ fcron.sh sysVinit-launcher fcron.init.suse +fcron.init.systemd diff --git a/script/fcron.init.systemd.in b/script/fcron.init.systemd.in new file mode 100644 index 0000000..369570b --- /dev/null +++ b/script/fcron.init.systemd.in @@ -0,0 +1,16 @@ +#systemd service configuration file for fcron + +[Unit] +Description=fcron periodical command scheduler +After=remote-fs.target syslog.target time-sync.target +Before=shutdown.target + +[Service] +Type=forking +PIDFile=@@PIDFILE@ +ExecStart=@@DESTSBIN@/fcron +ExecReload=/bin/kill -USR1 $MAINPID +Restart=always + +[Install] +WantedBy=multi-user.target -- 2.49.0