X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fluci-mod-freifunk%2Fluasrc%2Fmodel%2Fcbi%2Ffreifunk%2Fbasics.lua;h=b08366de6c737c58d35dbd9bb867d959c1cc663b;hb=a3fc4859dd0d3e9e9fa87ca249b815a4710ed7bd;hp=8987b1cb46f636a3eb3b2c61be1cad898356f39b;hpb=1bb4822dca6113f73e3bc89e2acf15935e6f8e92;p=oweals%2Fluci.git diff --git a/modules/luci-mod-freifunk/luasrc/model/cbi/freifunk/basics.lua b/modules/luci-mod-freifunk/luasrc/model/cbi/freifunk/basics.lua index 8987b1cb4..b08366de6 100644 --- a/modules/luci-mod-freifunk/luasrc/model/cbi/freifunk/basics.lua +++ b/modules/luci-mod-freifunk/luasrc/model/cbi/freifunk/basics.lua @@ -1,20 +1,11 @@ ---[[ -LuCI - Lua Configuration Interface - -Copyright 2008 Steven Barth -Copyright 2011 Manuel Munz - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at +-- Copyright 2008 Steven Barth +-- Copyright 2011 Manuel Munz +-- Licensed to the public under the Apache License 2.0. - http://www.apache.org/licenses/LICENSE-2.0 -]] - -local fs = require "luci.fs" +local fs = require "nixio.fs" local util = require "luci.util" local uci = require "luci.model.uci".cursor() -local profiles = "/etc/config/profile_" +local profiles = "/etc/config/profile_*" m = Map("freifunk", translate ("Community")) c = m:section(NamedSection, "community", "public", nil, translate("These are the basic settings for your local wireless community. These settings define the default values for the wizard and DO NOT affect the actual configuration of the router.")) @@ -22,13 +13,10 @@ c = m:section(NamedSection, "community", "public", nil, translate("These are the community = c:option(ListValue, "name", translate ("Community")) community.rmempty = false -local list = { } -local list = fs.glob(profiles .. "*") - -for k,v in ipairs(list) do - local name = uci:get_first(v, "community", "name") or "?" - local n = string.gsub(v, profiles, "") - community:value(n, name) +local profile +for profile in fs.glob(profiles) do + local name = uci:get_first(profile, "community", "name") or "?" + community:value(string.gsub(profile, "/etc/config/profile_", ""), name) end