2 LuCI - Lua Configuration Interface
3 Copyright
2008 Steven Barth
<steven@midlink.org
>
4 Copyright
2008-
2010 Jo-Philipp Wich
<xm@subsignal.org
>
6 Licensed under the Apache License, Version
2.0 (the
"License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-
2.0
16 local bit = require
"bit"
17 local opkg = require
"luci.model.ipkg"
18 local fs = require
"nixio.fs"
19 local wa = require
"luci.tools.webadmin"
24 return (rowcnt %
2) +
1
27 local fstat = fs.statvfs(opkg.overlay_root())
28 local space_total = fstat and fstat.blocks or
0
29 local space_free = fstat and fstat.bfree or
0
30 local space_used = space_total - space_free
32 local used_perc = math.floor(
0.5 + ((space_total
> 0) and ((
100 / space_total) * space_used) or
100))
33 local free_byte = space_free * fstat.frsize
39 <h2><a id=
"content" name=
"content"><%:System%
> - <%:Software%
></a></h2>
41 <form method=
"post" action=
"<%=REQUEST_URI%>">
43 <fieldset class=
"cbi-section">
45 <li><a href=
"<%=REQUEST_URI%>/ipkg"><%:Edit package lists and installation targets%
></a></li>
46 <li><a href=
"<%=REQUEST_URI%>?update=1"><%:Update package lists%
></a></li>
49 <fieldset class=
"cbi-section-node">
50 <div class=
"cbi-value">
51 <label class=
"cbi-value-title"><%:Download and install package%
>:
</label>
52 <div class=
"cbi-value-field">
53 <input type=
"text" name=
"url" size=
"30" value=
"" />
54 <input class=
"cbi-button cbi-input-save" type=
"submit" name=
"submit" value=
"<%:OK%>" />
58 <div class=
"cbi-value">
59 <label class=
"cbi-value-title"><%:Filter%
>:
</label>
60 <div class=
"cbi-value-field">
61 <input type=
"text" name=
"query" size=
"20" value=
"<%=pcdata(query)%>" />
62 <input type=
"submit" class=
"cbi-button cbi-input-find" name=
"search" value=
"<%:Find package%>" />
70 <fieldset class=
"cbi-section">
71 <%:Free space%
>:
<strong><%=(
100-used_perc)%
>%
</strong> (
<strong><%=wa.byte_format(free_byte)%
></strong>)
72 <div style=
"margin:3px 0; width:300px; height:10px; border:1px solid #000000; background-color:#80C080">
73 <div style=
"background-color:#F08080; border-right:1px solid #000000; height:100%; width:<%=used_perc%>%"> </div>
76 <% if (install and next(install)) or (remove and next(remove)) or update or upgrade then %
>
78 <% if #stdout
> 0 then %
><pre><%=pcdata(stdout)%
></pre><% end %
>
79 <% if #stderr
> 0 then %
><pre class=
"error"><%=pcdata(stderr)%
></pre><% end %
>
84 <h3><%:Installed packages%
><% if query then %
> (<%=pcdata(query)%
>)<% end %
></h3>
86 <fieldset class=
"cbi-section">
87 <table class=
"cbi-section-table" style=
"width:100%">
88 <tr class=
"cbi-section-table-titles">
89 <th class=
"cbi-section-table-cell" style=
"text-align:left"> </th>
90 <th class=
"cbi-section-table-cell" style=
"text-align:left"><%:Package name%
></th>
91 <th class=
"cbi-section-table-cell" style=
"text-align:left"><%:Version%
></th>
93 <% local empty = true; luci.model.ipkg.list_installed(query, function(n, v, d) empty = false; filter[n] = true %
>
94 <tr class=
"cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>">
95 <td style=
"text-align:left; width:10%"><a onclick=
"return window.confirm('<%:Remove%> "<%=luci.util.pcdata(n)%>" ?')" href=
"<%=REQUEST_URI%>?submit=1&remove=<%=luci.util.pcdata(n)%>"><%:Remove%
></a></td>
96 <td style=
"text-align:left"><%=luci.util.pcdata(n)%
></td>
97 <td style=
"text-align:left"><%=luci.util.pcdata(v)%
></td>
101 <tr class=
"cbi-section-table-row">
102 <td style=
"text-align:left"> </td>
103 <td style=
"text-align:left"><em><%:none%
></em></td>
104 <td style=
"text-align:left"><em><%:none%
></em></td>
112 <h3><%:Available packages%
><% if query then %
> (<%=pcdata(query)%
>)<% end %
></h3>
114 <fieldset class=
"cbi-section">
115 <table class=
"cbi-section-table" style=
"width:100%">
116 <tr class=
"cbi-section-table-titles">
117 <th class=
"cbi-section-table-cell" style=
"text-align:left"> </th>
118 <th class=
"cbi-section-table-cell" style=
"text-align:left"><%:Package name%
></th>
119 <th class=
"cbi-section-table-cell" style=
"text-align:left"><%:Version%
></th>
120 <th class=
"cbi-section-table-cell" style=
"text-align:left"><%:Description%
></th>
122 <% local empty = true; luci.model.ipkg.list_all(query, function(n, v, d) if filter[n] then return end; empty = false %
>
123 <tr class=
"cbi-section-table-row cbi-rowstyle-<%=rowstyle()%>">
124 <td style=
"text-align:left; width:10%"><a onclick=
"return window.confirm('<%:Install%> "<%=luci.util.pcdata(n)%>" ?')" href=
"<%=REQUEST_URI%>?submit=1&install=<%=luci.util.pcdata(n)%>"><%:Install%
></a></td>
125 <td style=
"text-align:left"><%=luci.util.pcdata(n)%
></td>
126 <td style=
"text-align:left"><%=luci.util.pcdata(v)%
></td>
127 <td style=
"text-align:left"><%=luci.util.pcdata(d)%
></td>
131 <tr class=
"cbi-section-table-row">
132 <td style=
"text-align:left"> </td>
133 <td style=
"text-align:left"><em><%:none%
></em></td>
134 <td style=
"text-align:left"><em><%:none%
></em></td>
135 <td style=
"text-align:left"><em><%:none%
></em></td>