summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/luasrc/model/ipkg.lua15
-rw-r--r--modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/ipkg.lua40
-rw-r--r--modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm7
-rw-r--r--modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua12
4 files changed, 58 insertions, 16 deletions
diff --git a/modules/luci-base/luasrc/model/ipkg.lua b/modules/luci-base/luasrc/model/ipkg.lua
index 41633c43d7..2ed92ca706 100644
--- a/modules/luci-base/luasrc/model/ipkg.lua
+++ b/modules/luci-base/luasrc/model/ipkg.lua
@@ -127,15 +127,15 @@ local function _list(action, pat, cb)
(pat and (" '%s'" % pat:gsub("'", "")) or ""))
if fd then
- local name, version, desc
+ local name, version, sz, desc
while true do
local line = fd:read("*l")
if not line then break end
- name, version, desc = line:match("^(.-) %- (.-) %- (.+)")
+ name, version, sz, desc = line:match("^(.-) %- (.-) %- (.-) %- (.+)")
if not name then
- name, version = line:match("^(.-) %- (.+)")
+ name, version, sz = line:match("^(.-) %- (.-) %- (.+)")
desc = ""
end
@@ -143,10 +143,11 @@ local function _list(action, pat, cb)
version = version:sub(1,21) .. ".." .. version:sub(-3,-1)
end
- cb(name, version, desc)
+ cb(name, version, sz, desc)
name = nil
version = nil
+ sz = nil
desc = nil
end
@@ -155,15 +156,15 @@ local function _list(action, pat, cb)
end
function list_all(pat, cb)
- _list("list", pat, cb)
+ _list("list --size", pat, cb)
end
function list_installed(pat, cb)
- _list("list_installed", pat, cb)
+ _list("list_installed --size", pat, cb)
end
function find(pat, cb)
- _list("find", pat, cb)
+ _list("find --size", pat, cb)
end
diff --git a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/ipkg.lua b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/ipkg.lua
index 2f3c4927b3..b01b5dbb3e 100644
--- a/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/ipkg.lua
+++ b/modules/luci-mod-admin-full/luasrc/model/cbi/admin_system/ipkg.lua
@@ -3,8 +3,10 @@
-- 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"))
+f = SimpleForm("ipkgconf", translate("OPKG-Configuration"), translate("General options for opkg"))
f:append(Template("admin_system/ipkg"))
@@ -22,4 +24,38 @@ function f.handle(self, state, data)
return true
end
-return f
+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.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.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
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm b/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm
index 1ceda47852..fe2fe04366 100644
--- a/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm
+++ b/modules/luci-mod-admin-full/luasrc/view/admin_system/packages.htm
@@ -132,7 +132,7 @@ end
<th class="cbi-section-table-cell" style="text-align:left"><%:Package name%></th>
<th class="cbi-section-table-cell" style="text-align:left"><%:Version%></th>
</tr>
- <% local empty = true; luci.model.ipkg.list_installed(querypat, function(n, v, d) empty = false; filter[n] = true %>
+ <% local empty = true; luci.model.ipkg.list_installed(querypat, function(n, v, s, d) empty = false; filter[n] = true %>
<tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>">
<td style="text-align:left; width:10%"><a onclick="return window.confirm('<%:Remove%> &quot;<%=luci.util.pcdata(n)%>&quot; ?')" href="<%=REQUEST_URI%>?submit=1&amp;remove=<%=luci.util.pcdata(n)%>"><%:Remove%></a></td>
<td style="text-align:left"><%=luci.util.pcdata(n)%></td>
@@ -164,13 +164,15 @@ end
<th class="cbi-section-table-cell" style="text-align:left">&#160;</th>
<th class="cbi-section-table-cell" style="text-align:left"><%:Package name%></th>
<th class="cbi-section-table-cell" style="text-align:left"><%:Version%></th>
+ <th class="cbi-section-table-cell" style="text-align:right"><%:Size (.ipk)%></th>
<th class="cbi-section-table-cell" style="text-align:left"><%:Description%></th>
</tr>
- <% local empty = true; opkg_list(querypat or letterpat, function(n, v, d) if filter[n] then return end; empty = false %>
+ <% local empty = true; opkg_list(querypat or letterpat, function(n, v, s, d) if filter[n] then return end; empty = false %>
<tr class="cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>">
<td style="text-align:left; width:10%"><a onclick="return window.confirm('<%:Install%> &quot;<%=luci.util.pcdata(n)%>&quot; ?')" href="<%=REQUEST_URI%>?submit=1&amp;install=<%=luci.util.pcdata(n)%>"><%:Install%></a></td>
<td style="text-align:left"><%=luci.util.pcdata(n)%></td>
<td style="text-align:left"><%=luci.util.pcdata(v)%></td>
+ <td style="text-align:right"><%=luci.util.pcdata(s)%></td>
<td style="text-align:left"><%=luci.util.pcdata(d)%></td>
</tr>
<% end) %>
@@ -179,6 +181,7 @@ end
<td style="text-align:left">&#160;</td>
<td style="text-align:left"><em><%:none%></em></td>
<td style="text-align:left"><em><%:none%></em></td>
+ <td style="text-align:right"><em><%:none%></em></td>
<td style="text-align:left"><em><%:none%></em></td>
</tr>
<% end %>
diff --git a/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua b/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua
index 6f78643018..60caadb4b1 100644
--- a/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua
+++ b/modules/luci-mod-failsafe/luasrc/controller/failsafe/failsafe.lua
@@ -84,11 +84,13 @@ function action_flashops()
fp = io.open(image_tmp, "w")
end
end
- if chunk then
- fp:write(chunk)
- end
- if eof then
- fp:close()
+ if fp then
+ if chunk then
+ fp:write(chunk)
+ end
+ if eof then
+ fp:close()
+ end
end
end
)