123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #!/usr/bin/lua
- local uci = require('simple-uci').cursor()
- local enabled
- if uci:get('autoupdater-wifi-fallback', 'settings') then
- enabled = uci:get_bool('autoupdater-wifi-fallback', 'settings', 'enabled')
- uci:delete('autoupdater-wifi-fallback', 'settings')
- else
- enabled = uci:get_bool('autoupdater', 'settings', 'enabled')
- end
- uci:section('autoupdater-wifi-fallback', 'autoupdater-wifi-fallback', 'settings',{
- enabled = enabled,
- })
- uci:delete('wireless', 'fallback')
- uci:delete('network', 'fallback')
- uci:delete('network', 'fallback6')
- uci:section('network', 'interface', 'fallback',{
- proto = 'dhcp',
- peerdns = true,
- sourcefilter = false,
- })
- uci:section('network', 'interface', 'fallback6',{
- ifname = '@fallback',
- proto = 'dhcpv6',
- peerdns = true,
- sourcefilter = false,
- })
- uci:save('autoupdater-wifi-fallback')
- uci:save('network')
- uci:save('wireless')
- local file = io.open('/usr/lib/micron.d/autoupdater', 'r')
- local content = file:read "*a"
- local minute = tonumber(content:match('^([0-9][0-9]?)%s'))
- file:close()
- minute = (minute + 10) % 60
- local f = io.open('/usr/lib/micron.d/autoupdater-wifi-fallback', 'w')
- f:write(string.format('%i * * * * /usr/sbin/autoupdater-wifi-fallback\n', minute))
- f:close()
|