2
0

ifwait: React to interface up by bringing up the service tree

This allows a system to be configured to dynamically bring up services
associated with an interface. For example, attaching a USB ethernet
adapter could trigger starting a DHCP client and an additional default
route for failover to an additional upstream.
This commit is contained in:
Peter Collingbourne
2026-05-03 00:37:12 -07:00
parent d0376d4101
commit 33f2a93489
2 changed files with 5 additions and 1 deletions

View File

@@ -3,6 +3,8 @@
writeFennel,
runCommand,
anoia,
lualinux,
s6-rc-up-tree,
}:
runCommand "ifwait" { } ''
mkdir -p $out/bin
@@ -10,7 +12,9 @@ runCommand "ifwait" { } ''
writeFennel "ifwait" {
packages = [
anoia
lualinux
netlink-lua
s6-rc-up-tree
];
} ./ifwait.fnl
} $out/bin/ifwait

View File

@@ -37,7 +37,7 @@
(when (not (= up wanted?))
(set up
(if wanted?
(pcall system (.. "s6-rc -b -u change " service))
(pcall system (.. "s6-rc-up-tree " service))
(not (pcall system (.. "s6-rc -b -d change " service)))))
))