2015-01-16 22:38:38 +00:00
|
|
|
-- Copyright 2008 Steven Barth <steven@midlink.org>
|
2015-01-16 22:46:42 +00:00
|
|
|
-- Copyright 2008-2011 Jo-Philipp Wich <jow@openwrt.org>
|
2015-01-16 22:38:38 +00:00
|
|
|
-- Licensed to the public under the Apache License 2.0.
|
2011-10-24 01:10:34 +00:00
|
|
|
|
|
|
|
local ipkgfile = "/etc/opkg.conf"
|
2015-09-15 10:01:03 +00:00
|
|
|
local distfeeds = "/etc/opkg/distfeeds.conf"
|
|
|
|
local customfeeds = "/etc/opkg/customfeeds.conf"
|
2008-08-14 17:16:56 +00:00
|
|
|
|
2015-09-15 10:01:03 +00:00
|
|
|
f = SimpleForm("ipkgconf", translate("OPKG-Configuration"), translate("General options for opkg"))
|
2008-08-14 17:16:56 +00:00
|
|
|
|
2011-10-24 01:10:34 +00:00
|
|
|
f:append(Template("admin_system/ipkg"))
|
|
|
|
|
2008-08-14 17:16:56 +00:00
|
|
|
t = f:field(TextValue, "lines")
|
2015-09-18 07:24:58 +00:00
|
|
|
t.wrap = "off"
|
2008-08-14 17:16:56 +00:00
|
|
|
t.rows = 10
|
|
|
|
function t.cfgvalue()
|
2009-07-19 00:24:58 +00:00
|
|
|
return nixio.fs.readfile(ipkgfile) or ""
|
2008-08-14 17:16:56 +00:00
|
|
|
end
|
|
|
|
|
2009-01-16 18:18:29 +00:00
|
|
|
function t.write(self, section, data)
|
2009-07-19 00:24:58 +00:00
|
|
|
return nixio.fs.writefile(ipkgfile, data:gsub("\r\n", "\n"))
|
2009-01-16 18:18:29 +00:00
|
|
|
end
|
|
|
|
|
2008-08-14 17:16:56 +00:00
|
|
|
function f.handle(self, state, data)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2015-09-15 10:01:03 +00:00
|
|
|
g = SimpleForm("distfeedconf", translate("Distribution feeds"),
|
|
|
|
translate("Build/distribution specific feed definitions. This file will NOT be preserved in any sysupgrade."))
|
|
|
|
|
|
|
|
d = g:field(TextValue, "lines2")
|
2015-09-18 07:24:58 +00:00
|
|
|
d.wrap = "off"
|
2015-09-15 10:01:03 +00:00
|
|
|
d.rows = 10
|
|
|
|
function d.cfgvalue()
|
|
|
|
return nixio.fs.readfile(distfeeds) or ""
|
|
|
|
end
|
|
|
|
|
|
|
|
function d.write(self, section, data)
|
|
|
|
return nixio.fs.writefile(distfeeds, data:gsub("\r\n", "\n"))
|
|
|
|
end
|
|
|
|
|
|
|
|
function g.handle(self, state, data)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
h = SimpleForm("customfeedconf", translate("Custom feeds"),
|
|
|
|
translate("Custom feed definitions, e.g. private feeds. This file can be preserved in a sysupgrade."))
|
|
|
|
|
|
|
|
c = h:field(TextValue, "lines3")
|
2015-09-18 07:24:58 +00:00
|
|
|
c.wrap = "off"
|
2015-09-15 10:01:03 +00:00
|
|
|
c.rows = 10
|
|
|
|
function c.cfgvalue()
|
|
|
|
return nixio.fs.readfile(customfeeds) or ""
|
|
|
|
end
|
|
|
|
|
|
|
|
function c.write(self, section, data)
|
|
|
|
return nixio.fs.writefile(customfeeds, data:gsub("\r\n", "\n"))
|
|
|
|
end
|
|
|
|
|
|
|
|
function h.handle(self, state, data)
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
|
|
|
return f, g, h
|