Skip to content
Snippets Groups Projects
300-gluon-client-bridge-network 560 B
Newer Older
#!/usr/bin/lua

local sysconfig = require 'gluon.sysconfig'
local uci = require('luci.model.uci').cursor()


if not uci:get('network', 'client') then
  uci:section('network', 'interface', 'client',
    {
      type = 'bridge',
    }
  )
end

local ifname = uci:get('network', 'client', 'ifname')

if type(ifname) == 'string' then
  uci:delete('network', 'client', 'ifname')
  for x in ifname:gmatch("[^%s]+") do
    uci:add_to_set('network', 'client', 'ifname', x)
  end
end

uci:set('network', 'client', 'macaddr', sysconfig.primary_mac)

uci:save('network')