modules/admin-full: display raw opkg output, the error codes are useless with recent versions
This commit is contained in:
parent
307f307a8e
commit
e88fd858a1
2 changed files with 27 additions and 23 deletions
|
@ -47,6 +47,9 @@ function action_packages()
|
||||||
local changes = false
|
local changes = false
|
||||||
local install = { }
|
local install = { }
|
||||||
local remove = { }
|
local remove = { }
|
||||||
|
local stdout = { "" }
|
||||||
|
local stderr = { "" }
|
||||||
|
local out, err
|
||||||
|
|
||||||
-- Search query
|
-- Search query
|
||||||
local query = luci.http.formvalue("query")
|
local query = luci.http.formvalue("query")
|
||||||
|
@ -65,19 +68,25 @@ function action_packages()
|
||||||
|
|
||||||
-- Do install
|
-- Do install
|
||||||
if ninst then
|
if ninst then
|
||||||
_, install[ninst] = ipkg.install(ninst)
|
install[ninst], out, err = ipkg.install(ninst)
|
||||||
|
stdout[#stdout+1] = out
|
||||||
|
stderr[#stderr+1] = err
|
||||||
changes = true
|
changes = true
|
||||||
end
|
end
|
||||||
|
|
||||||
if uinst then
|
if uinst then
|
||||||
_, install[uinst] = ipkg.install(uinst)
|
install[uinst], out, err = ipkg.install(uinst)
|
||||||
|
stdout[#stdout+1] = out
|
||||||
|
stderr[#stderr+1] = err
|
||||||
changes = true
|
changes = true
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Remove packets
|
-- Remove packets
|
||||||
local rem = submit and luci.http.formvalue("remove")
|
local rem = submit and luci.http.formvalue("remove")
|
||||||
if rem then
|
if rem then
|
||||||
_, remove[rem] = ipkg.remove(rem)
|
remove[rem], out, err = ipkg.remove(rem)
|
||||||
|
stdout[#stdout+1] = out
|
||||||
|
stderr[#stderr+1] = err
|
||||||
changes = true
|
changes = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -85,19 +94,29 @@ function action_packages()
|
||||||
-- Update all packets
|
-- Update all packets
|
||||||
local update = luci.http.formvalue("update")
|
local update = luci.http.formvalue("update")
|
||||||
if update then
|
if update then
|
||||||
_, update = ipkg.update()
|
update, out, err = ipkg.update()
|
||||||
|
stdout[#stdout+1] = out
|
||||||
|
stderr[#stderr+1] = err
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Upgrade all packets
|
-- Upgrade all packets
|
||||||
local upgrade = luci.http.formvalue("upgrade")
|
local upgrade = luci.http.formvalue("upgrade")
|
||||||
if upgrade then
|
if upgrade then
|
||||||
_, upgrade = ipkg.upgrade()
|
upgrade, out, err = ipkg.upgrade()
|
||||||
|
stdout[#stdout+1] = out
|
||||||
|
stderr[#stderr+1] = err
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
luci.template.render("admin_system/packages", {
|
luci.template.render("admin_system/packages", {
|
||||||
query=query, install=install, remove=remove, update=update, upgrade=upgrade
|
query = query,
|
||||||
|
install = install,
|
||||||
|
remove = remove,
|
||||||
|
update = update,
|
||||||
|
upgrade = upgrade,
|
||||||
|
stdout = table.concat(stdout, ""),
|
||||||
|
stderr = table.concat(stderr, "")
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Remove index cache
|
-- Remove index cache
|
||||||
|
|
|
@ -24,11 +24,6 @@ function rowstyle()
|
||||||
return (rowcnt % 2) + 1
|
return (rowcnt % 2) + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
function opkg_error(code)
|
|
||||||
code = bit.rshift(tonumber(code), 8)
|
|
||||||
return translate("OPKG error code %i" % code)
|
|
||||||
end
|
|
||||||
|
|
||||||
local fstat = fs.statvfs(opkg.overlay_root())
|
local fstat = fs.statvfs(opkg.overlay_root())
|
||||||
local space_total = fstat and fstat.blocks or 0
|
local space_total = fstat and fstat.blocks or 0
|
||||||
local space_free = fstat and fstat.bfree or 0
|
local space_free = fstat and fstat.bfree or 0
|
||||||
|
@ -80,18 +75,8 @@ local filter = { }
|
||||||
|
|
||||||
<% if (install and next(install)) or (remove and next(remove)) or update or upgrade then %>
|
<% if (install and next(install)) or (remove and next(remove)) or update or upgrade then %>
|
||||||
<br /><hr /><br />
|
<br /><hr /><br />
|
||||||
<% if update then %>
|
<% if #stdout > 0 then %><pre><%=pcdata(stdout)%></pre><% end %>
|
||||||
<%:Package lists updated%>: <% if update == 0 then %><span class="ok"><%:OK%></span><% else %><span class="error"><%:Error%> (<%=opkg_error(update)%>)</span><% end %><br />
|
<% if #stderr > 0 then %><pre class="error"><%=pcdata(stderr)%></pre><% end %>
|
||||||
<% end %>
|
|
||||||
<% if upgrade then%>
|
|
||||||
<%:Upgrade installed packages%>: <% if upgrade == 0 then %><span class="ok"><%:OK%></span><% else %><span class="error"><%:Error%> (<%=opkg_error(upgrade)%>)</span><% end %><br />
|
|
||||||
<% end %>
|
|
||||||
<% if install then for k,v in pairs(install) do %>
|
|
||||||
<%:Install%> '<%=k%>': <% if v == 0 then %><span class="ok"><%:OK%></span><% else %><span class="error"><%:Error%> (<%=opkg_error(v)%>)</span><% end %><br />
|
|
||||||
<% end end %>
|
|
||||||
<% if remove then for k,v in pairs(remove) do %>
|
|
||||||
<%:Remove%> '<%=k%>': <% if v == 0 then %><span class="ok"><%:OK%></span><% else %><span class="error"><%:Error%> (<%=opkg_error(v)%>)</span><% end %><br />
|
|
||||||
<% end end %>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<br />
|
<br />
|
||||||
|
|
Loading…
Reference in a new issue