forked from DGNum/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
2 changed files with 9 additions and 11 deletions
|
@ -30,8 +30,9 @@
|
||||||
(.. "ip address del " p.address "/" p.len " dev " wan-device)))
|
(.. "ip address del " p.address "/" p.len " dev " wan-device)))
|
||||||
new-addresses))
|
new-addresses))
|
||||||
|
|
||||||
(fn run [state-directory wan-device]
|
(fn run []
|
||||||
(let [dir (svc.open state-directory)]
|
(let [[state-directory wan-device] arg
|
||||||
|
dir (svc.open state-directory)]
|
||||||
(var addresses [])
|
(var addresses [])
|
||||||
(while true
|
(while true
|
||||||
(while (not (dir:ready?)) (dir:wait))
|
(while (not (dir:ready?)) (dir:wait))
|
||||||
|
@ -40,8 +41,4 @@
|
||||||
(update-addresses wan-device addresses (dir:output "address"))))
|
(update-addresses wan-device addresses (dir:output "address"))))
|
||||||
(dir:wait))))
|
(dir:wait))))
|
||||||
|
|
||||||
|
{ : update-addresses : changes : run }
|
||||||
(if (os.getenv "RUN_TESTS")
|
|
||||||
{ : update-addresses : changes : run }
|
|
||||||
(let [[state-directory wan-device] arg]
|
|
||||||
(run state-directory wan-device)))
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
{
|
{
|
||||||
writeFennelScript
|
writeFennel
|
||||||
, linotify
|
, linotify
|
||||||
, anoia
|
, anoia
|
||||||
}:
|
}:
|
||||||
writeFennelScript "acquire-wan-address"
|
writeFennel "acquire-wan-address" {
|
||||||
[ linotify anoia ]
|
packages = [ linotify anoia ];
|
||||||
./acquire-wan-address.fnl
|
mainFunction = "run";
|
||||||
|
} ./acquire-wan-address.fnl
|
||||||
|
|
Loading…
Reference in a new issue