300-gluon-client-bridge-network 582 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/lua
  2. local sysconfig = require 'gluon.sysconfig'
  3. local uci = require('luci.model.uci').cursor()
  4. if not uci:get('network', 'client') then
  5. uci:section('network', 'interface', 'client',
  6. {
  7. type = 'bridge',
  8. }
  9. )
  10. end
  11. local ifname = uci:get('network', 'client', 'ifname')
  12. if type(ifname) == 'string' then
  13. uci:delete('network', 'client', 'ifname')
  14. for x in ifname:gmatch("[^%s]+") do
  15. uci:add_to_set('network', 'client', 'ifname', x)
  16. end
  17. end
  18. uci:set('network', 'client', 'macaddr', sysconfig.primary_mac)
  19. uci:save('network')
  20. uci:commit('network')