gluon-core: commit all UCI configs at the end

Avoid commiting configs inbetween to decrease number of flash writes.

Fixes #714.
This commit is contained in:
Matthias Schiffer 2016-04-02 18:54:33 +02:00
parent 827d81aab3
commit 4658afb2c6
35 changed files with 3 additions and 44 deletions

View File

@ -16,4 +16,3 @@ c:section('alfred', 'alfred', 'alfred',
)
c:save('alfred')
c:commit('alfred')

View File

@ -40,7 +40,6 @@ end
c:set('autoupdater', 'settings', 'version_file', '/lib/gluon/release')
c:save('autoupdater')
c:commit('autoupdater')
local autoupdater_util = require 'autoupdater.util'

View File

@ -24,4 +24,3 @@ end
uci:set('network', 'client', 'macaddr', sysconfig.primary_mac)
uci:save('network')
uci:commit('network')

View File

@ -45,4 +45,3 @@ end
util.iterate_radios(configure_radio)
uci:save('wireless')
uci:commit('wireless')

View File

@ -32,5 +32,4 @@ if not (sysconfig.lan_ifname or sysconfig.wan_ifname) then
uci:delete('network', 'wan')
uci:save('network')
uci:commit('network')
end

View File

@ -14,5 +14,4 @@ if not sysconfig.gluon_version then
uci:set('system', system, 'timezone', site.timezone)
uci:save('system')
uci:commit('system')
end

View File

@ -53,7 +53,6 @@ uci:section('network', 'route6', 'wan6_unreachable',
)
uci:save('network')
uci:commit('network')
uci:section('firewall', 'rule', 'wan_igmp',
@ -79,7 +78,6 @@ uci:section('firewall', 'rule', 'wan_mld',
)
uci:save('firewall')
uci:commit('firewall')
sysctl.set('net.ipv6.conf.all.accept_ra', 0)

View File

@ -11,4 +11,3 @@ local c = uci.cursor()
c:delete('system', 'ntp', 'server')
c:set_list('system', 'ntp', 'server', site.ntp_servers)
c:save('system')
c:commit('system')

View File

@ -27,4 +27,3 @@ c:section('firewall', 'rule', 'wan_ssh',
)
c:save('firewall')
c:commit('firewall')

View File

@ -33,4 +33,3 @@ end
util.iterate_radios(configure_radio)
uci:save('wireless')
uci:commit('wireless')

View File

@ -0,0 +1,3 @@
#!/bin/sh
uci commit

View File

@ -34,7 +34,6 @@ if sysconfig.gluon_version == 'legacy' then
uci:delete('network', 'wan')
uci:save('network')
uci:commit('network')
end

View File

@ -20,5 +20,4 @@ if sysconfig.gluon_version == 'legacy' then
uci:delete_all('wireless', 'wifi-iface', delete_legacy_iface)
uci:save('wireless')
uci:commit('wireless')
end

View File

@ -12,9 +12,7 @@ if sysconfig.gluon_version == 'legacy' then
if old == '1' then
local setup_mode = uci:get_first('gluon-setup-mode', 'setup_mode')
uci:set('gluon-setup-mode', setup_mode, 'configured', '1')
uci:save('gluon-setup-mode')
uci:commit('gluon-setup-mode')
break
end

View File

@ -21,7 +21,6 @@ if sysconfig.gluon_version == 'legacy' then
)
uci:save('simple-tc')
uci:commit('simple-tc')
break
end

View File

@ -33,5 +33,4 @@ if sysconfig.gluon_version == 'legacy' then
end
uci:save('fastd')
uci:commit('fastd')
end

View File

@ -45,4 +45,3 @@ end
uci:save('network')
uci:commit('network')

View File

@ -45,4 +45,3 @@ end
uci:save('network')
uci:commit('network')

View File

@ -7,5 +7,4 @@ local uci = require('luci.model.uci').cursor()
-- fix up duplicate mac addresses (for mesh-on-WAN)
uci:set('network', 'wan', 'macaddr', util.generate_mac(1, 0))
uci:save('network')
uci:commit('network')

View File

