X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=modules%2Fluci-mod-system%2Fluasrc%2Fmodel%2Fcbi%2Fadmin_system%2Fipkg.lua;fp=modules%2Fluci-mod-system%2Fluasrc%2Fmodel%2Fcbi%2Fadmin_system%2Fipkg.lua;h=7c6d7e1c661ea076e94c98f6321f8b430a5f6ae5;hp=0000000000000000000000000000000000000000;hb=58d97b5e271bc0d7507eab5b9bd2902181864e02;hpb=6ec0353201435e0d0d7d32820d8ba600b4ca7b5b diff --git a/modules/luci-mod-system/luasrc/model/cbi/admin_system/ipkg.lua b/modules/luci-mod-system/luasrc/model/cbi/admin_system/ipkg.lua new file mode 100644 index 0000000000..7c6d7e1c66 --- /dev/null +++ b/modules/luci-mod-system/luasrc/model/cbi/admin_system/ipkg.lua @@ -0,0 +1,64 @@ +-- Copyright 2008 Steven Barth +-- Copyright 2008-2011 Jo-Philipp Wich +-- Licensed to the public under the Apache License 2.0. + +local ipkgfile = "/etc/opkg.conf" +local distfeeds = "/etc/opkg/distfeeds.conf" +local customfeeds = "/etc/opkg/customfeeds.conf" + +f = SimpleForm("ipkgconf", translate("OPKG-Configuration"), translate("General options for opkg")) + +f:append(Template("admin_system/ipkg")) + +t = f:field(TextValue, "lines") +t.wrap = "off" +t.rows = 10 +function t.cfgvalue() + return nixio.fs.readfile(ipkgfile) or "" +end + +function t.write(self, section, data) + return nixio.fs.writefile(ipkgfile, data:gsub("\r\n", "\n")) +end + +function f.handle(self, state, data) + return true +end + +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") +d.wrap = "off" +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") +c.wrap = "off" +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