From efc8653ecd567197ef60ebd3386ffd77d5b74a4d Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 21 Dec 2015 09:24:18 +0100 Subject: make systemd unit require the network device --- Makefile | 2 +- dyndhcpd@.service | 13 ------------- systemd/dyndhcpd@.service | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 14 deletions(-) delete mode 100644 dyndhcpd@.service create mode 100644 systemd/dyndhcpd@.service diff --git a/Makefile b/Makefile index 0553e0f..5ac0a4e 100644 --- a/Makefile +++ b/Makefile @@ -30,9 +30,9 @@ install: install-bin install-doc install-bin: dyndhcpd $(INSTALL) -D -m0755 dyndhcpd $(DESTDIR)/usr/bin/dyndhcpd - $(INSTALL) -D -m0644 dyndhcpd@.service $(DESTDIR)/usr/lib/systemd/system/dyndhcpd@.service $(INSTALL) -D -m0644 config/dhcpd.conf $(DESTDIR)/etc/dyndhcpd/dhcpd.conf $(INSTALL) -D -m0644 config/ipxe-options.conf $(DESTDIR)/etc/dyndhcpd/ipxe-options.conf + $(INSTALL) -D -m0644 systemd/dyndhcpd@.service $(DESTDIR)/usr/lib/systemd/system/dyndhcpd@.service install-doc: README.html $(INSTALL) -D -m0644 README.md $(DESTDIR)/usr/share/doc/dyndhcpd/README.md diff --git a/dyndhcpd@.service b/dyndhcpd@.service deleted file mode 100644 index ce49fd8..0000000 --- a/dyndhcpd@.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=IPv4 DHCP server for interface %i -After=network.target - -[Service] -ExecStart=/usr/bin/dyndhcpd -i%i -ProtectSystem=full -ProtectHome=on -PrivateDevices=on -NoNewPrivileges=on - -[Install] -WantedBy=multi-user.target diff --git a/systemd/dyndhcpd@.service b/systemd/dyndhcpd@.service new file mode 100644 index 0000000..8eb1867 --- /dev/null +++ b/systemd/dyndhcpd@.service @@ -0,0 +1,14 @@ +[Unit] +Description=IPv4 DHCP server for interface %i +After=network.target +Requires=sys-subsystem-net-devices-%i.device + +[Service] +ExecStart=/usr/bin/dyndhcpd -i%i +ProtectSystem=full +ProtectHome=on +PrivateDevices=on +NoNewPrivileges=on + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3-54-g00ecf