rev |
line source |
pankso@7
|
1 #!/bin/sh
|
pankso@7
|
2 #
|
paul@52
|
3 # TazPKG CGI interface - Manage packages via a browser
|
pankso@7
|
4 #
|
paul@205
|
5 # This CGI interface extensively uses tazpkg to manage packages and have
|
paul@52
|
6 # its own code for some tasks. Please KISS, it is important and keep speed
|
pankso@7
|
7 # in mind. Thanks, Pankso.
|
pankso@7
|
8 #
|
pankso@112
|
9 # (C) 2011 SliTaz GNU/Linux - BSD License
|
pankso@7
|
10 #
|
pascal@79
|
11
|
pankso@17
|
12 . lib/libtazpanel
|
pankso@17
|
13 get_config
|
pascal@81
|
14 header
|
pankso@7
|
15
|
paul@205
|
16 # xHTML 5 header with special side bar for categories.
|
al@292
|
17 TITLE=$(gettext 'TazPanel - Packages')
|
pankso@41
|
18 xhtml_header | sed 's/id="content"/id="content-sidebar"/'
|
pankso@67
|
19
|
pascal@284
|
20 pkg_info_link()
|
pascal@284
|
21 {
|
pascal@284
|
22 echo "$SCRIPT_NAME?info=$1" | sed 's/+/%2B/g'
|
pascal@284
|
23 }
|
pankso@7
|
24
|
pankso@7
|
25 # We need packages information for list and search
|
pankso@7
|
26 parse_packages_desc() {
|
pankso@45
|
27 IFS="|"
|
pankso@45
|
28 cut -f 1,2,3,5 -d "|" | while read PACKAGE VERSION SHORT_DESC WEB_SITE
|
pankso@7
|
29 do
|
al@303
|
30 image=tazpkg-installed.png
|
al@303
|
31 [ -d $INSTALLED/${PACKAGE% } ] || image=tazpkg.png
|
al@303
|
32 cat << EOT
|
al@303
|
33 <tr>
|
al@303
|
34 <td><input type="checkbox" name="pkg" value="$PACKAGE">
|
al@303
|
35 <a href="$(pkg_info_link $PACKAGE)"><img
|
al@303
|
36 src="$IMAGES/$image"/>$PACKAGE</a></td>
|
al@303
|
37 <td>$VERSION</td>
|
al@303
|
38 <td class="desc">$SHORT_DESC</td>
|
al@303
|
39 <td><a href="$WEB_SITE"><img src="$IMAGES/browser.png"/></a></td>
|
al@303
|
40 </tr>
|
al@303
|
41 EOT
|
pankso@7
|
42 done
|
pankso@45
|
43 unset IFS
|
pankso@7
|
44 }
|
pankso@7
|
45
|
pankso@7
|
46 # Display a full summary of packages stats
|
pankso@7
|
47 packages_summary() {
|
al@303
|
48 cat << EOT
|
al@311
|
49 <table class="zebra outbox">
|
al@303
|
50 <tbody>
|
al@303
|
51 <tr><td>$(gettext 'Last recharge:')</td>
|
al@303
|
52 EOT
|
al@303
|
53 stat=$(stat -c %y $LOCALSTATE/packages.list | \
|
al@303
|
54 sed 's/\(:..\):.*/\1/' | awk '{print $1}')
|
al@303
|
55 mtime=$(find $LOCALSTATE/packages.list -mtime +10)
|
al@303
|
56 echo -n "<td>$stat "
|
pankso@37
|
57 if [ "$mtime" ]; then
|
al@303
|
58 gettext '(Older than 10 days)'; echo
|
pankso@37
|
59 else
|
al@303
|
60 gettext '(Not older than 10 days)'; echo
|
pankso@37
|
61 fi
|
al@303
|
62 cat << EOT
|
al@303
|
63 </td></tr>
|
al@303
|
64 <tr><td>$(gettext 'Installed packages:')</td>
|
al@303
|
65 <td>$(ls $INSTALLED | wc -l)</td></tr>
|
al@303
|
66 <tr><td>$(gettext 'Mirrored packages:')</td>
|
al@303
|
67 <td>$(cat $LOCALSTATE/packages.list | wc -l)</td></tr>
|
al@303
|
68 <tr><td>$(gettext 'Upgradeable packages:')</td>
|
al@303
|
69 <td>$(cat $LOCALSTATE/packages.up | wc -l)</td></tr>
|
al@303
|
70 <tr><td>$(gettext 'Installed files:')</td>
|
al@303
|
71 <td>$(cat $INSTALLED/*/files.list | wc -l)</td></tr>
|
al@303
|
72 <tr><td>$(gettext 'Blocked packages:')</td>
|
al@303
|
73 <td>$(cat $LOCALSTATE/blocked-packages.list | wc -l)</td></tr>
|
al@303
|
74 </tbody>
|
al@303
|
75 </table>
|
al@303
|
76 EOT
|
pankso@7
|
77 }
|
pankso@7
|
78
|
paul@127
|
79 # Parse mirrors list to be able to have an icon and remove link
|
pankso@10
|
80 list_mirrors() {
|
pascal@138
|
81 while read line
|
pankso@10
|
82 do
|
pankso@10
|
83 cat << EOT
|
Christian@271
|
84 <li>
|
Christian@271
|
85 <a href="$SCRIPT_NAME?admin=rm-mirror=$line&file=$(httpd -e $1)">
|
al@303
|
86 <img src="$IMAGES/clear.png" title="$(gettext 'Delete')" />
|
Christian@271
|
87 </a>
|
Christian@271
|
88 <a href="$SCRIPT_NAME?admin=select-mirror&mirror=$line">
|
al@303
|
89 <img src="$IMAGES/start.png" title="$(gettext 'Use as default')" />
|
Christian@271
|
90 </a>
|
Christian@271
|
91 <a href="$line">$line</a>
|
Christian@271
|
92 </li>
|
pankso@10
|
93 EOT
|
pascal@138
|
94 done < $1
|
pascal@138
|
95 }
|
pascal@138
|
96
|
pascal@138
|
97 # Parse repositories list to be able to have an icon and remove link
|
pascal@138
|
98 list_repos() {
|
pascal@138
|
99 ls $LOCALSTATE/undigest 2> /dev/null | while read repo ; do
|
pascal@138
|
100 cat <<EOT
|
pascal@138
|
101 <li><a href="$SCRIPT_NAME?admin=rm-repo=$repo">
|
pascal@138
|
102 <img src="$IMAGES/clear.png">$repo</a></li>
|
pascal@138
|
103 EOT
|
pankso@10
|
104 done
|
pankso@10
|
105 }
|
pankso@10
|
106
|
pankso@7
|
107 #
|
pankso@7
|
108 # xHTML functions
|
pankso@7
|
109 #
|
pankso@7
|
110
|
pankso@17
|
111 # ENTER will search but user may search for a button, so put one.
|
pankso@9
|
112 search_form() {
|
pascal@129
|
113 [ -n "$repo" ] || repo="$(GET repo)"
|
pascal@129
|
114 [ -n "$repo" ] || repo=Any
|
pankso@9
|
115 cat << EOT
|
pankso@9
|
116 <div class="search">
|
pankso@17
|
117 <form method="get" action="$SCRIPT_NAME">
|
pankso@17
|
118 <p>
|
pankso@17
|
119 <input type="text" name="search" size="20">
|
al@303
|
120 <input type="submit" value="$(gettext 'Search')">
|
pankso@80
|
121 <input class="radius" type="submit" name="files"
|
al@303
|
122 value="$(gettext 'Files')">
|
pascal@129
|
123 <input type="hidden" name="repo" value="$repo" />
|
pankso@17
|
124 </p>
|
pankso@17
|
125 </form>
|
pankso@9
|
126 </div>
|
pankso@9
|
127 EOT
|
pankso@9
|
128 }
|
pankso@9
|
129
|
pankso@17
|
130 table_head() {
|
pankso@7
|
131 cat << EOT
|
al@303
|
132 <thead>
|
al@303
|
133 <tr>
|
al@303
|
134 <td>$(gettext 'Name')</td>
|
al@303
|
135 <td>$(gettext 'Version')</td>
|
al@303
|
136 <td>$(gettext 'Description')</td>
|
al@303
|
137 <td>$(gettext 'Web')</td>
|
pankso@7
|
138 </tr>
|
al@303
|
139 </thead>
|
pankso@7
|
140 EOT
|
pankso@7
|
141 }
|
pankso@7
|
142
|
pankso@41
|
143 sidebar() {
|
pascal@129
|
144 [ -n "$repo" ] || repo=Public
|
pankso@7
|
145 cat << EOT
|
pankso@41
|
146 <div id="sidebar">
|
al@303
|
147 <h4>$(gettext 'Categories')</h4>
|
al@303
|
148 <a class="active_base-system" href="$SCRIPT_NAME?cat=base-system&repo=$repo">$(gettext 'Base-system')</a>
|
al@303
|
149 <a class="active_x-window" href="$SCRIPT_NAME?cat=x-window&repo=$repo">$(gettext 'X window')</a>
|
al@303
|
150 <a class="active_utilities" href="$SCRIPT_NAME?cat=utilities&repo=$repo">$(gettext 'Utilities')</a>
|
al@303
|
151 <a class="active_network" href="$SCRIPT_NAME?cat=network&repo=$repo">$(gettext 'Network')</a>
|
al@303
|
152 <a class="active_games" href="$SCRIPT_NAME?cat=games&repo=$repo">$(gettext 'Games')</a>
|
al@303
|
153 <a class="active_graphics" href="$SCRIPT_NAME?cat=graphics&repo=$repo">$(gettext 'Graphics')</a>
|
al@303
|
154 <a class="active_office" href="$SCRIPT_NAME?cat=office&repo=$repo">$(gettext 'Office')</a>
|
al@303
|
155 <a class="active_multimedia" href="$SCRIPT_NAME?cat=multimedia&repo=$repo">$(gettext 'Multimedia')</a>
|
al@303
|
156 <a class="active_development" href="$SCRIPT_NAME?cat=development&repo=$repo">$(gettext 'Development')</a>
|
al@303
|
157 <a class="active_system-tools" href="$SCRIPT_NAME?cat=system-tools&repo=$repo">$(gettext 'System tools')</a>
|
al@303
|
158 <a class="active_security" href="$SCRIPT_NAME?cat=security&repo=$repo">$(gettext 'Security')</a>
|
al@303
|
159 <a class="active_misc" href="$SCRIPT_NAME?cat=misc&repo=$repo">$(gettext 'Misc')</a>
|
al@303
|
160 <a class="active_meta" href="$SCRIPT_NAME?cat=meta&repo=$repo">$(gettext 'Meta')</a>
|
al@303
|
161 <a class="active_non-free" href="$SCRIPT_NAME?cat=non-free&repo=$repo">$(gettext 'Non free')</a>
|
al@303
|
162 <a class="active_all" href="$SCRIPT_NAME?cat=all&repo=$repo">$(gettext 'All')</a>
|
pankso@7
|
163 EOT
|
al@292
|
164
|
pascal@126
|
165 if [ -d $LOCALSTATE/undigest ]; then
|
pascal@126
|
166 [ -n "$category" ] || category="base-system"
|
pascal@126
|
167 cat << EOT
|
al@303
|
168 <h4>$(gettext 'Repositories')</h4>
|
al@303
|
169 <a class="repo_Public" href="$SCRIPT_NAME?repo=Public&cat=$category">$(gettext 'Public')</a>
|
pascal@126
|
170 EOT
|
pascal@126
|
171 for i in $(ls $LOCALSTATE/undigest); do
|
pascal@126
|
172 cat << EOT
|
pascal@126
|
173 <a class="repo_$i" href="$SCRIPT_NAME?repo=$i&cat=$category">$i</a>
|
pascal@126
|
174 EOT
|
pascal@126
|
175 done
|
pascal@126
|
176 cat << EOT
|
al@303
|
177 <a class="repo_Any" href="$SCRIPT_NAME?repo=Any&cat=$category">$(gettext 'Any')</a>
|
pascal@126
|
178 EOT
|
pascal@126
|
179 fi
|
pascal@126
|
180 echo "</div>"
|
pascal@126
|
181 }
|
pascal@126
|
182
|
pascal@126
|
183 repo_list() {
|
pascal@126
|
184 if [ -n "$(ls $LOCALSTATE/undigest/ 2> /dev/null)" ]; then
|
pascal@126
|
185 case "$repo" in
|
pascal@129
|
186 Public) ;;
|
pascal@129
|
187 ""|Any) for i in $LOCALSTATE/undigest/* ; do
|
pascal@129
|
188 [ -d "$i" ] && echo "$i$1"
|
pascal@126
|
189 done ;;
|
pascal@129
|
190 *) echo "$LOCALSTATE/undigest/$repo$1"
|
pascal@126
|
191 return ;;
|
pascal@126
|
192 esac
|
pascal@126
|
193 fi
|
pascal@129
|
194 echo "$LOCALSTATE$1"
|
pankso@7
|
195 }
|
pankso@7
|
196
|
pascal@139
|
197 repo_name() {
|
pascal@139
|
198 case "$1" in
|
pascal@139
|
199 $LOCALSTATE) echo "Public" ;;
|
pascal@139
|
200 $LOCALSTATE/undigest/*) echo ${1#$LOCALSTATE/undigest/} ;;
|
pascal@139
|
201 esac
|
pascal@139
|
202 }
|
pascal@139
|
203
|
pankso@45
|
204 #
|
pankso@45
|
205 # Commands
|
pankso@45
|
206 #
|
pankso@45
|
207
|
pascal@81
|
208 case " $(GET) " in
|
pascal@81
|
209 *\ list\ *)
|
pankso@45
|
210 #
|
pankso@45
|
211 # List installed packages. This is the default because parsing
|
paul@127
|
212 # the full packages.desc can be long and take up some resources
|
pankso@45
|
213 #
|
pankso@45
|
214 cd $INSTALLED
|
pankso@45
|
215 search_form
|
pankso@45
|
216 sidebar
|
al@303
|
217 LOADING_MSG="$(gettext 'Listing packages...')"
|
pankso@45
|
218 loading_msg
|
pankso@45
|
219 cat << EOT
|
al@303
|
220 <h2>$(gettext 'My packages')</h2>
|
pankso@45
|
221 <form method='get' action='$SCRIPT_NAME'>
|
al@303
|
222 <input type="hidden" name="do" value="Remove" />
|
pankso@45
|
223 <div id="actions">
|
pankso@46
|
224 <div class="float-left">
|
al@303
|
225 $(gettext 'Selection:')
|
al@303
|
226 <input type="submit" value="$(gettext 'Remove')" />
|
pankso@46
|
227 </div>
|
pankso@46
|
228 <div class="float-right">
|
al@303
|
229 <a class="button" href="$SCRIPT_NAME?recharge">
|
al@303
|
230 <img src="$IMAGES/recharge.png" />$(gettext 'Recharge list')</a>
|
al@303
|
231 <a class="button" href='$SCRIPT_NAME?up'>
|
al@303
|
232 <img src="$IMAGES/update.png" />$(gettext 'Check upgrades')</a>
|
pankso@46
|
233 </div>
|
pankso@41
|
234 </div>
|
pankso@7
|
235 EOT
|
al@303
|
236 cat << EOT
|
al@311
|
237 <table class="zebra outbox">
|
al@303
|
238 $(table_head)
|
al@303
|
239 <tbody>
|
al@303
|
240 EOT
|
pankso@7
|
241 for pkg in *
|
pankso@7
|
242 do
|
pankso@7
|
243 . $pkg/receipt
|
pankso@7
|
244 echo '<tr>'
|
pankso@7
|
245 # Use default tazpkg icon since all packages displayed are
|
pankso@7
|
246 # installed
|
pascal@92
|
247 colorpkg=$pkg
|
pascal@92
|
248 grep -qs "^$pkg$" $LOCALSTATE/blocked-packages.list &&
|
pascal@92
|
249 colorpkg="<span style='color: red;'>$pkg</span>"
|
al@303
|
250 cat << EOT
|
al@303
|
251 <td class="pkg">
|
al@303
|
252 <input type="checkbox" name="pkg" value="$pkg" />
|
al@303
|
253 <a href="$(pkg_info_link $pkg)"><img
|
al@303
|
254 src="$IMAGES/tazpkg-installed.png"/>$colorpkg</a></td>
|
al@303
|
255 <td>$VERSION</td>
|
al@303
|
256 <td class="desc">$SHORT_DESC</td>
|
al@303
|
257 <td><a href="$WEB_SITE"><img src="$IMAGES/browser.png"/></a></td>
|
al@303
|
258 </tr>
|
al@303
|
259 EOT
|
pankso@7
|
260 done
|
al@303
|
261 cat << EOT
|
al@303
|
262 </tbody>
|
al@303
|
263 </table>
|
al@303
|
264 </form>
|
al@303
|
265 EOT
|
al@303
|
266 ;;
|
al@303
|
267
|
pascal@140
|
268 *\ linkable\ *)
|
pascal@140
|
269 #
|
pascal@140
|
270 # List linkable packages.
|
pascal@140
|
271 #
|
pascal@140
|
272 cd $INSTALLED
|
pascal@140
|
273 search_form
|
pascal@140
|
274 sidebar
|
al@303
|
275 LOADING_MSG=$(gettext 'Listing linkable packages...')
|
pascal@140
|
276 loading_msg
|
pascal@140
|
277 cat << EOT
|
al@303
|
278 <h2>$(gettext 'Linkable packages')</h2>
|
al@303
|
279
|
pascal@140
|
280 <form method='get' action='$SCRIPT_NAME'>
|
al@303
|
281 <input type="hidden" name="do" value="Link" />
|
pascal@140
|
282 <div id="actions">
|
pascal@140
|
283 <div class="float-left">
|
al@303
|
284 $(gettext 'Selection:')
|
al@303
|
285 <input type="submit" value="$(gettext 'Link')" />
|
pascal@140
|
286 </div>
|
pascal@140
|
287 <div class="float-right">
|
al@303
|
288 <a class="button" href="$SCRIPT_NAME?recharge">
|
al@303
|
289 <img src="$IMAGES/recharge.png" />$(gettext 'Recharge list')</a>
|
al@303
|
290 <a class="button" href="$SCRIPT_NAME?up">
|
al@303
|
291 <img src="$IMAGES/update.png" />$(gettext 'Check upgrades')</a>
|
pascal@140
|
292 </div>
|
pascal@140
|
293 </div>
|
pascal@140
|
294 EOT
|
al@303
|
295 cat << EOT
|
al@311
|
296 <table class="zebra outbox">
|
al@303
|
297 $(table_head)
|
al@303
|
298 <tbody>
|
al@303
|
299 EOT
|
pascal@140
|
300 target=$(readlink $LOCALSTATE/fslink)
|
pascal@140
|
301 for pkg in $(ls $target/$INSTALLED)
|
pascal@140
|
302 do
|
pascal@140
|
303 [ -s $pkg/receipt ] && continue
|
pascal@140
|
304 . $target/$INSTALLED/$pkg/receipt
|
al@303
|
305 cat << EOT
|
al@303
|
306 <tr>
|
al@303
|
307 <td class="pkg">
|
al@303
|
308 <input type="checkbox" name="pkg" value="$pkg" />
|
al@303
|
309 <a href="$(pkg_info_link $pkg)"><img
|
al@303
|
310 src="$IMAGES/tazpkg.png"/>$pkg</a>
|
al@303
|
311 </td>
|
al@303
|
312 <td>$VERSION</td>
|
al@303
|
313 <td class="desc">$SHORT_DESC</td>
|
al@303
|
314 <td><a href="$WEB_SITE"><img src="$IMAGES/browser.png"/></a></td>
|
al@303
|
315 </tr>
|
al@303
|
316 EOT
|
pascal@140
|
317 done
|
al@303
|
318 cat << EOT
|
al@303
|
319 </tbody>
|
al@303
|
320 </table>
|
al@303
|
321 </form>
|
al@303
|
322 EOT
|
al@303
|
323 ;;
|
al@303
|
324
|
al@303
|
325
|
pascal@81
|
326 *\ cat\ *)
|
pankso@45
|
327 #
|
pankso@41
|
328 # List all available packages by category on mirror. Listing all
|
paul@52
|
329 # packages is too resource intensive and not useful.
|
pankso@45
|
330 #
|
pankso@9
|
331 cd $LOCALSTATE
|
pascal@126
|
332 repo=$(GET repo)
|
pascal@81
|
333 category=$(GET cat)
|
pascal@81
|
334 [ "$category" == "cat" ] && category="base-system"
|
pascal@93
|
335 grep_category=$category
|
pascal@93
|
336 [ "$grep_category" == "all" ] && grep_category=".*"
|
pankso@9
|
337 search_form
|
pascal@126
|
338 sidebar | sed "s/active_$category/active/;s/repo_$repo/active/"
|
al@303
|
339 LOADING_MSG="$(gettext 'Listing packages...')"
|
pankso@45
|
340 loading_msg
|
pankso@9
|
341 cat << EOT
|
al@303
|
342 <h2>$(eval_gettext 'Category: $category')</h2>
|
al@303
|
343
|
pankso@9
|
344 <form method='get' action='$SCRIPT_NAME'>
|
pankso@9
|
345 <div id="actions">
|
pankso@45
|
346 <div class="float-left">
|
al@303
|
347 $(gettext 'Selection:')
|
pankso@45
|
348 <input type="submit" name="do" value="Install" />
|
pankso@45
|
349 <input type="submit" name="do" value="Remove" />
|
pascal@126
|
350 <input type="hidden" name="repo" value="$repo" />
|
pankso@45
|
351 </div>
|
pankso@45
|
352 <div class="float-right">
|
al@303
|
353 <a class="button" href="$SCRIPT_NAME?recharge">
|
al@303
|
354 <img src="$IMAGES/recharge.png" />$(gettext 'Recharge list')</a>
|
al@303
|
355 <a class="button" href="$SCRIPT_NAME?up">
|
al@303
|
356 <img src="$IMAGES/update.png" />$(gettext 'Check upgrades')</a>
|
pankso@45
|
357 <a class="button" href='$SCRIPT_NAME?list'>
|
al@303
|
358 <img src="$IMAGES/tazpkg.png" />$(gettext 'My packages')</a>
|
pankso@45
|
359 </div>
|
pascal@126
|
360 </div>
|
pankso@9
|
361 EOT
|
pascal@129
|
362 for i in $(repo_list ""); do
|
al@303
|
363 if [ "$repo" != "Public" ]; then
|
al@303
|
364 Repo_Name="$(repo_name $i)"
|
al@303
|
365 cat << EOT
|
al@303
|
366 <h3>$(eval_gettext "Repository: \$Repo_Name")</h3>
|
al@303
|
367 EOT
|
al@303
|
368 fi
|
al@303
|
369 cat << EOT
|
al@311
|
370 <table class="zebra outbox">
|
al@303
|
371 $(table_head)
|
al@303
|
372 <tbody>
|
al@303
|
373 EOT
|
pascal@129
|
374 grep "| $grep_category |" $i/packages.desc | \
|
pascal@129
|
375 parse_packages_desc
|
al@303
|
376 cat << EOT
|
al@303
|
377 </tbody>
|
al@303
|
378 </table>
|
al@303
|
379 EOT
|
pascal@126
|
380 done
|
pankso@7
|
381 echo '</form>' ;;
|
al@303
|
382
|
al@303
|
383
|
pascal@81
|
384 *\ search\ *)
|
pankso@45
|
385 #
|
pankso@63
|
386 # Search for packages. Here default is to search in packages.desc
|
pankso@63
|
387 # and so get result including packages names and descriptions
|
pankso@45
|
388 #
|
pascal@81
|
389 pkg=$(GET search)
|
pascal@129
|
390 repo=$(GET repo)
|
pankso@9
|
391 cd $LOCALSTATE
|
pankso@9
|
392 search_form
|
pascal@129
|
393 sidebar | sed "s/repo_$repo/active/"
|
al@303
|
394 LOADING_MSG="$(gettext 'Searching packages...')"
|
pankso@45
|
395 loading_msg
|
pankso@7
|
396 cat << EOT
|
al@303
|
397 <h2>$(gettext 'Search packages')</h2>
|
pankso@7
|
398 <form method="get" action="$SCRIPT_NAME">
|
pankso@9
|
399 <div id="actions">
|
pankso@45
|
400 <div class="float-left">
|
al@303
|
401 $(gettext 'Selection:')
|
pankso@45
|
402 <input type="submit" name="do" value="Install" />
|
pankso@45
|
403 <input type="submit" name="do" value="Remove" />
|
al@303
|
404 <a href="`cat $PANEL/lib/checkbox.js`">$(gettext 'Toogle all')</a>
|
pankso@45
|
405 </div>
|
pankso@45
|
406 <div class="float-right">
|
al@303
|
407 <a class="button" href="$SCRIPT_NAME?recharge">
|
al@303
|
408 <img src="$IMAGES/recharge.png" />$(gettext 'Recharge list')</a>
|
al@303
|
409 <a class="button" href="$SCRIPT_NAME?up">
|
al@303
|
410 <img src="$IMAGES/update.png" />$(gettext 'Check upgrades')</a>
|
pankso@45
|
411 <a class="button" href='$SCRIPT_NAME?list'>
|
al@303
|
412 <img src="$IMAGES/tazpkg.png" />$(gettext 'My packages')</a>
|
pankso@45
|
413 </div>
|
pascal@126
|
414 </div>
|
pascal@129
|
415 <input type="hidden" name="repo" value="$repo" />
|
al@303
|
416
|
al@311
|
417 <table class="zebra outbox">
|
pankso@7
|
418 EOT
|
pascal@79
|
419 if [ "$(GET files)" ]; then
|
pascal@79
|
420 cat <<EOT
|
al@303
|
421 <thead>
|
al@303
|
422 <tr>
|
al@303
|
423 <td>$(gettext 'Package')</td>
|
al@303
|
424 <td>$(gettext 'File')</td>
|
pascal@79
|
425 </tr>
|
al@303
|
426 <thead>
|
al@303
|
427 <tbody>
|
al@303
|
428 EOT
|
al@303
|
429 unlzma -c $(repo_list /files.list.lzma) \
|
al@303
|
430 | grep -Ei ": .*$(GET search)" | \
|
al@303
|
431 while read PACKAGE FILE; do
|
al@303
|
432 PACKAGE=${PACKAGE%:}
|
al@303
|
433 image=tazpkg-installed.png
|
al@303
|
434 [ -d $INSTALLED/$PACKAGE ] || image=tazpkg.png
|
al@303
|
435 cat << EOT
|
al@303
|
436 <tr>
|
al@303
|
437 <td><input type="checkbox" name="pkg" value="$PACKAGE">
|
al@303
|
438 <a href="$(pkg_info_link $PACKAGE)"><img src="$IMAGES/$image" />$PACKAGE</a></td>
|
pascal@84
|
439 <td>$FILE</td>
|
al@303
|
440 </tr>
|
pascal@79
|
441 EOT
|
al@303
|
442 done
|
pascal@79
|
443 else
|
al@303
|
444 cat << EOT
|
al@303
|
445 $(table_head)
|
al@303
|
446 <tbody>
|
al@303
|
447 EOT
|
pascal@129
|
448 grep -ih $pkg $(repo_list /packages.desc) | \
|
pascal@126
|
449 parse_packages_desc
|
pascal@79
|
450 fi
|
al@303
|
451 cat << EOT
|
al@303
|
452 </tbody>
|
al@303
|
453 </table>
|
al@303
|
454 </form>
|
al@303
|
455 EOT
|
al@303
|
456 ;;
|
al@303
|
457
|
al@303
|
458
|
pascal@81
|
459 *\ recharge\ *)
|
pankso@45
|
460 #
|
paul@127
|
461 # Lets recharge the packages list
|
pankso@45
|
462 #
|
pankso@9
|
463 search_form
|
pankso@41
|
464 sidebar
|
al@303
|
465 LOADING_MSG="$(gettext 'Recharging lists...')"
|
pankso@45
|
466 loading_msg
|
pankso@8
|
467 cat << EOT
|
al@303
|
468 <h2>$(gettext 'Recharge')</h2>
|
al@303
|
469
|
pankso@9
|
470 <form method='get' action='$SCRIPT_NAME'>
|
pankso@9
|
471 <div id="actions">
|
pankso@41
|
472 <div class="float-left">
|
al@303
|
473 <p>$(gettext 'Recharge checks for new or updated packages')</p>
|
pankso@41
|
474 </div>
|
pankso@41
|
475 <div class="float-right">
|
al@303
|
476 <a class="button" href='$SCRIPT_NAME?up'>
|
al@303
|
477 <img src="$IMAGES/update.png" />$(gettext 'Check upgrades')</a>
|
al@303
|
478 <a class="button" href='$SCRIPT_NAME?list'>
|
al@303
|
479 <img src="$IMAGES/tazpkg.png" />$(gettext 'My packages')</a>
|
pankso@41
|
480 </div>
|
pankso@41
|
481 </div>
|
al@303
|
482 <div class="wrapper">
|
pankso@22
|
483 <pre>
|
pankso@8
|
484 EOT
|
al@303
|
485 echo $(gettext 'Recharging packages list') | log
|
pascal@99
|
486 tazpkg recharge | filter_taztools_msgs
|
pankso@45
|
487 cat << EOT
|
pankso@45
|
488 </pre>
|
al@303
|
489 </div>
|
al@303
|
490 <p>$(gettext "Packages lists are up-to-date. You should check for upgrades \
|
al@303
|
491 now.")</p>
|
pankso@45
|
492 EOT
|
pankso@45
|
493 ;;
|
al@303
|
494
|
al@303
|
495
|
pascal@81
|
496 *\ up\ *)
|
pankso@45
|
497 #
|
paul@127
|
498 # Upgrade packages
|
pankso@45
|
499 #
|
pankso@9
|
500 cd $LOCALSTATE
|
pankso@9
|
501 search_form
|
pankso@41
|
502 sidebar
|
al@303
|
503 LOADING_MSG="$(gettext 'Checking for upgrades...')"
|
pankso@45
|
504 loading_msg
|
pankso@8
|
505 cat << EOT
|
al@303
|
506 <h2>$(gettext 'Up packages')</h2>
|
al@303
|
507
|
pankso@8
|
508 <form method="get" action="$SCRIPT_NAME">
|
pankso@9
|
509 <div id="actions">
|
pankso@47
|
510 <div class="float-left">
|
al@303
|
511 $(gettext 'Selection:')
|
pankso@47
|
512 <input type="submit" name="do" value="Install" />
|
pankso@47
|
513 <input type="submit" name="do" value="Remove" />
|
al@303
|
514 <a href="$(cat $PANEL/lib/checkbox.js)">$(gettext 'Toogle all')</a>
|
pankso@47
|
515 </div>
|
pankso@47
|
516 <div class="float-right">
|
al@303
|
517 <a class="button" href="$SCRIPT_NAME?recharge">
|
al@303
|
518 <img src="$IMAGES/recharge.png" />$(gettext 'Recharge list')</a>
|
al@303
|
519 <a class="button" href="$SCRIPT_NAME?list">
|
al@303
|
520 <img src="$IMAGES/tazpkg.png" />$(gettext 'My packages')</a>
|
pankso@47
|
521 </div>
|
pankso@45
|
522 </div>
|
pankso@8
|
523 EOT
|
pankso@47
|
524 tazpkg up --check >/dev/null
|
al@303
|
525 cat << EOT
|
al@311
|
526 <table class="zebra outbox">
|
al@303
|
527 $(table_head)
|
al@303
|
528 <tbody>
|
al@303
|
529 EOT
|
pankso@47
|
530 for pkg in `cat packages.up`
|
pankso@8
|
531 do
|
pascal@182
|
532 grep -hs "^$pkg |" $LOCALSTATE/packages.desc \
|
pascal@180
|
533 $LOCALSTATE/undigest/*/packages.desc | \
|
pascal@126
|
534 parse_packages_desc
|
pankso@8
|
535 done
|
al@303
|
536 cat << EOT
|
al@303
|
537 </tbody>
|
al@303
|
538 </table>
|
al@303
|
539 </form>
|
al@303
|
540 EOT
|
al@303
|
541 ;;
|
al@303
|
542
|
al@303
|
543
|
pascal@81
|
544 *\ do\ *)
|
pankso@45
|
545 #
|
pankso@7
|
546 # Do an action on one or some packages
|
pankso@45
|
547 #
|
pascal@92
|
548 opt=""
|
pascal@81
|
549 pkgs=""
|
al@292
|
550 cmdline=$(echo ${QUERY_STRING#do=} | sed s'/&/ /g')
|
pankso@181
|
551 cmd=$(echo ${cmdline} | awk '{print $1}')
|
pankso@175
|
552 cmdline=${cmdline#*repo=* }
|
pankso@181
|
553 pkgs=$(echo $cmdline | sed -e s'/+/ /g' -e s'/pkg=//g' -e s/$cmd//)
|
pascal@211
|
554 pkgs="$(httpd -d "$pkgs")"
|
pankso@181
|
555 cmd=$(echo $cmd | tr [:upper:] [:lower:])
|
pankso@87
|
556 case $cmd in
|
pascal@92
|
557 install)
|
al@303
|
558 cmd=get-install opt=--forced
|
al@303
|
559 LOADING_MSG="get-installing packages..."
|
al@303
|
560 ;;
|
pascal@140
|
561 link)
|
al@303
|
562 opt=$(readlink $LOCALSTATE/fslink)
|
al@303
|
563 LOADING_MSG="linking packages..."
|
al@303
|
564 ;;
|
pankso@41
|
565 esac
|
pankso@9
|
566 search_form
|
pankso@41
|
567 sidebar
|
pankso@45
|
568 loading_msg
|
pankso@9
|
569 cat << EOT
|
pankso@9
|
570 <h2>Tazpkg: $cmd</h2>
|
al@303
|
571
|
pankso@9
|
572 <form method="get" action="$SCRIPT_NAME">
|
pankso@9
|
573 <div id="actions">
|
pankso@41
|
574 <div class="float-left">
|
al@303
|
575 <p>$(gettext 'Performing tasks on packages')</p>
|
pankso@41
|
576 </div>
|
pankso@41
|
577 <div class="float-right">
|
pankso@41
|
578 <p>
|
al@303
|
579 <a class="button" href="$SCRIPT_NAME?list">
|
al@303
|
580 <img src="$IMAGES/tazpkg.png" />$(gettext 'My packages')</a>
|
pankso@41
|
581 </p>
|
pankso@41
|
582 </div>
|
pankso@41
|
583 </div>
|
al@303
|
584 <div class="box">
|
al@303
|
585 $(eval_gettext 'Executing $cmd for: $pkgs')
|
al@303
|
586 </div>
|
pankso@9
|
587 EOT
|
pankso@7
|
588 for pkg in $pkgs
|
pankso@7
|
589 do
|
pankso@10
|
590 echo '<pre>'
|
pascal@211
|
591 echo 'y' | tazpkg $cmd $pkg $opt 2>/dev/null | filter_taztools_msgs
|
pankso@7
|
592 echo '</pre>'
|
pankso@7
|
593 done ;;
|
al@303
|
594
|
al@303
|
595
|
pascal@81
|
596 *\ info\ *)
|
pankso@45
|
597 #
|
pankso@45
|
598 # Packages info
|
pankso@45
|
599 #
|
pascal@81
|
600 pkg=$(GET info)
|
pankso@9
|
601 search_form
|
pankso@41
|
602 sidebar
|
pascal@62
|
603 if [ -d $INSTALLED/$pkg ]; then
|
pascal@62
|
604 . $INSTALLED/$pkg/receipt
|
pascal@62
|
605 files=`cat $INSTALLED/$pkg/files.list | wc -l`
|
al@303
|
606 action="Remove"
|
al@303
|
607 action_i18n=$(gettext 'Remove')
|
pascal@62
|
608 else
|
pascal@62
|
609 cd $LOCALSTATE
|
al@303
|
610 LOADING_MSG=$(gettext 'Getting package info...')
|
pankso@64
|
611 loading_msg
|
pascal@62
|
612 IFS='|'
|
pascal@129
|
613 set -- $(grep -hs "^$pkg |" packages.desc \
|
pascal@126
|
614 undigest/*/packages.desc)
|
pascal@62
|
615 unset IFS
|
pascal@62
|
616 PACKAGE=$1
|
pascal@62
|
617 VERSION="$(echo $2)"
|
pascal@62
|
618 SHORT_DESC="$(echo $3)"
|
pascal@62
|
619 CATEGORY="$(echo $4)"
|
pascal@62
|
620 WEB_SITE="$(echo $5)"
|
al@303
|
621 action="Install"
|
al@303
|
622 action_i18n=$(gettext 'Install')
|
Christian@280
|
623 temp="$(echo $pkg | sed 's/get-//g')"
|
pascal@62
|
624 fi
|
pankso@7
|
625 cat << EOT
|
al@303
|
626 <h2>$(eval_gettext 'Package $PACKAGE')</h2>
|
al@303
|
627
|
pankso@9
|
628 <div id="actions">
|
pankso@41
|
629 <div class="float-left">
|
pankso@41
|
630 <p>
|
pascal@92
|
631 EOT
|
al@303
|
632 if [ "$temp" != "$pkg" -a "$action" == "Install" ]; then
|
Christian@280
|
633 temp="$(echo $pkg | sed 's/get-//g')"
|
al@303
|
634 echo "<a class='button' href='$SCRIPT_NAME?do=Install&$temp'>$(gettext 'Install (Non Free)')</a>"
|
Christian@280
|
635 else
|
al@303
|
636 echo "<a class='button' href='$SCRIPT_NAME?do=$action&$pkg'>$action_i18n</a>"
|
Christian@280
|
637 fi
|
Christian@280
|
638
|
pascal@92
|
639 if [ -d $INSTALLED/$pkg ]; then
|
pascal@92
|
640 if grep -qs "^$pkg$" $LOCALSTATE/blocked-packages.list; then
|
al@303
|
641 cat << EOT
|
al@303
|
642 <a class="button" href="$SCRIPT_NAME?do=Unblock&$pkg">$(gettext 'Unblock')</a>
|
al@303
|
643 EOT
|
pascal@92
|
644 else
|
al@303
|
645 cat << EOT
|
al@303
|
646 <a class="button" href='$SCRIPT_NAME?do=Block&$pkg'>$(gettext 'Block')</a>
|
al@303
|
647 EOT
|
pascal@92
|
648 fi
|
pascal@92
|
649 cat << EOT
|
al@303
|
650 <a class="button" href='$SCRIPT_NAME?do=Repack&$pkg'>$(gettext 'Repack')</a>
|
pascal@92
|
651 EOT
|
pascal@92
|
652 fi
|
pascal@92
|
653 cat << EOT
|
pankso@41
|
654 </p>
|
pankso@41
|
655 </div>
|
pankso@41
|
656 <div class="float-right">
|
pankso@41
|
657 <p>
|
pankso@41
|
658 <a class="button" href='$SCRIPT_NAME?list'>
|
al@303
|
659 <img src="$IMAGES/tazpkg.png" />$(gettext 'My packages')</a>
|
pankso@41
|
660 </p>
|
pankso@41
|
661 </div>
|
pankso@9
|
662 </div>
|
al@311
|
663 <table class="zebra outbox">
|
al@303
|
664 <tbody>
|
al@303
|
665 <tr><td>$(gettext 'Name:')</td><td>$PACKAGE</td></tr>
|
al@303
|
666 <tr><td>$(gettext 'Version:')</td><td>$VERSION</td></tr>
|
al@303
|
667 <tr><td>$(gettext 'Description:')</td><td>$SHORT_DESC</td></tr>
|
al@303
|
668 <tr><td>$(gettext 'Category:')</td><td>$CATEGORY</td></tr>
|
pascal@62
|
669 EOT
|
pascal@62
|
670 if [ -d $INSTALLED/$pkg ]; then
|
pascal@62
|
671 cat << EOT
|
al@303
|
672 <tr><td>$(gettext 'Maintainer:')</td><td>$MAINTAINER</td></tr>
|
al@303
|
673 <tr><td>$(gettext 'Website:')</td><td><a href="$WEB_SITE">$WEB_SITE</a></td></tr>
|
al@303
|
674 <tr><td>$(gettext 'Sizes:')</td><td>$PACKED_SIZE/$UNPACKED_SIZE</td></tr>
|
pascal@92
|
675 EOT
|
pascal@92
|
676 if [ -n "$DEPENDS" ]; then
|
al@303
|
677 echo "<tr><td>$(gettext 'Depends:')</td><td>"
|
al@292
|
678 for i in $DEPENDS; do
|
pascal@284
|
679 echo -n "<a href="$(pkg_info_link $i)">$i</a> "
|
pascal@92
|
680 done
|
al@303
|
681 echo "</td></tr>"
|
pascal@92
|
682 fi
|
pascal@92
|
683 if [ -n "$SUGGESTED" ]; then
|
al@303
|
684 echo "<tr><td>$(gettext 'Suggested:')</td><td>"
|
al@292
|
685 for i in $SUGGESTED; do
|
pascal@284
|
686 echo -n "<a href="$(pkg_info_link $i)">$i</a> "
|
pascal@92
|
687 done
|
al@303
|
688 echo "</td></tr>"
|
pascal@92
|
689 fi
|
al@303
|
690 [ -n "$TAGS" ] && echo "<tr><td>$(gettext 'Tags:')</td><td>$TAGS</td></tr>"
|
al@303
|
691 I_FILES=$(cat $INSTALLED/$pkg/files.list | wc -l)
|
pascal@92
|
692 cat << EOT
|
al@303
|
693 </tbody>
|
al@303
|
694 </table>
|
pankso@7
|
695
|
al@303
|
696 <p>$(eval_gettext 'Installed files: $I_FILES')</p>
|
al@303
|
697
|
al@303
|
698 <pre>$(cat $INSTALLED/$pkg/files.list)</pre>
|
pankso@7
|
699 EOT
|
pascal@62
|
700 else
|
pascal@62
|
701 cat << EOT
|
al@303
|
702 <tr><td>$(gettext 'Website:')</td><td><a href="$WEB_SITE">$WEB_SITE</a></td></tr>
|
al@303
|
703 <tr><td>$(gettext 'Sizes:')</td><td>$(grep -hsA 3 ^$pkg$ packages.txt undigest/*/packages.txt | \
|
al@303
|
704 tail -n 1 | sed 's/ *//')</td></tr>
|
al@303
|
705 </table>
|
pascal@62
|
706
|
al@303
|
707 <p>$(gettext 'Installed files:')</p>
|
al@303
|
708
|
pascal@62
|
709 <pre>
|
pascal@126
|
710 `unlzma -c files.list.lzma undigest/*/files.list.lzma 2> /dev/null | \
|
pascal@126
|
711 sed "/^$pkg: /!d;s/^$pkg: //"`
|
pascal@62
|
712 </pre>
|
pascal@62
|
713 EOT
|
pascal@62
|
714 fi
|
pankso@7
|
715 ;;
|
al@303
|
716
|
al@303
|
717
|
pankso@95
|
718 *\ admin\ * )
|
pankso@45
|
719 #
|
pankso@10
|
720 # Tazpkg configuration page
|
pankso@45
|
721 #
|
pankso@95
|
722 cmd=$(GET admin)
|
pankso@10
|
723 case "$cmd" in
|
pankso@10
|
724 clean)
|
pankso@10
|
725 rm -rf /var/cache/tazpkg/* ;;
|
pascal@81
|
726 add-mirror)
|
pankso@10
|
727 # Decode url
|
pascal@81
|
728 mirror=$(GET mirror)
|
pascal@81
|
729 case "$mirror" in
|
pascal@81
|
730 http://*|ftp://*)
|
pascal@138
|
731 echo "$mirror" >> $(GET file) ;;
|
pascal@81
|
732 esac ;;
|
pankso@10
|
733 rm-mirror=http://*|rm-mirror=ftp://*)
|
pascal@81
|
734 mirror=${cmd#rm-mirror=}
|
pascal@138
|
735 sed -i -e "s@$mirror@@" -e '/^$/d' $(GET file) ;;
|
Christian@271
|
736 select-mirror*)
|
Christian@271
|
737 release=`cat /etc/slitaz-release`
|
Christian@271
|
738 mirror="$(GET mirror)packages/$release/"
|
Christian@271
|
739 tazpkg setup-mirror $mirror | log
|
Christian@271
|
740 ;;
|
pascal@138
|
741 add-repo)
|
pascal@138
|
742 # Decode url
|
pascal@138
|
743 mirror=$(GET mirror)
|
pascal@138
|
744 repository=$LOCALSTATE/undigest/$(GET repository)
|
pascal@138
|
745 case "$mirror" in
|
pascal@138
|
746 http://*|ftp://*)
|
pascal@138
|
747 mkdir -p $repository
|
pascal@138
|
748 echo "$mirror" > $repository/mirror
|
pascal@138
|
749 echo "$mirror" > $repository/mirrors ;;
|
pascal@138
|
750 esac ;;
|
pascal@138
|
751 rm-repo=*)
|
pascal@138
|
752 repository=${cmd#rm-repo=}
|
pascal@138
|
753 rm -rf $LOCALSTATE/undigest/$repository ;;
|
pankso@10
|
754 esac
|
al@303
|
755 [ "$cmd" == "$(gettext 'Set link')" ] &&
|
pascal@140
|
756 [ -d "$(GET link)/$INSTALLED" ] &&
|
pascal@140
|
757 ln -fs $(GET link) $LOCALSTATE/fslink
|
al@303
|
758 [ "$cmd" == "$(gettext 'Remove link')" ] &&
|
pascal@140
|
759 rm -f $LOCALSTATE/fslink
|
pankso@10
|
760 cache_files=`find /var/cache/tazpkg -name *.tazpkg | wc -l`
|
pankso@10
|
761 cache_size=`du -sh /var/cache/tazpkg`
|
pankso@41
|
762 sidebar
|
pankso@10
|
763 cat << EOT
|
al@303
|
764 <h2>$(gettext 'Administration')</h2>
|
pankso@10
|
765 <div>
|
al@303
|
766 <p>$(gettext 'Tazpkg administration and settings')</p>
|
pankso@10
|
767 </div>
|
pankso@95
|
768 <div id="actions">
|
pankso@95
|
769 <a class="button" href='$SCRIPT_NAME?admin=&action=saveconf'>
|
al@303
|
770 <img src="$IMAGES/tazpkg.png" />$(gettext 'Save configuration')</a>
|
pankso@95
|
771 <a class="button" href='$SCRIPT_NAME?admin=&action=listconf'>
|
al@303
|
772 <img src="$IMAGES/edit.png" />$(gettext 'List configuration files')</a>
|
pankso@95
|
773 <a class="button" href='$SCRIPT_NAME?admin=&action=quickcheck'>
|
al@303
|
774 <img src="$IMAGES/recharge.png" />$(gettext 'Quick check')</a>
|
pankso@95
|
775 <a class="button" href='$SCRIPT_NAME?admin=&action=fullcheck'>
|
al@303
|
776 <img src="$IMAGES/recharge.png" />$(gettext 'Full check')</a>
|
pankso@95
|
777 </div>
|
pankso@95
|
778 EOT
|
pankso@95
|
779 case "$(GET action)" in
|
pankso@95
|
780 saveconf)
|
al@303
|
781 LOADING_MSG=$(gettext 'Creating the package...')
|
pankso@95
|
782 loading_msg
|
pankso@95
|
783 echo "<pre>"
|
pankso@95
|
784 cd $HOME
|
pascal@99
|
785 tazpkg repack-config | filter_taztools_msgs
|
al@303
|
786 echo -n "$(gettext 'Path:') " && ls $HOME/config-*.tazpkg
|
pankso@95
|
787 echo "</pre>" ;;
|
pankso@95
|
788 listconf)
|
al@303
|
789 echo "<h4>$(gettext 'Configuration files')</h4>"
|
pankso@95
|
790 echo "<ul>"
|
pascal@102
|
791 tazpkg list-config | while read file; do
|
pascal@102
|
792 [ "${file:0:1}" == "/" ] || continue
|
pascal@102
|
793 if [ -e $file ]; then
|
pascal@102
|
794 echo "<li><a href=\"index.cgi?file=$file\">$file</a></li>"
|
pascal@102
|
795 else
|
pascal@102
|
796 echo "<li>$file</li>"
|
pascal@102
|
797 fi
|
pascal@102
|
798 done
|
pankso@95
|
799 echo "</ul>"
|
pankso@95
|
800 echo "</pre>" ;;
|
pankso@95
|
801 quickcheck)
|
al@303
|
802 LOADING_MSG=$(gettext 'Checking packages consistency...')
|
pankso@95
|
803 loading_msg
|
pankso@95
|
804 echo "<pre>"
|
pankso@95
|
805 tazpkg check
|
pankso@95
|
806 echo "</pre>" ;;
|
pankso@95
|
807 fullcheck)
|
al@303
|
808 LOADING_MSG=$(gettext 'Full packages check...')
|
pankso@95
|
809 loading_msg
|
pankso@95
|
810 echo "<pre>"
|
pankso@95
|
811 tazpkg check --full
|
pankso@95
|
812 echo "</pre>" ;;
|
pankso@95
|
813 esac
|
pankso@95
|
814 cat << EOT
|
al@303
|
815 <h3>$(gettext 'Packages cache')</h3>
|
al@303
|
816
|
pankso@10
|
817 <div>
|
pankso@10
|
818 <form method="get" action="$SCRIPT_NAME">
|
pankso@17
|
819 <p>
|
al@303
|
820 $(eval_gettext 'Packages in the cache: $cache_files ($cache_size)')
|
pankso@98
|
821 <input type="hidden" name="admin" value="clean" />
|
pankso@17
|
822 <input type="submit" value="Clean" />
|
pankso@17
|
823 </p>
|
pankso@10
|
824 </form>
|
pankso@10
|
825 </div>
|
al@303
|
826
|
al@303
|
827 <h3>$(gettext 'Default mirror')</h3>
|
al@303
|
828
|
al@303
|
829 <pre>$(cat /var/lib/tazpkg/mirror)</pre>
|
al@303
|
830
|
al@303
|
831 <h3>$(gettext 'Current mirror list')</h3>
|
pascal@138
|
832 EOT
|
pascal@138
|
833 for i in $LOCALSTATE/mirrors $LOCALSTATE/undigest/*/mirrors; do
|
pascal@138
|
834 [ -s $i ] || continue
|
pascal@146
|
835 echo '<div class="box">'
|
al@303
|
836 if [ $i != $LOCALSTATE/mirrors ]; then
|
al@303
|
837 Repo_Name="$(repo_name $(dirname $i))"
|
al@303
|
838 echo "<h4>$(eval_gettext 'Repository: $Repo_Name')</h4>"
|
al@303
|
839 fi
|
pascal@138
|
840 echo "<ul>"
|
pascal@138
|
841 list_mirrors $i
|
pascal@138
|
842 echo "</ul>"
|
pascal@138
|
843 cat << EOT
|
pascal@138
|
844 </div>
|
pascal@138
|
845 <form method="get" action="$SCRIPT_NAME">
|
pascal@138
|
846 <p>
|
pascal@138
|
847 <input type="hidden" name="admin" value="add-mirror" />
|
pascal@138
|
848 <input type="hidden" name="file" value="$i" />
|
pascal@138
|
849 <input type="text" name="mirror" size="60">
|
pascal@138
|
850 <input type="submit" value="Add mirror" />
|
pascal@138
|
851 </p>
|
pascal@138
|
852 </form>
|
pascal@138
|
853 EOT
|
pascal@138
|
854 done
|
al@303
|
855 echo "<h3>$(gettext 'Private repositories')</h3>"
|
pascal@139
|
856 [ -n "$(ls $LOCALSTATE/undigest 2> /dev/null)" ] && cat << EOT
|
pankso@10
|
857 <div class="box">
|
pankso@10
|
858 <ul>
|
pascal@138
|
859 $(list_repos)
|
pankso@10
|
860 </ul>
|
pankso@10
|
861 </div>
|
pascal@139
|
862 EOT
|
pascal@139
|
863 cat << EOT
|
pankso@10
|
864 <form method="get" action="$SCRIPT_NAME">
|
pankso@10
|
865 <p>
|
pascal@138
|
866 <input type="hidden" name="admin" value="add-repo" />
|
al@303
|
867 $(gettext 'Name') <input type="text" name="repository" size="10">
|
al@303
|
868 $(gettext 'mirror')
|
pascal@138
|
869 <input type="text" name="mirror" value="http://" size="50">
|
pascal@138
|
870 <input type="submit" value="Add repository" />
|
pankso@10
|
871 </p>
|
pankso@10
|
872 </form>
|
al@303
|
873
|
al@303
|
874 <h3>$(gettext 'Link to another SliTaz installation')</h3>
|
al@303
|
875
|
al@303
|
876 <p>$(gettext "This link points to the root of another SliTaz installation. \
|
al@303
|
877 You will be able to install packages using soft links to it.")</p>
|
al@303
|
878
|
pascal@140
|
879 <form method="get" action="$SCRIPT_NAME">
|
pascal@140
|
880 <p>
|
pascal@140
|
881 <input type="hidden" name="admin" value="add-link" />
|
al@292
|
882 <input type="text" name="link"
|
pascal@140
|
883 value="$(readlink $LOCALSTATE/fslink 2> /dev/null)" size="50">
|
al@303
|
884 <input type="submit" name="admin" value="$(gettext 'Set link')" />
|
al@303
|
885 <input type="submit" name="admin" value="$(gettext 'Remove link')" />
|
pascal@140
|
886 </p>
|
pascal@140
|
887 </form>
|
pankso@10
|
888 EOT
|
pascal@101
|
889 version=$(cat /etc/slitaz-release)
|
pascal@101
|
890 cat << EOT
|
pascal@101
|
891
|
al@303
|
892 <h3 id="dvd">$(gettext 'SliTaz packages DVD')</h3>
|
al@303
|
893
|
al@303
|
894 <p>$(eval_gettext "A bootable DVD image of all available packages for the \
|
al@303
|
895 \$version version is generated every day. It also contains a copy of the \
|
al@303
|
896 website and can be used without an internet connection. This image can be \
|
al@303
|
897 installed on a DVD or an USB key.")</p>
|
al@303
|
898
|
pankso@111
|
899 <div>
|
pankso@111
|
900 <form method="post" action='$SCRIPT_NAME?admin&action=dvdimage#dvd'>
|
pankso@111
|
901 <p>
|
pankso@111
|
902 <a class="button"
|
pankso@111
|
903 href='http://mirror.slitaz.org/iso/$version/packages-$version.iso'>
|
al@303
|
904 <img src="$IMAGES/tazpkg.png" />$(gettext 'Download DVD image')</a>
|
pankso@111
|
905 <a class="button" href='$SCRIPT_NAME?admin&action=dvdusbkey#dvd'>
|
al@303
|
906 <img src="$IMAGES/tazpkg.png" />$(gettext 'Install from DVD/USB key')</a>
|
pankso@111
|
907 </p>
|
pankso@111
|
908 <div class="box">
|
al@303
|
909 $(gettext 'Install from ISO image:')
|
pankso@111
|
910 <input type="text" name="dvdimage" size="40" value="/root/packages-$version.iso">
|
pankso@111
|
911 </div>
|
pascal@101
|
912 </form>
|
pascal@101
|
913 </div>
|
pascal@101
|
914 EOT
|
pascal@101
|
915 if [ "$(GET action)" == "dvdimage" ]; then
|
pascal@101
|
916 dev=$(POST dvdimage)
|
pascal@101
|
917 mkdir -p /mnt/packages 2> /dev/null
|
pascal@101
|
918 echo "<pre>"
|
pascal@101
|
919 mount -t iso9660 -o loop,ro $dev /mnt/packages &&
|
pascal@101
|
920 /mnt/packages/install.sh &&
|
pascal@101
|
921 echo "$dev is installed on /mnt/packages"
|
pascal@101
|
922 echo "</pre>"
|
pascal@101
|
923 fi
|
pascal@101
|
924 if [ "$(GET action)" == "dvdusbkey" ]; then
|
pascal@101
|
925 mkdir -p /mnt/packages 2> /dev/null
|
pascal@101
|
926 for tag in "LABEL=\"packages-$version\" TYPE=\"iso9660\"" \
|
pascal@101
|
927 "LABEL=\"sources-$version\" TYPE=\"iso9660\"" ; do
|
pascal@101
|
928 dev=$(blkid | grep "$tag" | cut -d: -f1)
|
pascal@101
|
929 [ -n "$dev" ] || continue
|
pascal@101
|
930 echo "<pre>"
|
pascal@101
|
931 mount -t iso9660 -o ro $dev /mnt/packages &&
|
pascal@101
|
932 /mnt/packages/install.sh &&
|
pascal@101
|
933 echo "$dev is installed on /mnt/packages"
|
pascal@101
|
934 echo "</pre>"
|
pascal@101
|
935 break
|
pascal@101
|
936 done
|
pascal@101
|
937 fi
|
pankso@10
|
938 ;;
|
pankso@7
|
939 *)
|
pankso@14
|
940 #
|
pankso@7
|
941 # Default to summary
|
pankso@14
|
942 #
|
pankso@10
|
943 search_form
|
pankso@41
|
944 sidebar
|
pascal@92
|
945 [ -n "$(GET block)" ] && tazpkg block $(GET block)
|
pascal@92
|
946 [ -n "$(GET unblock)" ] && tazpkg unblock $(GET unblock)
|
pankso@7
|
947 cat << EOT
|
al@303
|
948 <h2>$(gettext 'Summary')</h2>
|
al@303
|
949
|
pankso@9
|
950 <div id="actions">
|
al@303
|
951 <a class="button" href="$SCRIPT_NAME?list">
|
al@303
|
952 <img src="$IMAGES/tazpkg.png" />$(gettext 'My packages')</a>
|
pascal@140
|
953 EOT
|
pascal@145
|
954 fslink=$(readlink $LOCALSTATE/fslink)
|
pascal@145
|
955 [ -n "$fslink" -a -d "$fslink/$INSTALLED" ] &&
|
pascal@140
|
956 cat << EOT
|
al@303
|
957 <a class="button" href="$SCRIPT_NAME?linkable">
|
al@303
|
958 <img src="$IMAGES/tazpkg.png" />$(gettext 'Linkable packages')</a>
|
pascal@140
|
959 EOT
|
pascal@140
|
960 cat << EOT
|
al@303
|
961 <a class="button" href="$SCRIPT_NAME?recharge">
|
al@303
|
962 <img src="$IMAGES/recharge.png" />$(gettext 'Recharge list')</a>
|
al@303
|
963 <a class="button" href="$SCRIPT_NAME?up">
|
al@303
|
964 <img src="$IMAGES/update.png" />$(gettext 'Check upgrades')</a>
|
al@303
|
965 <a class="button" href="$SCRIPT_NAME?admin">
|
al@303
|
966 <img src="$IMAGES/edit.png" />$(gettext 'Administration')</a>
|
pankso@9
|
967 </div>
|
pankso@41
|
968
|
al@303
|
969 $(packages_summary)
|
al@303
|
970
|
al@303
|
971
|
al@303
|
972 <h3>$(gettext 'Latest log entries')</h3>
|
al@303
|
973
|
pankso@10
|
974 <pre>
|
pankso@45
|
975 `tail -n 5 /var/log/tazpkg.log | fgrep "-" | \
|
pankso@10
|
976 awk '{print $1, $2, $3, $4, $5, $6, $7}'`
|
pankso@10
|
977 </pre>
|
pankso@7
|
978 EOT
|
pankso@10
|
979 ;;
|
pankso@7
|
980 esac
|
pankso@7
|
981
|
pankso@7
|
982 # xHTML 5 footer
|
pankso@33
|
983 xhtml_footer
|
pankso@7
|
984 exit 0
|