summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2024-01-19 23:19:11 +0100
committerAki <please@ignore.pl>2024-01-19 23:19:11 +0100
commitd90b97acaff16a751d0b0153dc4a405bfceb462c (patch)
tree9f7c533e65d0964e1b9265017f87a44128a8950f
downloadsystemd-dns-ready-master.zip
systemd-dns-ready-master.tar.gz
systemd-dns-ready-master.tar.bz2
Created target marking readiness of a net DNS resolverHEADmaster
The whole purpose is to have something that can recognize if systemd-resolved is ready, because it complained before it. I was unable to determine better method so here we are. The dependency on host(1) from bind9/named is annoying and writing a simple getaddrinfo(3) checker could be a good step forward.
-rw-r--r--Makefile19
-rw-r--r--dns-ready-check.service12
-rw-r--r--dns-ready.target4
3 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..d26ccb9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,19 @@
+DESTDIR=
+PREFIX=/usr/local
+LIBDIR=$(PREFIX)/lib
+SYSDDIR=$(LIBDIR)/systemd/system
+
+
+all:
+ @echo no-op
+
+
+install:
+ install -m644 -Dt $(DESTDIR)$(SYSDDIR) dns-ready{-check.service,.target}
+
+
+uninstall:
+ rm -f $(DESTDIR)$(SYSDDIR)/dns-ready{-check.service,.target}
+
+
+.PHONY: all install uninstall
diff --git a/dns-ready-check.service b/dns-ready-check.service
new file mode 100644
index 0000000..a945739
--- /dev/null
+++ b/dns-ready-check.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Check if Domain Name System resolver is ready
+DefaultDependencies=no
+Requires=network-online.target
+After=network-online.target
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/host example.com
+Restart=on-failure
+RestartSec=1
+StandardOutput=null
diff --git a/dns-ready.target b/dns-ready.target
new file mode 100644
index 0000000..44b21c8
--- /dev/null
+++ b/dns-ready.target
@@ -0,0 +1,4 @@
+[Unit]
+Description=Domain Name System resolver is ready
+Requires=dns-ready-check.service
+After=dns-ready-check.service