ndhc/examples/s6.run
Nicholas J. Kain 841c8663e9
Make example s6 script handle empty leasefile properly.
Prior to this change, ndhc would fail to run with a malformed
command error if the leasefile was empty since the -r parameter
requires an argument.

Note that this script requires execline 2.9.1.0 for the
eltest program.  For earlier versions of s6, it should be
fine to use the POSIX test program instead.
2023-01-18 12:54:55 -05:00

9 lines
225 B
Plaintext
Executable File

#!/bin/execlineb -P
fdmove -c 2 1
backtick OLDEXTIP { cat /etc/ndhc/LEASE-wan0 }
importas OLDEXTIP OLDEXTIP
ifelse { eltest -n $OLDEXTIP }
{ /sbin/ndhc -c /etc/ndhc/wan0.conf -r $OLDEXTIP }
/sbin/ndhc -c /etc/ndhc/wan0.conf