1
0
forked from dan/liminix

provide stdout to ppp callback scripts

pppd runs them with 0,1,2 => /dev/null but we actually quite like
seeing errors in the logs
This commit is contained in:
Daniel Barlow 2024-10-17 21:37:08 +01:00
parent 1bca072509
commit 1f7d6544e3

View File

@ -15,25 +15,26 @@ let
inherit (builtins) toJSON toString typeOf;
ip-up = writeAshScript "ip-up" {} ''
exec >&5 2>&5
. ${serviceFns}
(in_outputs ${name}
echo $1 > ifname
echo $2 > tty
echo $3 > speed
echo $4 > address
echo $5 > peer-address
echo $DNS1 > ns1
echo $DNS2 > ns2
)
echo >/proc/self/fd/10
in_outputs ${name}
echo $1 > ifname
echo $2 > tty
echo $3 > speed
echo $4 > address
echo $5 > peer-address
set +o nounset
if test -n "''${DNS1}" ;then echo ''${DNS1} > ns1 ; fi
if test -n "''${DNS2}" ;then echo ''${DNS2} > ns2 ; fi
test -e ipv6-address && echo >/proc/self/fd/10
'';
ip6-up = writeAshScript "ip6-up" {} ''
exec >&5 2>&5
. ${serviceFns}
(in_outputs ${name}
echo $4 > ipv6-address
echo $5 > ipv6-peer-address
)
test -e tty && echo >/proc/self/fd/10
in_outputs ${name}
echo $4 > ipv6-address
echo $5 > ipv6-peer-address
test -e ifname && echo >/proc/self/fd/10
'';
literal_or_output =
let v = o: ({
@ -72,6 +73,7 @@ let
chmod 0700 /run/${name}
in_outputs ${name}
echo ${escapeShellArgs ppp-options'} | ${output-template}/bin/output-template '{{' '}}' > /run/${name}/ppp-options
fdmove -c 5 2 \
${command}
'';
notification-fd = 10;