delete.lua.svn-base

来自「嵌入式无线路由系统openwrt的web配置工具」· SVN-BASE 代码 · 共 53 行

SVN-BASE
53
字号
#!/usr/bin/lua-- Copyright (C) 2008 OpenRB.comrequire('fslib')data = datajson() or {}file = 'network'-- make sure that ifname is passedif (data['id'] ~= nil) then  ifname = data['id']  uci.init(file)  -- bridge interface found  if (ifname:find('^br--')) then    cfgname = ifname:gsub('^br--', '')    -- get list of interfaces from brctl    brigdes = proc('br-json')    -- put bridge down        os.execute('ifconfig ' .. ifname .. ' down')    -- put bridged ifaces down and remove them from bridge    if (brigdes ~= nil and brigdes[ ifname ]) then      ifnames = brigdes[ ifname ]['ifnames']      iflist = {}      cfg = uci.get_all(file)      for icfgname, options in pairs(cfg) do        if (options['type'] ~= 'bridge') then          iflist[ options['ifname'] ] = icfgname        end      end      for _, brifname in ipairs(ifnames) do        icfgname = iflist[ brifname ]        if (icfgname ~= nil) then          uci.delete(file, icfgname, 'bridged')        end        os.execute('ifconfig ' .. brifname .. ' down')        os.execute('brctl delif ' .. ifname .. ' ' .. brifname)      end    end    -- delete bridge    os.execute('brctl delbr ' .. ifname)    -- drop bridge configs    uci.delete(file, cfgname)    uci.commit(file)  endend

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?