11 Copyright 2008 Steven Barth <steven@midlink.org>
13 Licensed under the Apache License, Version 2.0 (the "License");
14 you may not use this file except in compliance with the License.
15 You may obtain a copy of the License at
17 http://www.apache.org/licenses/LICENSE-2.0
19 Unless required by applicable law or agreed to in writing, software
20 distributed under the License is distributed on an "AS IS" BASIS,
21 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 See the License for the specific language governing permissions and
23 limitations under the License.
26 module("ffluci.model.uci", package.seeall)
28 -- Test whether to load libuci-Wrapper or /sbin/uci-Wrapper
29 if pcall(require, "uci") then
30 Session = require("ffluci.model.uci.libuci").Session
32 Session = require("ffluci.model.uci.wrapper").Session
35 -- The default Session
36 local default = Session()
37 local state = Session("/var/state")
40 function StateSession()
45 -- Wrapper for "uci add"
47 return default:add(...)
51 -- Wrapper for "uci changes"
53 return default:changes(...)
57 -- Wrapper for "uci commit"
59 return default:commit(...)
63 -- Wrapper for "uci del"
65 return default:del(...)
69 -- Wrapper for "uci get"
71 return default:get(...)
75 -- Wrapper for "uci revert"
77 return default:revert(...)
81 -- Wrapper for "uci show"
82 function sections(...)
83 return default:sections(...)
87 -- Wrapper for "uci set"
89 return default:set(...)