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