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