aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--pacredir.c3
-rw-r--r--pacredir.h3
-rw-r--r--systemd/pacredir.service1
4 files changed, 8 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index c33806f..4b59aa8 100644
--- a/Makefile
+++ b/Makefile
@@ -14,6 +14,7 @@ SED := sed
# flags
CFLAGS += -std=c11 -O2 -fPIC -Wall -Werror
CFLAGS_EXTRA += -lpthread
+CFLAGS_EXTRA += $(shell pkg-config --libs --cflags libsystemd)
CFLAGS_EXTRA += $(shell pkg-config --libs --cflags libcurl)
CFLAGS_EXTRA += $(shell pkg-config --libs --cflags avahi-client)
CFLAGS_EXTRA += $(shell pkg-config --libs --cflags libmicrohttpd)
diff --git a/pacredir.c b/pacredir.c
index b704f1c..afb9e8f 100644
--- a/pacredir.c
+++ b/pacredir.c
@@ -720,6 +720,9 @@ int main(int argc, char ** argv) {
signal(SIGKILL, sig_callback);
signal(SIGINT, sig_callback);
+ /* report ready to systemd */
+ sd_notifyf(0, "READY=1\nSTATUS=Waiting for requests to redirect...\nMAINPID=%lu", (unsigned long) getpid());
+
/* run the main loop */
avahi_simple_poll_loop(simple_poll);
diff --git a/pacredir.h b/pacredir.h
index e412db7..7dead59 100644
--- a/pacredir.h
+++ b/pacredir.h
@@ -24,6 +24,9 @@
#include <sys/stat.h>
#include <time.h>
+/* systemd headers */
+#include <systemd/sd-daemon.h>
+
/* Avahi headers */
#include <avahi-client/lookup.h>
#include <avahi-common/error.h>
diff --git a/systemd/pacredir.service b/systemd/pacredir.service
index c64a5d5..bc5a13f 100644
--- a/systemd/pacredir.service
+++ b/systemd/pacredir.service
@@ -4,6 +4,7 @@ Requires=avahi-daemon.service
After=avahi-daemon.service network.target network-online.target
[Service]
+Type=notify
User=nobody
Group=nobody
ExecStart=/usr/bin/pacredir