e9ff5b1460bcef3c071aa62f7b8ecd6f631d7a88
[project/luci.git] / modules / luci-mod-admin-full / luasrc / model / cbi / admin_system / ipkg.lua
1 --[[
2 LuCI - Lua Configuration Interface
3
4 Copyright 2008 Steven Barth <steven@midlink.org>
5 Copyright 2008-2011 Jo-Philipp Wich <xm@subsignal.org>
6
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11         http://www.apache.org/licenses/LICENSE-2.0
12
13 $Id$
14 ]]--
15
16 local ipkgfile = "/etc/opkg.conf"
17
18 f = SimpleForm("ipkgconf", translate("OPKG-Configuration"))
19
20 f:append(Template("admin_system/ipkg"))
21
22 t = f:field(TextValue, "lines")
23 t.rows = 10
24 function t.cfgvalue()
25         return nixio.fs.readfile(ipkgfile) or ""
26 end
27
28 function t.write(self, section, data)
29         return nixio.fs.writefile(ipkgfile, data:gsub("\r\n", "\n"))
30 end
31
32 function f.handle(self, state, data)
33         return true
34 end
35
36 return f