From 3b90d0266b5c0a294a8e1e17b2a1a346cd1b7c2b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ferenc=20W=C3=A1gner?= Date: Thu, 31 May 2018 12:06:35 +0200 Subject: [PATCH] Add systemd notification support for startup error reporting --- debian/changelog | 7 +++++ debian/control | 3 +- .../notify_systemd_about_successful_startup | 30 +++++++++++++++++++ debian/patches/series | 1 + debian/rules | 2 +- debian/unscd.service | 1 + 6 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 debian/patches/notify_systemd_about_successful_startup diff --git a/debian/changelog b/debian/changelog index 8587869..62b6275 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +unscd (0.53-1.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * Add systemd notification support for startup error reporting. + + -- Ferenc Wágner Thu, 31 May 2018 12:03:28 +0200 + unscd (0.53-1) unstable; urgency=medium * New upstream revision diff --git a/debian/control b/debian/control index 0bb9bb5..8842ae1 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,8 @@ Source: unscd Section: admin Priority: optional Standards-Version: 4.1.4 -Build-Depends: debhelper (>= 10), groff-base, help2man +Build-Depends: debhelper (>= 10), groff-base, help2man, + libsystemd-dev Maintainer: Don Armstrong Vcs-Browser: https://git.donarmstrong.com/unscd.git Vcs-Git: https://git.donarmstrong.com/unscd.git diff --git a/debian/patches/notify_systemd_about_successful_startup b/debian/patches/notify_systemd_about_successful_startup new file mode 100644 index 0000000..e14cc0d --- /dev/null +++ b/debian/patches/notify_systemd_about_successful_startup @@ -0,0 +1,30 @@ +From: =?utf-8?q?Ferenc_W=C3=A1gner?= +Date: Thu, 31 May 2018 11:56:10 +0200 +Subject: Notify systemd about successful startup + +--- + nscd.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/nscd.c b/nscd.c +index 828eb17..4cbd7b1 100644 +--- a/nscd.c ++++ b/nscd.c +@@ -99,6 +99,8 @@ vda.linux@googlemail.com + /* For inet_ntoa (for debug build only) */ + #include + ++#include ++ + /* + * 0.21 add SEGV reporting to worker + * 0.22 don't do freeaddrinfo() in GETAI worker, it's crashy +@@ -2661,6 +2663,8 @@ int main(int argc, char **argv) + config.nttl[n] *= 1000; + } + ++ sd_notify (0, "READY=1"); ++ + main_loop(); + + return 0; diff --git a/debian/patches/series b/debian/patches/series index 9689a28..f3702ee 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ change_invalidate_request_info_output support_large_numbers_in_config no_debug_on_invalidate +notify_systemd_about_successful_startup diff --git a/debian/rules b/debian/rules index 413cdd5..e5e2a42 100755 --- a/debian/rules +++ b/debian/rules @@ -8,7 +8,7 @@ override_dh_auto_clean: dh_auto_clean override_dh_auto_build: - gcc $(CFLAGS) $(LDFLAGS) -o nscd nscd.c + gcc $(CFLAGS) $(LDFLAGS) -o nscd nscd.c -lsystemd help2man --name 'nscd which does not hang' \ --include debian/help2man \ --no-info \ diff --git a/debian/unscd.service b/debian/unscd.service index fc1f060..752c8e2 100644 --- a/debian/unscd.service +++ b/debian/unscd.service @@ -4,6 +4,7 @@ Description=Name Service Cache Daemon [Service] User=root ExecStart=/usr/sbin/nscd -d +Type=notify Restart=always [Install] -- 2.39.2