@ -24,7 +24,6 @@ uci:section('batman-adv', 'mesh', 'bat0',
}
)
uci:save('batman-adv')
uci:commit('batman-adv')
if not uci:get('network', 'client', 'ifname') then
uci:add_to_set('network', 'client', 'ifname', 'bat0')
@ -53,7 +52,6 @@ uci:section('network', 'interface', 'bat0',
)
uci:save('network')
uci:commit('network')
uci:delete('firewall', 'client')
@ -77,7 +75,6 @@ uci:section('firewall', 'rule', 'client_dns',
)
uci:save('firewall')
uci:commit('firewall')
local dnsmasq = uci:get_first('dhcp', 'dnsmasq')
@ -94,7 +91,6 @@ uci:section('dhcp', 'dhcp', 'client',
)
uci:save('dhcp')
uci:commit('dhcp')
sysctl.set('net.ipv6.conf.br-client.forwarding', 0)

View File

@ -131,5 +131,3 @@ util.iterate_radios(configure_radio)
uci:save('wireless')
uci:save('network')
uci:commit('wireless')
uci:commit('network')

View File

@ -16,4 +16,3 @@ if not c:get('network', 'mesh_wan') then
end
c:save('network')
c:commit('network')

View File

@ -33,5 +33,4 @@ if sysconfig.lan_ifname and not uci:get('network', 'mesh_lan') then
})
uci:save('network')
uci:commit('network')
end

View File

@ -6,5 +6,4 @@ if uci:get('system', 'rssid_wlan0') then
uci:set('system', 'rssid_wlan0', 'dev', 'mesh0')
uci:save('system')
uci:commit('system')
end

View File

@ -119,7 +119,6 @@ add_groups('mesh_vpn', site.fastd_mesh_vpn.groups)
uci:save('fastd')
uci:commit('fastd')
uci:section('network', 'interface', 'mesh_vpn',
@ -133,7 +132,6 @@ uci:section('network', 'interface', 'mesh_vpn',
)
uci:save('network')
uci:commit('network')
uci:section('firewall', 'include', 'mesh_vpn_dns',
@ -145,4 +143,3 @@ uci:section('firewall', 'include', 'mesh_vpn_dns',
)
uci:save('firewall')
uci:commit('firewall')

View File

@ -9,5 +9,4 @@ local secret = c:get("fastd", "mesh_vpn", "secret")
if not secret or not secret:match(("%x"):rep(64)) then
c:set("fastd", "mesh_vpn", "secret", "generate")
c:save("fastd")
c:commit("fastd")
end

View File

@ -28,5 +28,4 @@ if not uci:get('simple-tc', 'mesh_vpn') then
uci:section('simple-tc', 'interface', 'mesh_vpn', config)
uci:save('simple-tc')
uci:commit('simple-tc')
end

View File

@ -17,4 +17,3 @@ uci:section('firewall', 'rule', 'wan_respondd_reply',
)
uci:save('firewall')
uci:commit('firewall')

View File

@ -39,7 +39,6 @@ c:section('network', 'route6', 'local_node_route6',
)
c:save('network')
c:commit('network')
c:delete('firewall', 'local_node')
c:section('firewall', 'zone', 'local_node',
@ -52,4 +51,3 @@ c:section('firewall', 'zone', 'local_node',
}
)
c:save('firewall')
c:commit('firewall')

View File

@ -7,5 +7,4 @@ local config = 'gluon-node-info'
if not uci:get_first(config, 'system') then
uci:section(config, 'system')
uci:save(config)
uci:commit(config)
end

View File

@ -15,5 +15,4 @@ end
if not role then
uci:set(config, uci:get_first(config, 'system'), 'role', default_role)
uci:save(config)
uci:commit(config)
end

View File

@ -29,4 +29,3 @@ uci:section('firewall', 'rule', 'client_respondd',
)
uci:save('firewall')
uci:commit('firewall')

View File

@ -11,6 +11,5 @@ if site.setup_mode
local name = c:get_first("gluon-setup-mode", "setup_mode")
c:set("gluon-setup-mode", name, "configured", 1)
c:save('gluon-setup-mode')
c:commit('gluon-setup-mode')
end

View File

@ -12,7 +12,6 @@ if old == '1' then
c:set('gluon-setup-mode', setup_mode, 'configured', '1')
c:save('gluon-setup-mode')
c:commit('gluon-setup-mode')
end
os.remove('/etc/config/gluon-config-mode')

View File

@ -10,6 +10,4 @@ uci batch <<-EOF
set uhttpd.main.home=/lib/gluon/status-page/www
set uhttpd.main.max_requests=32
commit uhttpd
EOF