pkgs/ap: uci delete silently and don't abort

This commit is contained in:
Astro 2021-11-09 21:16:37 +01:00
parent 311df51820
commit d9443fc374
1 changed files with 8 additions and 8 deletions

View File

@ -202,15 +202,15 @@ in ''
uci set network.mgmt.gateway=${config.site.net.mgmt.hosts4.mgmt-gw} uci set network.mgmt.gateway=${config.site.net.mgmt.hosts4.mgmt-gw}
uci set network.mgmt.ip6addr=${config.site.net.mgmt.hosts6.dn42.${hostName}}/64 uci set network.mgmt.ip6addr=${config.site.net.mgmt.hosts6.dn42.${hostName}}/64
uci set network.mgmt.ip6gw=${config.site.net.mgmt.hosts6.dn42.mgmt-gw} uci set network.mgmt.ip6gw=${config.site.net.mgmt.hosts6.dn42.mgmt-gw}
uci delete network.mgmt.dns uci -q delete network.mgmt.dns || true
uci add_list network.mgmt.dns=${config.site.net.serv.hosts4.dnscache} uci add_list network.mgmt.dns=${config.site.net.serv.hosts4.dnscache}
uci add_list network.mgmt.dns=${config.site.net.serv.hosts6.dn42.dnscache} uci add_list network.mgmt.dns=${config.site.net.serv.hosts6.dn42.dnscache}
uci delete network.globals.ula_prefix uci -q delete network.globals.ula_prefix || true
# delete unused networks # delete unused networks
${concatMapStrings (net: ${concatMapStrings (net:
lib.optionalString (! hostConfig.interfaces ? ${net}) '' lib.optionalString (! hostConfig.interfaces ? ${net}) ''
uci delete network.${net} uci -q delete network.${net} || true
'' ''
) ([ "lan" "wan" "wan6" ] ++ builtins.attrNames config.site.net)} ) ([ "lan" "wan" "wan6" ] ++ builtins.attrNames config.site.net)}
@ -227,8 +227,8 @@ in ''
'') (builtins.attrNames hostConfig.interfaces) '') (builtins.attrNames hostConfig.interfaces)
} }
uci delete wireless.default_radio0 uci -q delete wireless.default_radio0 || true
uci delete wireless.default_radio1 uci -q delete wireless.default_radio1 || true
${concatStrings (imap0 (index: path: ${concatStrings (imap0 (index: path:
let let
radioConfig = hostConfig.wifi.${path}; radioConfig = hostConfig.wifi.${path};
@ -243,7 +243,7 @@ in ''
uci set wireless.radio${toString index}.path=${path} uci set wireless.radio${toString index}.path=${path}
uci set wireless.radio${toString index}.htmode=${radioConfig.htmode} uci set wireless.radio${toString index}.htmode=${radioConfig.htmode}
uci set wireless.radio${toString index}.noscan=1 uci set wireless.radio${toString index}.noscan=1
uci delete wireless.radio${toString index}.disabled uci -q delete wireless.radio${toString index}.disabled || true
${concatMapStrings (ssid: ${concatMapStrings (ssid:
let let
@ -263,7 +263,7 @@ in ''
'' ''
else '' else ''
uci set wireless.@wifi-iface[-1].encryption=none uci set wireless.@wifi-iface[-1].encryption=none
uci delete wireless.@wifi-iface[-1].key uci -q delete wireless.@wifi-iface[-1].key || true
''} ''}
'' ''
@ -307,7 +307,7 @@ in ''
/etc/init.d/cron restart /etc/init.d/cron restart
for svc in dnsmasq uhttpd ; do for svc in dnsmasq uhttpd ; do
rm /etc/rc.d/*\$svc rm -f /etc/rc.d/*\$svc
/etc/init.d/\$svc stop /etc/init.d/\$svc stop
done done