File aiccu-systemd.dif of Package aiccu

Index: unix-console/Makefile
===================================================================
--- unix-console/Makefile.orig
+++ unix-console/Makefile
@@ -51,6 +51,10 @@ CFLAGS  += -pthread -D_LINUX -D HAS_IFHE
 SRCS	+= ../common/aiccu_linux.c
 OBJS	+= ../common/aiccu_linux.o
 LDFLAGS	+= -lresolv
+ifeq (1,$(HAVE_SYSTEMD))
+LDFLAGS   += $(shell pkg-config --libs libsystemd 2>/dev/null || pkg-config --libs libsystemd-daemon)
+CFLAGS += -DHAVE_SYSTEMD
+endif
 endif
 
 # FreeBSD
Index: unix-console/main.c
===================================================================
--- unix-console/main.c.orig
+++ unix-console/main.c
@@ -12,6 +12,9 @@
 
 #include "../common/aiccu.h"
 #include "../common/tun.h"
+#ifdef HAVE_SYSTEMD
+#include <systemd/sd-daemon.h>
+#endif
 
 #ifndef _WIN32
 /* Enable/Disable heartbeating */
@@ -489,6 +492,10 @@ int main(int argc, char *argv[])
 	 */
 	if (aiccu_setup(hTunnel, true))
 	{
+#ifdef HAVE_SYSTEMD
+		/* Tell systemd we are operational. */
+		sd_notify(0, "READY=1");
+#endif
 		/* We need to stay running when doing Heartbeat or AYIYA */
 		if (	strcasecmp(hTunnel->sType, "6in4-heartbeat") == 0 ||
 			strcasecmp(hTunnel->sType, "ayiya") == 0)
openSUSE Build Service is sponsored by