commit 0a737c62cd2fea82787774bcc4bdd1901882ffa7
parent 343d3b6508f73440ae205329a2e069f7a465d4fd
Author: Daniel Barlow <dan@telent.net>
Date: Tue, 12 Sep 2023 17:51:00 +0100
convert acquire-wan-address to writeFennel
this means we can get rid of the inelegant environent variable
check at the bottom of the file
Diffstat:
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/examples/acquire-wan-address.fnl b/examples/acquire-wan-address.fnl
@@ -30,8 +30,9 @@
(.. "ip address del " p.address "/" p.len " dev " wan-device)))
new-addresses))
-(fn run [state-directory wan-device]
- (let [dir (svc.open state-directory)]
+(fn run []
+ (let [[state-directory wan-device] arg
+ dir (svc.open state-directory)]
(var addresses [])
(while true
(while (not (dir:ready?)) (dir:wait))
@@ -40,8 +41,4 @@
(update-addresses wan-device addresses (dir:output "address"))))
(dir:wait))))
-
-(if (os.getenv "RUN_TESTS")
- { : update-addresses : changes : run }
- (let [[state-directory wan-device] arg]
- (run state-directory wan-device)))
+{ : update-addresses : changes : run }
diff --git a/examples/acquire-wan-address.nix b/examples/acquire-wan-address.nix
@@ -1,8 +1,9 @@
{
- writeFennelScript
+ writeFennel
, linotify
, anoia
}:
-writeFennelScript "acquire-wan-address"
- [ linotify anoia ]
- ./acquire-wan-address.fnl
+writeFennel "acquire-wan-address" {
+ packages = [ linotify anoia ];
+ mainFunction = "run";
+} ./acquire-wan-address.fnl