2007-03-16 17:41:38 +01:00
|
|
|
{dhcp, configFile, interfaces}:
|
|
|
|
|
2007-03-20 12:04:45 +01:00
|
|
|
let
|
|
|
|
|
|
|
|
stateDir = "/var/lib/dhcp"; # Don't use /var/state/dhcp; not FHS-compliant.
|
|
|
|
|
|
|
|
in
|
|
|
|
|
2007-03-16 17:41:38 +01:00
|
|
|
{
|
|
|
|
name = "dhcpd";
|
|
|
|
|
|
|
|
job = "
|
|
|
|
description \"DHCP server\"
|
|
|
|
|
|
|
|
start on network-interfaces/started
|
|
|
|
stop on network-interfaces/stop
|
|
|
|
|
|
|
|
script
|
2007-03-20 13:34:52 +01:00
|
|
|
|
|
|
|
mkdir -m 755 -p ${stateDir}
|
|
|
|
|
|
|
|
touch ${stateDir}/dhcpd.leases
|
|
|
|
|
2007-03-20 12:04:45 +01:00
|
|
|
exec ${dhcp}/sbin/dhcpd -f -cf ${configFile} \\
|
|
|
|
-lf ${stateDir}/dhcpd.leases \\
|
|
|
|
${toString interfaces}
|
2007-03-20 13:34:52 +01:00
|
|
|
|
2007-03-16 17:41:38 +01:00
|
|
|
end script
|
|
|
|
";
|
|
|
|
|
|
|
|
}
|