add in_outputs shell function which ensures umask is set

This commit is contained in:
Daniel Barlow 2023-03-03 23:06:18 +00:00
parent e0ea576674
commit 38756af1c1
5 changed files with 9 additions and 8 deletions

View file

@ -78,7 +78,7 @@
part=$(basename $(dirname $(grep -l art /sys/class/mtd/*/name))) part=$(basename $(dirname $(grep -l art /sys/class/mtd/*/name)))
echo ART partition is ''${part-unset} echo ART partition is ''${part-unset}
test -n "$part" || exit 1 test -n "$part" || exit 1
(cd $(mkoutputs ${name}); umask 0027 (in_outputs ${name}
dd if=/dev/$part of=data iflag=skip_bytes,fullblock bs=${toString size} skip=${toString offset} count=1 dd if=/dev/$part of=data iflag=skip_bytes,fullblock bs=${toString size} skip=${toString offset} count=1
) )
''; '';

View file

@ -19,7 +19,7 @@ let
name = "${interface.device}.pppoe"; name = "${interface.device}.pppoe";
ip-up = writeAshScript "ip-up" {} '' ip-up = writeAshScript "ip-up" {} ''
. ${serviceFns} . ${serviceFns}
(cd $(mkoutputs ${name}); umask 0027 (in_outputs ${name}
echo $1 > ifname echo $1 > ifname
echo $2 > tty echo $2 > tty
echo $3 > speed echo $3 > speed

View file

@ -16,7 +16,7 @@ let
set_address() { set_address() {
ip address replace $ip/$mask dev $interface ip address replace $ip/$mask dev $interface
(cd $(mkoutputs ${name}); umask 0027 (in_outputs ${name}
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} > $i echo ''${!i} > $i
done) done)

View file

@ -7,4 +7,7 @@ writeText "service-fns.sh" ''
mkdir -m 2750 -p $d && chown root:system $d mkdir -m 2750 -p $d && chown root:system $d
echo $d echo $d
} }
in_outputs() {
cd `mkoutputs $1` && umask 0027
}
'' ''

View file

@ -141,10 +141,8 @@ in rec {
}; };
in bundle { in bundle {
name = "bridge-members"; name = "bridge-members";
contents = map addif [ contents = with config.hardware.networkInterfaces; map addif [
config.hardware.networkInterfaces.wlan_24 wlan_24 lan wlan_5
config.hardware.networkInterfaces.lan
config.hardware.networkInterfaces.wlan_5
]; ];
}; };
@ -181,7 +179,7 @@ in rec {
name = "resolvconf"; name = "resolvconf";
up = '' up = ''
. ${serviceFns} . ${serviceFns}
( cd `mkoutputs ${name}`; umask 0027 ( in_outputs ${name}
echo "nameserver $(output ${services.wan} ns1)" > resolv.conf echo "nameserver $(output ${services.wan} ns1)" > resolv.conf
echo "nameserver $(output ${services.wan} ns2)" >> resolv.conf echo "nameserver $(output ${services.wan} ns2)" >> resolv.conf
) )