move service state out of s6 scandir

getting weird permission errors, seems simpler all raound just to
put them somewhere else
This commit is contained in:
Daniel Barlow 2022-09-25 21:10:04 +01:00
parent 1d9f39bf87
commit 3677ab9cb3
2 changed files with 10 additions and 8 deletions

View file

@ -88,6 +88,6 @@ in {
}; };
services = { services = {
inherit longrun oneshot bundle target; inherit longrun oneshot bundle target;
output = service: name: "/run/s6-rc/scandir/${service.name}/data/outputs/${name}"; output = service: name: "/run/service-state/${service.name}/${name}";
}; };
} }

View file

@ -5,15 +5,19 @@
} : } :
let let
inherit (liminix.services) longrun; inherit (liminix.services) longrun;
in
interface: { ... } @ args:
let
name = "${interface.device}.udhcp";
script = writeShellScript "udhcp-notify" '' script = writeShellScript "udhcp-notify" ''
action=$1 action=$1
env > /run/udhcp.values
set_address() { set_address() {
ip address replace $ip/$mask dev $interface ip address replace $ip/$mask dev $interface
mkdir -p data/outputs dir=/run/service-state/${name}.service/
mkdir -p $dir
for i in lease mask ip router siaddr dns serverid subnet opt53 interface ; do for i in lease mask ip router siaddr dns serverid subnet opt53 interface ; do
echo ''${!i} > data/outputs/$i echo ''${!i} > $dir/$i
done done
} }
case $action in case $action in
@ -33,10 +37,8 @@ case $action in
;; ;;
esac esac
''; '';
in longrun {
in inherit name;
interface: { ... } @ args: longrun {
name = "${interface.device}.udhcp";
run = "${busybox}/bin/udhcpc -f -i ${interface.device} -s ${script}"; run = "${busybox}/bin/udhcpc -f -i ${interface.device} -s ${script}";
} }