From 3677ab9cb398bec09270329a6a10b704c280ac1a Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sun, 25 Sep 2022 21:10:04 +0100 Subject: [PATCH] move service state out of s6 scandir getting weird permission errors, seems simpler all raound just to put them somewhere else --- pkgs/liminix-tools/default.nix | 2 +- pkgs/liminix-tools/networking/udhcpc.nix | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/pkgs/liminix-tools/default.nix b/pkgs/liminix-tools/default.nix index 732f554..d66f5f7 100644 --- a/pkgs/liminix-tools/default.nix +++ b/pkgs/liminix-tools/default.nix @@ -88,6 +88,6 @@ in { }; services = { 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}"; }; } diff --git a/pkgs/liminix-tools/networking/udhcpc.nix b/pkgs/liminix-tools/networking/udhcpc.nix index 5ce05a6..81b2a0e 100644 --- a/pkgs/liminix-tools/networking/udhcpc.nix +++ b/pkgs/liminix-tools/networking/udhcpc.nix @@ -5,15 +5,19 @@ } : let inherit (liminix.services) longrun; +in +interface: { ... } @ args: +let + name = "${interface.device}.udhcp"; script = writeShellScript "udhcp-notify" '' action=$1 -env > /run/udhcp.values set_address() { 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 - echo ''${!i} > data/outputs/$i + echo ''${!i} > $dir/$i done } case $action in @@ -33,10 +37,8 @@ case $action in ;; esac ''; - -in -interface: { ... } @ args: longrun { - name = "${interface.device}.udhcp"; +in longrun { + inherit name; run = "${busybox}/bin/udhcpc -f -i ${interface.device} -s ${script}"; }