From 841c8663e96b22072ab55710d4b3466350aacb3e Mon Sep 17 00:00:00 2001 From: "Nicholas J. Kain" Date: Wed, 18 Jan 2023 12:54:55 -0500 Subject: [PATCH] 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. --- examples/s6.run | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/s6.run b/examples/s6.run index cbb02b8..538b8ca 100755 --- a/examples/s6.run +++ b/examples/s6.run @@ -1,6 +1,8 @@ #!/bin/execlineb -P fdmove -c 2 1 -backtick OLDEXTIP { cat /etc/firewall/tmp/OLDEXTIP } +backtick OLDEXTIP { cat /etc/ndhc/LEASE-wan0 } importas OLDEXTIP OLDEXTIP -/sbin/ndhc -c /etc/ndhc/wan0.conf -r $OLDEXTIP +ifelse { eltest -n $OLDEXTIP } +{ /sbin/ndhc -c /etc/ndhc/wan0.conf -r $OLDEXTIP } +/sbin/ndhc -c /etc/ndhc/wan0.conf