forked from dan/liminix
convert acquire-wan-address to writeFennel
this means we can get rid of the inelegant environent variable check at the bottom of the file
This commit is contained in:
parent
343d3b6508
commit
0a737c62cd
|
@ -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 }
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue