From 24d65014bbdb2de0bde5ca9e5664baa9f7ac7121 Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Tue, 5 Sep 2023 19:09:54 +0000 Subject: T2958: Refactor DHCP-server systemd unit and lease Render isc-dhcp-server systemd unit from configuration --- data/templates/dhcp-server/10-override.conf.j2 | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 data/templates/dhcp-server/10-override.conf.j2 (limited to 'data') diff --git a/data/templates/dhcp-server/10-override.conf.j2 b/data/templates/dhcp-server/10-override.conf.j2 new file mode 100644 index 000000000..1504b6808 --- /dev/null +++ b/data/templates/dhcp-server/10-override.conf.j2 @@ -0,0 +1,30 @@ +### Autogenerated by dhcp_server.py ### +{% set lease_file = '/config/dhcpd.leases' %} +[Unit] +Description=ISC DHCP IPv4 server +Documentation=man:dhcpd(8) +RequiresMountsFor=/run +ConditionPathExists= +ConditionPathExists=/run/dhcp-server/dhcpd.conf +After= +After=vyos-router.service + +[Service] +Type=forking +WorkingDirectory= +WorkingDirectory=/run/dhcp-server +RuntimeDirectory=dhcp-server +RuntimeDirectoryPreserve=yes +Environment=PID_FILE=/run/dhcp-server/dhcpd.pid CONFIG_FILE=/run/dhcp-server/dhcpd.conf LEASE_FILE={{ lease_file }} +PIDFile=/run/dhcp-server/dhcpd.pid +ExecStartPre=/bin/sh -ec '\ +touch ${LEASE_FILE}; \ +chown dhcpd:vyattacfg ${LEASE_FILE}* ; \ +chmod 664 ${LEASE_FILE}* ; \ +/usr/sbin/dhcpd -4 -t -T -q -user dhcpd -group vyattacfg -pf ${PID_FILE} -cf ${CONFIG_FILE} -lf ${LEASE_FILE} ' +ExecStart= +ExecStart=/usr/sbin/dhcpd -4 -q -user dhcpd -group vyattacfg -pf ${PID_FILE} -cf ${CONFIG_FILE} -lf ${LEASE_FILE} +Restart=always + +[Install] +WantedBy=multi-user.target -- cgit v1.2.3