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@755
|
9 # (C) 2011-2015 SliTaz GNU/Linux - BSD License
|
pascal@627
|
10 #
|
pascal@627
|
11
|
pascal@627
|
12 . lib/libtazpanel
|
al@725
|
13
|
al@725
|
14 . /etc/slitaz/slitaz.conf
|
al@725
|
15 . /etc/slitaz/tazpkg.conf
|
al@725
|
16
|
al@776
|
17 export TEXTDOMAIN='tazpkg'
|
al@776
|
18
|
pascal@627
|
19 get_config
|
pascal@627
|
20
|
al@741
|
21 _() { local T="$1"; shift; printf "$(gettext "$T")" "$@"; echo; }
|
al@741
|
22 _n() { local T="$1"; shift; printf "$(gettext "$T")" "$@"; }
|
al@741
|
23 _p() {
|
al@763
|
24 local S="$1" P="$2" N="$3"; shift 3;
|
al@741
|
25 printf "$(ngettext "$S" "$P" "$N")" "$@"; }
|
al@741
|
26
|
al@776
|
27
|
pascal@764
|
28 #------
|
pascal@764
|
29 # menu
|
pascal@764
|
30 #------
|
al@776
|
31
|
pascal@764
|
32 case "$1" in
|
pascal@764
|
33 menu)
|
pascal@764
|
34 TEXTDOMAIN_original=$TEXTDOMAIN
|
pascal@764
|
35 export TEXTDOMAIN='tazpkg'
|
pascal@764
|
36
|
pascal@764
|
37 cat <<EOT
|
pascal@764
|
38 <li tabindex="0">
|
pascal@764
|
39 <span>$(gettext 'Packages')</span>
|
pascal@764
|
40 <menu>
|
pascal@771
|
41 <li><a data-icon="info" href="pkgs.cgi">$(gettext 'Summary')</a></li>
|
pascal@771
|
42 <li><a data-icon="list" href="pkgs.cgi?list&my=my&cat=all&repo=Any">$(gettext 'My packages')</a></li>
|
pascal@771
|
43 <li><a data-icon="refresh" href="pkgs.cgi?recharge" data-root>$(gettext 'Recharge list')</a></li>
|
pascal@771
|
44 <li><a data-icon="upgrade" href="pkgs.cgi?up" data-root>$(gettext 'Check updates')</a></li>
|
pascal@771
|
45 <li><a data-icon="admin" href="pkgs.cgi?admin" data-root>$(gettext 'Administration')</a></li>
|
pascal@764
|
46 </menu>
|
pascal@764
|
47 </li>
|
pascal@764
|
48 EOT
|
pascal@764
|
49 export TEXTDOMAIN=$TEXTDOMAIN_original
|
pascal@764
|
50 exit
|
pascal@764
|
51 esac
|
pascal@764
|
52
|
al@776
|
53
|
al@707
|
54
|
al@786
|
55 #
|
al@776
|
56 # AJAX commands
|
al@786
|
57 #
|
al@776
|
58
|
al@776
|
59 case " $(GET) " in
|
al@776
|
60
|
al@776
|
61
|
al@776
|
62 *\ filelist\ * )
|
al@776
|
63 # Show installed files list
|
al@776
|
64 pkg=$(GET pkg)
|
al@776
|
65 cd $PKGS_DB
|
al@776
|
66
|
al@786
|
67 header
|
al@776
|
68 if [ -d $INSTALLED/$pkg ]; then
|
al@776
|
69 files="$(wc -l < $INSTALLED/$pkg/files.list)"
|
al@785
|
70 cat <<EOT
|
al@776
|
71 <pre class="scroll">$(sort $INSTALLED/$pkg/files.list)</pre>
|
al@776
|
72 <footer>$(_p '%s file' '%s files' $files $files)</footer>
|
al@776
|
73 EOT
|
al@776
|
74 else
|
al@785
|
75 cat <<EOT
|
al@776
|
76 <pre class="scroll">$(lzcat files.list.lzma undigest/*/files.list.lzma \
|
al@776
|
77 2>/dev/null | awk -vp="$pkg:" '$1==p{print $2}' | sort)</pre>
|
al@776
|
78 EOT
|
al@776
|
79 fi
|
al@776
|
80 exit 0 ;;
|
al@776
|
81
|
al@776
|
82
|
al@776
|
83 *\ status\ * )
|
al@776
|
84 # Show package status
|
al@776
|
85 pkg=$(GET pkg)
|
al@776
|
86 class='pkg'
|
al@776
|
87
|
al@778
|
88 if grep -q "^$pkg"$'\t' $PKGS_DB/installed.info; then
|
al@776
|
89 class='pkgi'
|
al@778
|
90 grep -q "^$pkg$" $PKGS_DB/blocked-packages.list && class='pkgib'
|
al@776
|
91 fi
|
al@776
|
92
|
al@786
|
93 header
|
al@779
|
94 echo -n "<a data-icon=\"$class\" href=\"?info=${pkg//+/%2B}\">$pkg</a>"
|
al@776
|
95 exit 0 ;;
|
al@776
|
96
|
al@788
|
97
|
al@786
|
98 *\ app_img\ * )
|
al@786
|
99 # Show application image
|
al@786
|
100 pkg=$(GET app_img)
|
al@791
|
101
|
al@791
|
102 # check for icons defined with packages.icons file
|
al@788
|
103 if [ -f "$PKGS_DB/packages.icons" ]; then
|
al@788
|
104 predefined_icon="$(awk -F$'\t' -vpkg="$pkg" '{if ($1 == pkg) print $2}' $PKGS_DB/packages.icons)"
|
al@788
|
105 fi
|
al@788
|
106 predefined_icon="${predefined_icon:-package-x-generic}.png"
|
al@788
|
107
|
al@786
|
108 current_user="$(who | cut -d' ' -f1)"
|
al@786
|
109 if [ -n "$current_user" ]; then
|
al@786
|
110 current_user_home="$(awk -F: -vu=$current_user '{if($1==u) print $6}' /etc/passwd)"
|
al@791
|
111 current_icon_theme="$(grep gtk-icon-theme-name $current_user_home/.gtkrc-2.0 | cut -d'"' -f2)"
|
al@791
|
112 fi
|
al@791
|
113 current_icon_theme="/usr/share/icons/$current_icon_theme"
|
al@786
|
114
|
al@791
|
115 # Preferred default icon is 48px package-x-generic
|
al@791
|
116 default_pkg_icon="$(find -L $current_icon_theme -type f -path '*48*' -name $predefined_icon | head -n1)"
|
al@791
|
117 # ... or package-x-generic with the bigger size
|
al@791
|
118 if [ -z "$default_pkg_icon" ]; then
|
al@791
|
119 default_pkg_icon="$(find -L $current_icon_theme -type f -name $predefined_icon | sort | tail -n1)"
|
al@786
|
120 fi
|
al@791
|
121
|
al@791
|
122 # Preferred package icon size is 48px
|
al@791
|
123 pkg_icon="$(find -L $current_icon_theme -type f -path '*48*' -name "$pkg.png" | head -n1)"
|
al@791
|
124 # ... or just bigger one
|
al@791
|
125 if [ -z "$pkg_icon" ]; then
|
al@791
|
126 pkg_icon="$(find -L $current_icon_theme -type f -name "$pkg.png" | sort | tail -n1)"
|
al@791
|
127 fi
|
al@791
|
128 # ... or one from pixmaps
|
al@791
|
129 if [ -z "$pkg_icon" ]; then
|
al@791
|
130 pkg_icon="$(find -L /usr/share/pixmaps -type f -name "$pkg.png" | head -n1)"
|
al@791
|
131 fi
|
al@791
|
132
|
al@791
|
133 header "Content-Type: image/png"
|
al@791
|
134 cat "${pkg_icon:-$default_pkg_icon}"
|
al@786
|
135 exit 0 ;;
|
al@786
|
136
|
al@788
|
137
|
al@786
|
138 *\ show_receipt\ * )
|
al@786
|
139 # Show package receipt
|
al@786
|
140 pkg=$(GET show_receipt)
|
al@786
|
141 if [ -d "$INSTALLED/$pkg" ]; then
|
al@786
|
142 # Redirects to the receipt view
|
al@786
|
143 header "HTTP/1.1 301 Moved Permanently" "Location: index.cgi?file=$INSTALLED/$pkg/receipt"
|
al@786
|
144 exit 0
|
al@786
|
145 else
|
al@786
|
146 temp_receipt=$(mktemp -d)
|
al@786
|
147 wget -O $temp_receipt/receipt -T 5 http://hg.slitaz.org/wok/raw-file/tip/$pkg/receipt
|
al@786
|
148 if [ -e "$temp_receipt" ]; then
|
al@786
|
149 # Redirects to the receipt view
|
al@786
|
150 header "HTTP/1.1 301 Moved Permanently" "Location: index.cgi?file=$temp_receipt/receipt"
|
al@786
|
151 exit 0
|
al@786
|
152 else
|
al@786
|
153 header; xhtml_header
|
al@786
|
154 msg err "$(_ 'Receipt for package %s unavailable' $pkg)"
|
al@786
|
155 xhtml_footer
|
al@786
|
156 exit 0
|
al@786
|
157 fi
|
al@786
|
158 fi
|
al@786
|
159 ;;
|
al@786
|
160
|
al@776
|
161 esac
|
al@776
|
162
|
al@776
|
163
|
al@786
|
164 header
|
al@786
|
165
|
al@786
|
166
|
pascal@627
|
167 # xHTML 5 header with special side bar for categories.
|
al@814
|
168 TITLE=$(TEXTDOMAIN='tazpkg'; _ 'Packages')
|
pascal@627
|
169
|
al@707
|
170
|
al@761
|
171 pkg_info_link() {
|
al@758
|
172 echo "<a data-icon=\"$2\" href=\"?info=${1//+/%2B}\">$1</a>" | sed 's| data-icon=""||'
|
pascal@627
|
173 }
|
pascal@627
|
174
|
al@707
|
175
|
al@718
|
176 # Display localized short description
|
al@718
|
177
|
pascal@627
|
178 i18n_desc() {
|
al@717
|
179 for L in $LANG ${LANG%%_*}; do
|
al@717
|
180 if [ -e "$PKGS_DB/packages-desc.$L" ]; then
|
al@718
|
181 LOCDESC=$(awk -F$'\t' -vp=$1 '{if ($1 == p) print $2}' $PKGS_DB/packages-desc.$L)
|
al@717
|
182 if [ -n "$LOCDESC" ]; then
|
al@717
|
183 SHORT_DESC="$LOCDESC"
|
al@717
|
184 break
|
al@717
|
185 fi
|
al@717
|
186 fi
|
al@717
|
187 done
|
pascal@627
|
188 }
|
pascal@627
|
189
|
al@707
|
190
|
pascal@627
|
191 # We need packages information for list and search
|
al@707
|
192
|
pascal@627
|
193 parse_packages_desc() {
|
pascal@627
|
194 IFS="|"
|
al@762
|
195 cut -f 1,2,3 -d "|" | while read PACKAGE VERSION SHORT_DESC
|
pascal@627
|
196 do
|
al@718
|
197 class=pkg; [ -d $INSTALLED/${PACKAGE% } ] && class=pkgi
|
al@718
|
198 i18n_desc $PACKAGE
|
al@785
|
199 cat <<EOT
|
pascal@627
|
200 <tr>
|
al@755
|
201 <td><input type="checkbox" name="pkg" value="$PACKAGE">$(pkg_info_link $PACKAGE $class)</td>
|
al@755
|
202 <td>$VERSION</td>
|
al@755
|
203 <td>$SHORT_DESC</td>
|
al@718
|
204 </tr>
|
al@718
|
205 EOT
|
al@718
|
206 done
|
al@718
|
207 unset IFS
|
al@718
|
208 }
|
al@718
|
209
|
al@718
|
210
|
al@718
|
211 parse_packages_info() {
|
al@718
|
212 IFS=$'\t'
|
al@718
|
213 while read PACKAGE VERSION CATEGORY SHORT_DESC WEB_SITE TAGS SIZES DEPENDS; do
|
al@763
|
214 class='pkg'
|
al@763
|
215 if grep -q "^$PACKAGE"$'\t' $PKGS_DB/installed.info; then
|
al@763
|
216 class='pkgi'
|
al@763
|
217 grep -q "^$PACKAGE$" $PKGS_DB/blocked-packages.list && class='pkgib'
|
al@763
|
218 fi
|
al@718
|
219 i18n_desc $PACKAGE
|
al@785
|
220 cat <<EOT
|
al@718
|
221 <tr>
|
al@755
|
222 <td><input type="checkbox" name="pkg" value="$PACKAGE">$(pkg_info_link $PACKAGE $class)</td>
|
al@755
|
223 <td>$VERSION</td>
|
al@755
|
224 <td>$SHORT_DESC</td>
|
pascal@627
|
225 </tr>
|
pascal@627
|
226 EOT
|
pascal@627
|
227 done
|
pascal@627
|
228 unset IFS
|
pascal@627
|
229 }
|
pascal@627
|
230
|
al@707
|
231
|
al@724
|
232 # Show button
|
al@724
|
233 show_button() {
|
al@747
|
234 for button in $@; do
|
al@768
|
235 class=''; misc=''
|
al@747
|
236 case $button in
|
al@768
|
237 recharge) class='refresh'; label="$(_ 'Recharge list')"; misc=' data-root' ;;
|
al@768
|
238 up) class='upgrade'; label="$(_ 'Check upgrades')"; misc=' data-root' ;;
|
al@755
|
239 list) class='list'; label="$(_ 'My packages')" ;;
|
al@755
|
240 tags) class='tags'; label="$(_ 'Tags')" ;;
|
al@755
|
241 linkable) class='link'; label="$(_ 'Linkable packages')" ;;
|
al@768
|
242 admin) class='admin'; label="$(_ 'Administration')"; misc=' data-root' ;;
|
al@755
|
243 *Install*nf*) class='install'; label="$(_ 'Install (Non Free)')" ;;
|
al@755
|
244 *Install*) class='install'; label="$(_ 'Install')" ;;
|
al@755
|
245 *Remove*) class='remove'; label="$(_ 'Remove')" ;;
|
al@755
|
246 *Link*) class='link'; label="$(_ 'Link')" ;;
|
al@755
|
247 *Block*) class='lock'; label="$(_ 'Block')" ;;
|
al@755
|
248 *Unblock*) class='unlock'; label="$(_ 'Unblock')" ;;
|
al@762
|
249 *Chblock*) class='chlock'; label="$(_ '(Un)block')" ;;
|
al@755
|
250 *Repack*) class='repack'; label="$(_ 'Repack')" ;;
|
al@755
|
251 *saveconf*) class='save'; label="$(_ 'Save configuration')" ;;
|
al@755
|
252 *listconf*) class='list'; label="$(_ 'List configuration files')" ;;
|
al@755
|
253 *quickcheck*) class='check'; label="$(_ 'Quick check')" ;;
|
al@755
|
254 *fullcheck*) class='check'; label="$(_ 'Full check')" ;;
|
al@755
|
255 *clean*) class='remove'; label="$(_ 'Clean')" ;;
|
al@755
|
256 *setlink*) class='link'; label="$(_ 'Set link')" ;;
|
al@755
|
257 *removelink*) class='unlink'; label="$(_ 'Remove link')" ;;
|
al@755
|
258 *add-mirror) class='add'; label="$(_n 'Add mirror')" ;;
|
al@755
|
259 *add-repo) class='add'; label="$(_n 'Add repository')" ;;
|
al@762
|
260 toggle) class='toggle'; label="$(_n 'Toggle all')" ;;
|
al@747
|
261 esac
|
al@762
|
262 if [ "$button" == 'toggle' ]; then
|
al@762
|
263 echo -n "<span class=\"float-right\"><button data-icon=\"$class\" onclick=\"checkBoxes()\">$label</button></span>"
|
al@762
|
264 else
|
al@768
|
265 echo -n "<button data-icon=\"$class\" name=\"${button%%=*}\" value=\"${button#*=}\"$misc>$label</button>"
|
al@755
|
266 fi
|
al@747
|
267 done
|
al@724
|
268 }
|
al@724
|
269
|
al@724
|
270
|
al@707
|
271
|
pascal@627
|
272 #
|
pascal@627
|
273 # xHTML functions
|
pascal@627
|
274 #
|
pascal@627
|
275
|
al@707
|
276
|
pascal@627
|
277 table_head() {
|
al@785
|
278 cat <<EOT
|
al@755
|
279 <table class="wide zebra pkglist" id="head1">
|
al@755
|
280 <thead id="head2">
|
pascal@627
|
281 <tr>
|
al@707
|
282 <td>$(_ 'Name')</td>
|
al@707
|
283 <td>$(_ 'Version')</td>
|
al@707
|
284 <td>$(_ 'Description')</td>
|
pascal@627
|
285 </tr>
|
al@736
|
286 </thead>
|
al@736
|
287 <tbody>
|
pascal@627
|
288 EOT
|
pascal@627
|
289 }
|
pascal@627
|
290
|
al@707
|
291
|
pascal@627
|
292 sidebar() {
|
al@744
|
293 repo=$(COOKIE repo); repo=${repo:-Public}; [ -n "$(GET repo)" ] && repo=$(GET repo)
|
al@744
|
294 my=$(COOKIE my); my=${my:-my}; [ -n "$(GET my)" ] && my=$(GET my)
|
al@744
|
295 cat=$(COOKIE cat); cat=${cat:-all}; [ -n "$(GET cat)" ] && cat=$(GET cat)
|
al@737
|
296
|
al@785
|
297 cat <<EOT
|
al@744
|
298 <script type="text/javascript">
|
al@744
|
299 function setCookie(name) {
|
al@763
|
300 if (name=='cat') {
|
al@763
|
301 var cats = document.getElementsByName('cat');
|
al@763
|
302 for (var i = 0; i < cats.length; i++) {
|
al@763
|
303 if (cats[i].checked) {
|
al@763
|
304 document.cookie = name + "=" + cats[i].value;
|
al@763
|
305 break;
|
al@763
|
306 }
|
al@763
|
307 }
|
al@763
|
308 } else {
|
al@763
|
309 document.cookie = name+"="+document.getElementById(name).value;
|
al@763
|
310 }
|
al@763
|
311 }
|
al@744
|
312 function setValue(name, value) {
|
al@744
|
313 document.getElementById(name).value=value;
|
al@763
|
314 setCookie(name);
|
al@763
|
315 }
|
al@744
|
316 </script>
|
al@788
|
317 <form method="post" action="?list" style="position: absolute">
|
al@737
|
318
|
pascal@627
|
319 <div id="sidebar">
|
al@744
|
320 <select id="my" value="$my" onchange="setCookie('my'); this.form.submit()">
|
al@738
|
321 <option value="my">$(_ 'My packages')</option>
|
al@741
|
322 <option value="no">$(_ 'All packages')</option>
|
al@737
|
323 </select>
|
al@763
|
324 <script type="text/javascript">setValue('my', "$my")</script>
|
al@737
|
325
|
al@737
|
326 <h4>$(_ 'Categories')</h4>
|
al@737
|
327
|
al@763
|
328 <div class="wide zebra">
|
al@763
|
329 $(echo 'base-system x-window utilities network games graphics office
|
al@763
|
330 multimedia development system-tools security misc meta non-free all
|
al@763
|
331 extra' | tr ' ' '\n' | awk -vcat="$cat" -vn="1" '{
|
al@763
|
332 system("gettext " $1 | getline tr)
|
al@763
|
333 printf "<input type=\"radio\" name=\"cat\" id=\"c%s\" ", n
|
al@763
|
334 printf "value=\"%s\"%s ", $1, $1==cat?" checked":""
|
al@763
|
335 printf "onclick=\"setCookie('cat'); this.form.submit()\">"
|
al@763
|
336 printf "<label for=\"c%s\">%s</label>\n", n, tr
|
al@763
|
337 n++
|
al@763
|
338 }')
|
al@738
|
339 </div>
|
pascal@627
|
340 EOT
|
pascal@783
|
341 #reminder; gettext 'all'; gettext 'extra'
|
pascal@627
|
342
|
al@700
|
343 if [ -d $PKGS_DB/undigest ]; then
|
al@785
|
344 cat <<EOT
|
al@737
|
345 <h4>$(_ 'Repository')</h4>
|
al@707
|
346
|
al@744
|
347 <select id="repo" onchange="setCookie('repo')">
|
al@738
|
348 <option value="Public">$(_ 'Public')</option>
|
al@737
|
349 $(for i in $(ls $PKGS_DB/undigest); do
|
al@738
|
350 echo "<option value=\"$i\">$i</option>"
|
al@737
|
351 done)
|
al@738
|
352 <option value="Any">$(_ 'Any')</option>
|
al@737
|
353 </select>
|
al@744
|
354 <script type="text/javascript">setValue('repo', "$repo")</script>
|
al@741
|
355 EOT
|
al@741
|
356 fi
|
al@785
|
357 cat <<EOT
|
al@755
|
358 <a data-icon="tags" href="?tags">$(_ 'All tags...')</a><br/>
|
al@755
|
359 <a data-icon="list" href="?cats">$(_ 'All categories...')</a>
|
al@741
|
360 </div>
|
al@742
|
361 </form>
|
pascal@627
|
362 EOT
|
pascal@627
|
363 }
|
pascal@627
|
364
|
al@707
|
365
|
pascal@627
|
366 repo_list() {
|
al@814
|
367 if [ -n "$(ls $PKGS_DB/undigest/ 2>/dev/null)" ]; then
|
pascal@627
|
368 case "$repo" in
|
al@707
|
369 Public)
|
al@707
|
370 ;;
|
al@707
|
371 ""|Any)
|
al@707
|
372 for i in $PKGS_DB/undigest/* ; do
|
al@707
|
373 [ -d "$i" ] && echo "$i$1"
|
al@707
|
374 done ;;
|
al@707
|
375 *)
|
al@814
|
376 ls "$PKGS_DB/undigest/$repo$1" 2>/dev/null
|
al@707
|
377 return ;;
|
pascal@627
|
378 esac
|
pascal@627
|
379 fi
|
al@814
|
380 [ -e "$PKGS_DB$1" ] && echo "$PKGS_DB$1"
|
pascal@627
|
381 }
|
pascal@627
|
382
|
al@707
|
383
|
pascal@627
|
384 repo_name() {
|
pascal@627
|
385 case "$1" in
|
al@707
|
386 $PKGS_DB)
|
al@707
|
387 echo "Public" ;;
|
al@707
|
388 $PKGS_DB/undigest/*)
|
al@707
|
389 echo ${1#$PKGS_DB/undigest/} ;;
|
pascal@627
|
390 esac
|
pascal@627
|
391 }
|
pascal@627
|
392
|
al@726
|
393
|
al@744
|
394 header_repo_name() {
|
al@744
|
395 [ -d $PKGS_DB/undigest ] && [ "$repo" != "Public" ] && \
|
al@755
|
396 _ 'Repository: %s' $(repo_name $1)
|
al@744
|
397 }
|
al@744
|
398
|
al@744
|
399
|
al@726
|
400 # Print links to the pages
|
al@726
|
401
|
al@726
|
402 pager() {
|
al@747
|
403 PAGE_SIZE=${PAGE_SIZE:-100}
|
al@747
|
404 [ "$PAGE_SIZE" != "0" ] && \
|
al@747
|
405 awk -F'"' -vpage="$page" -vsize="$PAGE_SIZE" -vnum_lines="$(wc -l < $1)" -vtext="$(_ 'Pages:') " -vurl="?list&page=" '
|
al@726
|
406 BEGIN{
|
al@747
|
407 num_pages = int(num_lines / size) + (num_lines % size != 0)
|
al@726
|
408 if (num_pages != 1) printf "<p>%s", text
|
al@726
|
409 }
|
al@726
|
410 {
|
al@726
|
411 if (num_pages == 1) exit
|
al@747
|
412 r = NR % size
|
al@728
|
413 if (r == 1) {
|
al@747
|
414 p = int(NR / size) + 1
|
al@761
|
415 printf "<button class=\"pages%s\" name=\"page\" value=\"%s\" title=\"%s\n···\n", p==page?" current":"", p, $6
|
al@728
|
416 } else if (r == 0)
|
al@761
|
417 printf "%s\">%s</button> ", $6, int(NR / size)
|
al@726
|
418 }
|
al@726
|
419 END{
|
al@726
|
420 if (num_pages == 1) exit
|
al@761
|
421 if (r != 0) printf "%s\">%s</button>", $6, int(NR / size) + 1
|
al@726
|
422 print "</p>"
|
al@726
|
423 }' $1
|
al@726
|
424 }
|
al@726
|
425
|
al@726
|
426
|
al@736
|
427 # Show packages list by category or tag
|
al@736
|
428
|
al@736
|
429 show_list() {
|
al@747
|
430 PAGE_SIZE=${PAGE_SIZE:-100}
|
al@747
|
431 page=$(GET page); page=${page:-1}
|
al@736
|
432 cached=$(mktemp)
|
al@744
|
433 [ -n "$tag" ] && cat=''
|
al@736
|
434 {
|
al@736
|
435 for L in $LANG ${LANG%%_*}; do
|
al@736
|
436 if [ -e "$PKGS_DB/packages-desc.$L" ]; then
|
al@736
|
437 sed '/^#/d' $PKGS_DB/packages-desc.$L; break
|
al@736
|
438 fi
|
al@736
|
439 done
|
al@736
|
440 [ -e "$i/blocked-packages.list" ] && cat $i/blocked-packages.list
|
al@736
|
441 sed 's|.*|&\ti|' $i/installed.info
|
al@744
|
442 [ "$cat" == 'extra' ] || [ $1 == 'my' ] || cat $i/packages.info
|
pascal@760
|
443 [ "$cat" == 'extra' ] &&
|
al@814
|
444 sed 's,\([^|]*\)|\([^|]*\)|\([^|]*\)|\([^|]*\)|\([^|]*\).*,\1\t\5\textra\t\2\thttp://mirror.slitaz.org/packages/get/\1\t-\t-\t-\t-,' $PKGS_DB/extra.list
|
al@744
|
445 } | sort -t$'\t' -k1,1 | sed '/^$/d' | awk -F$'\t' -vc="${cat:--}" -vt="${tag:--}" '
|
al@736
|
446 {
|
al@736
|
447 if (PKG && PKG != $1) {
|
al@736
|
448 if (SEL) {
|
al@736
|
449 if (DSCL) DSC = DSCL
|
al@761
|
450 printf "<tr><td><input type=\"checkbox\" name=\"pkg\" value=\"%s\" id=\"%s\">", PKG, PKG
|
al@761
|
451 printf "<a data-icon=\"pkg%s%s\" href=\"?info=%s\">%s</a></td>", INS, BLK, gensub(/\+/, "%2B", "g", PKG), PKG
|
al@761
|
452 printf "<td>%s</td><td>%s</td><td><a href=\"%s\"></a></td></tr>\n", VER, DSC, WEB
|
al@736
|
453 }
|
al@736
|
454 VER = DSC = WEB = DSCL = INS = BLK = SEL = ""
|
al@736
|
455 }
|
al@736
|
456
|
al@736
|
457 PKG = $1
|
al@736
|
458 if (NF == 1) { BLK = "b"; next }
|
al@736
|
459 if (NF == 2) { DSCL = $2; next }
|
al@736
|
460 if (c == "all" || $3 == c || index(" "$6" ", " "t" ")) { SEL = 1 }
|
al@736
|
461 if (SEL) {
|
al@814
|
462 if ($10 == "i") { VER = $2; DSC = $4; WEB = $5; INS = "i"; next}
|
al@814
|
463 if (! INS) { VER = $2; DSC = $4; WEB = $5 }
|
al@736
|
464 }
|
al@736
|
465 }' > $cached
|
al@736
|
466
|
al@736
|
467 pager="$(pager $cached)"
|
al@747
|
468 case $PAGE_SIZE in
|
al@747
|
469 0) list="$(cat $cached)";;
|
al@747
|
470 *) list="$(tail -n+$((($page-1)*$PAGE_SIZE+1)) $cached | head -n$PAGE_SIZE)";;
|
al@747
|
471 esac
|
al@747
|
472
|
al@747
|
473 if [ "$pager" != "<p>$(_ 'Pages:') </p>" ] && [ -n "${list:1:1}" ]; then
|
al@785
|
474 cat <<EOT
|
al@755
|
475 <h3>$(header_repo_name $i)</h3>
|
al@744
|
476 $pager
|
al@744
|
477 $(table_head)
|
al@744
|
478 $list
|
al@744
|
479 </tbody></table>
|
al@744
|
480 $pager
|
al@744
|
481 EOT
|
al@737
|
482 fi
|
al@736
|
483 rm -f $cached
|
al@761
|
484
|
al@761
|
485
|
al@761
|
486 ### Re-select packages when you return to the page
|
al@761
|
487
|
al@761
|
488 # Find the packages list
|
al@761
|
489 pkgs=$(echo "$QUERY_STRING&" | awk 'BEGIN{RS="&";FS="="}
|
al@761
|
490 {if ($1=="pkg") printf "\"%s\", ", $2}')
|
al@761
|
491 pkgs=$(httpd -d "${pkgs%, }")
|
al@761
|
492 # now pkgs='"pkg1", "pkg2", ... "pkgn"'
|
al@761
|
493
|
al@761
|
494 if [ -n "$pkgs" ]; then
|
al@785
|
495 cat <<EOT
|
al@761
|
496 <script type="text/javascript">
|
al@761
|
497 var pkgs = [$pkgs];
|
al@761
|
498 var theForm = document.getElementById('pkglist');
|
al@761
|
499 for (index = 0; index < pkgs.length; index++) {
|
al@761
|
500 if (document.getElementById(pkgs[index])) {
|
al@761
|
501 // check existing
|
al@761
|
502 document.getElementById(pkgs[index]).checked = 'true';
|
al@761
|
503 }
|
al@761
|
504 else {
|
al@761
|
505 // add other as hidden
|
al@761
|
506 var hInput = document.createElement('input');
|
al@761
|
507 hInput.type = 'hidden';
|
al@761
|
508 hInput.name = 'pkg';
|
al@761
|
509 hInput.value = pkgs[index];
|
al@761
|
510 theForm.appendChild(hInput);
|
al@761
|
511 }
|
al@761
|
512 }
|
al@762
|
513 document.getElementById('countSelected').innerText = pkgs.length;
|
al@761
|
514 </script>
|
al@761
|
515 EOT
|
al@761
|
516 fi
|
al@736
|
517 }
|
al@736
|
518
|
al@736
|
519
|
al@727
|
520 # Show links for "info" page
|
al@727
|
521
|
al@727
|
522 show_info_links() {
|
al@727
|
523 if [ -n "$1" ]; then
|
al@778
|
524 if [ "$3" == 'tag' ]; then icon='tag'; else icon='clock'; fi
|
al@727
|
525 echo -n "<tr><td><b>$2</b></td><td>"
|
al@778
|
526 echo $1 | tr ' ' $'\n' | awk -vt="$3" -vi="$icon" '{
|
al@778
|
527 printf "<span><a data-icon=\"%s\" ", i;
|
al@778
|
528 printf "href=\"?%s=%s\">%s</a></span>Â Â ", t, gensub(/\+/, "%2B", "g", $1), $1
|
al@727
|
529 }'
|
al@727
|
530 echo "</td></tr>"
|
al@727
|
531 fi
|
al@727
|
532 }
|
al@727
|
533
|
al@727
|
534
|
al@814
|
535 tazpanel_header() {
|
al@814
|
536 xhtml_header "$1" | sed 's/id="content"/id="content-sidebar"/'
|
al@814
|
537 cat <<EOT
|
al@814
|
538 <form class="search"><!--
|
al@814
|
539 --><a data-icon="web" href="http://pkg.slitaz.org/" target="_blank" title="$(_n 'Web search tool')"></a> <!--
|
al@814
|
540 --><input type="search" name="search" value="$(GET search)" results="5" autosave="pkgsearch" autocomplete="on"><!--
|
al@814
|
541 --><button type="submit">$(_n 'Search')</button><!--
|
al@814
|
542 --><button name="files" value="yes">$(_n 'Files')</button><!--
|
al@814
|
543 --></form>
|
al@814
|
544 EOT
|
al@814
|
545 sidebar
|
al@814
|
546 }
|
al@814
|
547
|
al@814
|
548
|
al@814
|
549
|
al@707
|
550
|
pascal@627
|
551 #
|
pascal@627
|
552 # Commands
|
pascal@627
|
553 #
|
pascal@627
|
554
|
al@707
|
555
|
pascal@627
|
556 case " $(GET) " in
|
al@741
|
557
|
al@741
|
558
|
pascal@627
|
559 *\ linkable\ *)
|
pascal@627
|
560 #
|
pascal@627
|
561 # List linkable packages.
|
pascal@627
|
562 #
|
al@814
|
563 tazpanel_header "$(_ 'Linkable packages')"
|
al@806
|
564 loading_msg "$(_ 'Listing linkable packages...')"
|
al@744
|
565
|
al@785
|
566 cat <<EOT
|
al@755
|
567 <form class="wide">
|
al@755
|
568 $(_ 'Selection:') $(show_button do=Link)
|
pascal@627
|
569 EOT
|
al@736
|
570 table_head
|
al@700
|
571 target=$(readlink $PKGS_DB/fslink)
|
al@707
|
572 for pkg in $(ls $target/$INSTALLED); do
|
pascal@627
|
573 [ -s $pkg/receipt ] && continue
|
pascal@627
|
574 . $target/$INSTALLED/$pkg/receipt
|
al@718
|
575 i18n_desc $pkg
|
al@785
|
576 cat <<EOT
|
pascal@627
|
577 <tr>
|
al@758
|
578 <td><input type="checkbox" name="pkg" value="$pkg" /><a data-icon="pkg" href="?info=${pkg//+/%2B}">$pkg</a></td>
|
pascal@627
|
579 <td>$VERSION</td>
|
al@719
|
580 <td>$SHORT_DESC</td>
|
al@758
|
581 <td><a data-img="web" href="$WEB_SITE"></a></td>
|
pascal@627
|
582 </tr>
|
pascal@627
|
583 EOT
|
pascal@627
|
584 done
|
al@785
|
585 cat <<EOT
|
al@736
|
586 </tbody>
|
al@736
|
587 </table>
|
pascal@627
|
588 </form>
|
pascal@627
|
589 EOT
|
pascal@627
|
590 ;;
|
pascal@627
|
591
|
pascal@627
|
592
|
al@744
|
593 *\ cats\ *)
|
pascal@627
|
594 #
|
al@744
|
595 # List of all categories.
|
pascal@627
|
596 #
|
al@814
|
597 tazpanel_header "$(_ 'Categories list')"
|
al@744
|
598
|
al@744
|
599 for pkgsinfo in $(repo_list /packages.info); do
|
al@785
|
600 cat <<EOT
|
al@755
|
601 <section>
|
al@755
|
602 <header>$(header_repo_name $(dirname $pkgsinfo))</header>
|
al@755
|
603 <table class="wide zebra center">
|
al@755
|
604 <thead>
|
al@755
|
605 <tr>
|
al@755
|
606 <td>$(_ 'Category')</td>
|
al@755
|
607 <td>$(_ 'Available packages')</td>
|
al@755
|
608 <td>$(_ 'Installed packages')</td>
|
al@755
|
609 </tr>
|
al@755
|
610 </thead>
|
al@755
|
611 <tbody>
|
al@728
|
612 EOT
|
al@728
|
613 {
|
al@744
|
614 awk -F$'\t' '{print $3}' $pkgsinfo | sort | uniq -c
|
al@728
|
615 awk -F$'\t' '{print $3}' $PKGS_DB/installed.info | sed 's|.*|& i|' | sort | uniq -c
|
al@728
|
616 } | sort -k2,2 | awk '
|
al@728
|
617 {
|
al@728
|
618 c [$2] = "."
|
al@728
|
619 if ($3) { i[$2] = $1; } else { m[$2] = $1; }
|
al@728
|
620 }
|
al@728
|
621 END {
|
al@728
|
622 for (n in c) print n, m[n], i[n]
|
al@744
|
623 }' | sort | awk '{
|
al@744
|
624 printf "<tr><td><a href=\"?list&cat=%s\">%s</a></td><td>%d</td><td>%d</td></tr>", $1, $1, $2, $3
|
al@728
|
625 }'
|
al@785
|
626 cat <<EOT
|
al@755
|
627 </tbody>
|
al@755
|
628 </table>
|
al@755
|
629 </section>
|
al@755
|
630 EOT
|
al@744
|
631 done
|
al@744
|
632 ;;
|
al@744
|
633
|
al@744
|
634
|
al@761
|
635 *\ list\ *|*\ page\ *)
|
al@744
|
636 #
|
al@744
|
637 # List all packages by category.
|
al@744
|
638 #
|
al@814
|
639 tazpanel_header "$(_ 'Packages list')"
|
al@806
|
640 loading_msg "$(_ 'Listing packages...')"
|
al@744
|
641
|
al@744
|
642 bcat="<b>$cat</b>"; brepo="<b>$repo</b>"
|
al@744
|
643 case $repo in
|
al@744
|
644 Any)
|
al@744
|
645 case $my in
|
al@744
|
646 my) title="$(_ 'Installed packages of category "%s"' "$bcat")" ;;
|
al@744
|
647 *) title="$(_ 'All packages of category "%s"' "$bcat")" ;;
|
al@744
|
648 esac ;;
|
al@744
|
649 *)
|
al@744
|
650 case $my in
|
al@744
|
651 my) title="$(_ 'Installed packages of category "%s" in repository "%s"' "$bcat" "$brepo")" ;;
|
al@744
|
652 *) title="$(_ 'All packages of category "%s" in repository "%s"' "$bcat" "$brepo")" ;;
|
al@744
|
653 esac ;;
|
al@744
|
654 esac
|
al@744
|
655
|
al@785
|
656 cat <<EOT
|
al@744
|
657 <p>$title</p>
|
pascal@764
|
658 EOT
|
al@782
|
659
|
al@782
|
660 [ ! -f $PKGS_DB/packages.info ] && msg warn \
|
al@782
|
661 "$(_ 'You can not view a list of all packages until recharging lists.')"
|
al@782
|
662
|
al@785
|
663 [ "$REMOTE_USER" == "root" ] && cat <<EOT
|
al@762
|
664 <section>
|
al@762
|
665 <div>$(_ 'Selected packages:') <span id="countSelected"></span></div>
|
al@762
|
666 <footer>
|
al@762
|
667 $({
|
al@762
|
668 [ "$my" != 'my' ] && show_button do=Install
|
al@762
|
669 show_button do=Chblock do=Remove
|
al@762
|
670 } | sed 's|button |button form="pkglist" |g')
|
al@762
|
671 $(show_button toggle)
|
al@762
|
672 </footer>
|
al@762
|
673 </section>
|
pascal@764
|
674 EOT
|
al@785
|
675 cat <<EOT
|
al@758
|
676
|
al@758
|
677 <form id="pkglist" class="wide">
|
pascal@627
|
678 EOT
|
al@744
|
679 for i in $(repo_list ""); do
|
al@744
|
680 show_list ${my#no}
|
al@744
|
681 done
|
al@785
|
682 cat <<EOT
|
al@755
|
683 </form>
|
al@762
|
684 <script type="text/javascript">window.onscroll = scrollHandler; setCountSelPkgs();</script>
|
al@755
|
685 EOT
|
al@728
|
686 ;;
|
pascal@627
|
687
|
pascal@627
|
688
|
pascal@627
|
689 *\ search\ *)
|
pascal@627
|
690 #
|
pascal@627
|
691 # Search for packages. Here default is to search in packages.desc
|
pascal@627
|
692 # and so get result including packages names and descriptions
|
pascal@627
|
693 #
|
al@814
|
694 tazpanel_header "$(_ 'Search packages')"
|
al@814
|
695 loading_msg "$(_ 'Searching packages...')"
|
al@814
|
696
|
al@725
|
697 pkg=$(GET search); [ -z "$pkg" ] && xhtml_footer && exit
|
al@718
|
698 cd $PKGS_DB
|
al@744
|
699
|
al@785
|
700 cat <<EOT
|
al@762
|
701 <section>
|
al@762
|
702 <div>$(_ 'Selected packages:') <span id="countSelected"></span></div>
|
al@762
|
703 <footer>
|
al@762
|
704 $(show_button do=Install do=Chblock do=Remove | sed 's|button |button form="pkglist" |g')
|
al@762
|
705 $(show_button toggle)
|
al@762
|
706 </footer>
|
al@762
|
707 </section>
|
al@758
|
708
|
al@758
|
709 <form id="pkglist" class="wide">
|
pascal@627
|
710 EOT
|
al@763
|
711 if [ -n "$(GET files)" -o -n "$(echo $pkg | grep '/')" ]; then
|
pascal@627
|
712 cat <<EOT
|
al@759
|
713 <table class="wide zebra filelist">
|
pascal@627
|
714 <thead>
|
pascal@627
|
715 <tr>
|
al@707
|
716 <td>$(_ 'Package')</td>
|
al@707
|
717 <td>$(_ 'File')</td>
|
pascal@627
|
718 </tr>
|
pascal@627
|
719 <thead>
|
pascal@627
|
720 <tbody>
|
pascal@627
|
721 EOT
|
al@718
|
722 lzcat $(repo_list /files.list.lzma) | grep -Ei ": .*$(GET search)" | \
|
al@718
|
723 while read PACKAGE FILE; do
|
al@718
|
724 PACKAGE=${PACKAGE%:}
|
al@763
|
725 class='pkg'
|
al@763
|
726 if [ -d $INSTALLED/$PACKAGE ]; then
|
al@763
|
727 class='pkgi'
|
al@763
|
728 grep -q "^$PACKAGE$" $PKGS_DB/blocked-packages.list && class='pkgib'
|
al@763
|
729 fi
|
al@785
|
730 cat <<EOT
|
pascal@627
|
731 <tr>
|
al@719
|
732 <td><input type="checkbox" name="pkg" value="$PACKAGE">$(pkg_info_link $PACKAGE $class)</td>
|
al@759
|
733 <td>$(echo "$FILE" | sed "s|$pkg|<span class=\"diff-add\">&</span>|gI")</td>
|
pascal@627
|
734 </tr>
|
pascal@627
|
735 EOT
|
al@718
|
736 done
|
pascal@627
|
737 else
|
al@718
|
738 table_head
|
al@718
|
739 awk -F$'\t' 'BEGIN{IGNORECASE = 1}
|
al@755
|
740 $1 " " $4 ~ /'$pkg'/{print $0}' $(repo_list /packages.info) | parse_packages_info
|
pascal@627
|
741 fi
|
al@785
|
742 cat <<EOT
|
pascal@627
|
743 </tbody>
|
pascal@627
|
744 </table>
|
pascal@627
|
745 </form>
|
al@762
|
746 <script type="text/javascript">window.onscroll = scrollHandler; setCountSelPkgs();</script>
|
pascal@627
|
747 EOT
|
pascal@627
|
748 ;;
|
pascal@627
|
749
|
pascal@627
|
750
|
pascal@627
|
751 *\ recharge\ *)
|
pascal@627
|
752 #
|
pascal@627
|
753 # Lets recharge the packages list
|
pascal@627
|
754 #
|
al@814
|
755 tazpanel_header "$(_ 'Recharge')"
|
al@806
|
756 loading_msg "$(_ 'Recharging lists...')"
|
al@744
|
757
|
al@785
|
758 cat <<EOT
|
al@781
|
759 <p>$(_ 'Recharge checks for new or updated packages')</p>
|
pascal@627
|
760
|
al@781
|
761 <section>
|
al@781
|
762 <header>
|
al@811
|
763 <span data-icon="sync">$(_ 'Recharging log')</span>
|
al@781
|
764 <form>$(show_button up)</form>
|
al@781
|
765 </header>
|
pascal@627
|
766 EOT
|
al@707
|
767 echo $(_ 'Recharging packages list') | log
|
al@811
|
768 export output="html"; tazpkg recharge
|
al@785
|
769 cat <<EOT
|
al@781
|
770 <footer>$(_ 'Packages lists are up-to-date. You should check for upgrades now.')</footer>
|
al@781
|
771 </section>
|
pascal@627
|
772 EOT
|
pascal@627
|
773 ;;
|
pascal@627
|
774
|
pascal@627
|
775
|
pascal@627
|
776 *\ up\ *)
|
pascal@627
|
777 #
|
pascal@627
|
778 # Upgrade packages
|
pascal@627
|
779 #
|
al@814
|
780 tazpanel_header "$(_ 'Up packages')"
|
al@806
|
781 loading_msg "$(_ 'Checking for upgrades...')"
|
al@744
|
782
|
al@785
|
783 cat <<EOT
|
al@762
|
784 <section>
|
al@762
|
785 <div>$(_ 'Selected packages:') <span id="countSelected"></span></div>
|
al@762
|
786 <footer>
|
al@762
|
787 $(show_button do=Install do=Chblock do=Remove | sed 's|button |button form="pkglist" |g')
|
al@762
|
788 $(show_button toggle)
|
al@762
|
789 </footer>
|
al@762
|
790 </section>
|
al@758
|
791
|
al@758
|
792 <form id="pkglist" class="wide">
|
pascal@627
|
793 EOT
|
al@747
|
794 # Ask tazpkg to make "packages.up" file
|
pascal@627
|
795 tazpkg up --check >/dev/null
|
al@736
|
796 table_head
|
al@747
|
797
|
al@747
|
798 for pkg in $(cat $PKGS_DB/packages.up); do
|
al@747
|
799 grep -hs "^$pkg " $PKGS_DB/packages.info $PKGS_DB/undigest/*/packages.info | parse_packages_info
|
pascal@627
|
800 done
|
al@747
|
801
|
al@785
|
802 cat <<EOT
|
al@762
|
803 </tbody>
|
al@762
|
804 </table>
|
al@762
|
805 </form>
|
al@762
|
806 <script type="text/javascript">window.onscroll = scrollHandler; setCountSelPkgs();</script>
|
al@762
|
807 EOT
|
pascal@627
|
808 ;;
|
pascal@627
|
809
|
pascal@627
|
810
|
pascal@627
|
811 *\ do\ *)
|
pascal@627
|
812 #
|
pascal@627
|
813 # Do an action on one or some packages
|
pascal@627
|
814 #
|
al@814
|
815 tazpanel_header "TazPkg: $(GET do)"
|
al@747
|
816 loading_msg
|
al@744
|
817
|
al@747
|
818 # Find the command
|
al@744
|
819 cmd=$(echo $(GET do) | tr [:upper:] [:lower:])
|
al@747
|
820
|
al@747
|
821 # Find the packages list
|
al@744
|
822 pkgs=$(echo $QUERY_STRING | awk 'BEGIN{RS="&";FS="="}{if($1=="pkg")print $2}')
|
al@744
|
823 pkgs=$(httpd -d "$pkgs")
|
al@747
|
824
|
al@747
|
825 # Describe the command
|
al@747
|
826 bpkgs="<b>$pkgs</b>"; opt=''
|
pascal@627
|
827 case $cmd in
|
al@795
|
828 install) MSG="$(_ 'Installing: %s' "$bpkgs")"; opt='--forced'; cmd='get-install' ;;
|
al@762
|
829 remove) MSG="$(_ 'Removing: %s' "$bpkgs")" ;;
|
al@795
|
830 link) MSG="$(_ 'Linking: %s' "$bpkgs")"; opt="$(readlink $PKGS_DB/fslink)" ;;
|
al@762
|
831 block) MSG="$(_ 'Blocking: %s' "$bpkgs")" ;;
|
al@762
|
832 unblock) MSG="$(_ 'Unblocking: %s' "$bpkgs")" ;;
|
al@762
|
833 chblock) MSG="$(_ '(Un)blocking: %s' "$bpkgs")" ;;
|
al@762
|
834 repack) MSG="$(_ 'Repacking: %s' "$bpkgs")" ;;
|
pascal@627
|
835 esac
|
al@747
|
836
|
al@785
|
837 cat <<EOT
|
al@795
|
838 <div>$MSG</div>
|
pascal@627
|
839 EOT
|
al@747
|
840 # Do the command for all asked packages
|
pascal@774
|
841 cd /tmp
|
al@795
|
842 export output='html'
|
al@795
|
843
|
al@707
|
844 for pkg in $pkgs; do
|
al@795
|
845 #echo $(_n 'y') |
|
al@795
|
846 tazpkg $cmd $pkg $opt 2>/dev/null | filter_taztools_msgs
|
al@784
|
847 done
|
al@795
|
848 ;;
|
pascal@627
|
849
|
pascal@627
|
850
|
pascal@627
|
851 *\ info\ *)
|
pascal@627
|
852 #
|
pascal@627
|
853 # Packages info
|
pascal@627
|
854 #
|
al@814
|
855 tazpanel_header "$(_ 'Package info')"
|
al@806
|
856 loading_msg "$(_ 'Getting package info...')"
|
al@744
|
857
|
al@814
|
858 pkg="$(GET info)"
|
al@814
|
859
|
al@814
|
860 # Symbolic icon
|
al@814
|
861 if [ -d "$INSTALLED/$pkg" ]; then
|
al@814
|
862 if grep -q "^$pkg$" "$PKGS_DB/blocked-packages.list"
|
al@814
|
863 then icon='pkgib'
|
al@814
|
864 else icon='pkgi'
|
al@814
|
865 fi
|
al@814
|
866 else icon='pkg'
|
al@814
|
867 fi
|
al@814
|
868
|
al@785
|
869 cat <<EOT
|
al@755
|
870 <section>
|
al@755
|
871 <header>
|
al@814
|
872 <span data-icon="$icon">$(_ 'Package %s' "$pkg")</span>
|
al@755
|
873 <form>
|
al@755
|
874 <input type="hidden" name="pkg" value="${pkg#get-}"/>
|
al@747
|
875 EOT
|
al@747
|
876
|
al@747
|
877 # Get receipt variables, show Install/Remove buttons
|
al@814
|
878 if [ -d "$INSTALLED/$pkg" ]; then
|
pascal@627
|
879 . $INSTALLED/$pkg/receipt
|
al@718
|
880 files=$(wc -l < $INSTALLED/$pkg/files.list)
|
al@814
|
881 [ "$REMOTE_USER" == 'root' ] && show_button do=Remove
|
pascal@627
|
882 else
|
al@718
|
883 cd $PKGS_DB
|
al@727
|
884 eval "$(awk -F$'\t' -vp=$pkg '
|
al@727
|
885 $1==p{
|
al@727
|
886 printf "PACKAGE=\"%s\"; VERSION=\"%s\"; CATEGORY=\"%s\"; ", $1, $2, $3
|
al@727
|
887 printf "SHORT_DESC=\"%s\"; WEB_SITE=\"%s\"; TAGS=\"%s\"; ", $4, $5, $6
|
al@727
|
888 printf "SIZES=\"%s\"; DEPENDS=\"%s\"", $7, $8
|
al@727
|
889 }' packages.info undigest/*/packages.info)"
|
pascal@799
|
890 if [ -z "$PACKAGE" ]; then
|
pascal@799
|
891 eval "$(awk -F'|' -vp=$pkg '
|
pascal@799
|
892 $1==p{
|
pascal@799
|
893 printf "PACKAGE=\"%s\"; SHORT_DESC=\"%s\"; WEB_SITE=\"%s\"; ", $1, $2, $3
|
pascal@799
|
894 printf "CATEGORY=\"%s\"; VERSION=\"%s\"; LICENSE=\"%s\"; ", $4, $5, $6
|
pascal@799
|
895 }' extra.list undigest/*/extra.list)"
|
al@814
|
896 [ -z "$CATEGORY" ] && CATEGORY='non-free'
|
pascal@799
|
897 fi
|
al@727
|
898 PACKED_SIZE=${SIZES% *}
|
al@727
|
899 UNPACKED_SIZE=${SIZES#* }
|
al@814
|
900 [ "$REMOTE_USER" == 'root' ] &&
|
al@747
|
901 if [ "${pkg#get-}" != "$pkg" ]; then
|
al@814
|
902 show_button 'do=Install&nf'
|
al@747
|
903 else
|
al@747
|
904 show_button do=Install
|
al@747
|
905 fi
|
pascal@627
|
906 fi
|
pascal@627
|
907
|
al@747
|
908 # Show Block/Unblock, and Repack buttons
|
pascal@767
|
909 [ "$REMOTE_USER" == "root" ] &&
|
pascal@627
|
910 if [ -d $INSTALLED/$pkg ]; then
|
al@700
|
911 if grep -qs "^$pkg$" $PKGS_DB/blocked-packages.list; then
|
al@744
|
912 show_button do=Unblock
|
pascal@627
|
913 else
|
al@744
|
914 show_button do=Block
|
pascal@627
|
915 fi
|
al@744
|
916 show_button do=Repack
|
pascal@627
|
917 fi
|
al@747
|
918
|
al@747
|
919 # Translate short description
|
al@718
|
920 i18n_desc $pkg
|
al@747
|
921
|
al@747
|
922 # Show info table
|
al@785
|
923 cat <<EOT
|
al@755
|
924 </form>
|
al@755
|
925 </header>
|
al@755
|
926
|
al@778
|
927 <table class="wide zebra summary" id="infoTable">
|
pascal@627
|
928 <tbody>
|
al@814
|
929 <tr><td><b>$(_ 'Name')</b></td><td>$PACKAGE
|
al@814
|
930 <div id="appImg"><img src="pkgs.cgi?app_img=$PACKAGE"/></div>
|
al@814
|
931 </td></tr>
|
al@814
|
932 $([ -n "$VERSION" ] && echo "<tr><td><b>$(_ 'Version')</b></td><td>$VERSION</td></tr>")
|
al@758
|
933 <tr><td><b>$(_ 'Category')</b></td><td><a href="?list&cat=$CATEGORY">$CATEGORY</a></td></tr>
|
al@707
|
934 <tr><td><b>$(_ 'Description')</b></td><td>$SHORT_DESC</td></tr>
|
al@727
|
935 $([ -n "$MAINTAINER" ] && echo "<tr><td><b>$(_ 'Maintainer')</b></td><td>$MAINTAINER</td></tr>")
|
al@727
|
936 $([ -n "$LICENSE" ] && echo "<tr><td><b>$(_ 'License')</b></td><td><a href=\"?license=$pkg\">$LICENSE</a></td></tr>")
|
al@747
|
937 <tr><td><b>$(_ 'Website')</b></td><td><a href="$WEB_SITE" target="_blank">$WEB_SITE</a></td></tr>
|
al@727
|
938 $(show_info_links "$TAGS" "$(_ 'Tags')" 'tag')
|
al@814
|
939 $([ -n "$PACKED_SIZE" ] && echo "<tr><td><b>$(_ 'Sizes')</b></td><td>${PACKED_SIZE/.0/}/${UNPACKED_SIZE/.0/}</td></tr>")
|
al@727
|
940 $(show_info_links "$DEPENDS" "$(_ 'Depends')" 'info')
|
al@727
|
941 $(show_info_links "$SUGGESTED" "$(_ 'Suggested')" 'info')
|
pascal@627
|
942 </tbody>
|
pascal@627
|
943 </table>
|
al@786
|
944
|
al@786
|
945 <footer>
|
al@786
|
946 <a data-icon="text" href="?show_receipt=$pkg">$(_ 'View receipt')</a>
|
al@786
|
947 <a data-icon="slitaz" href="?improve=$pkg">$(_ 'Improve package')</a>
|
al@786
|
948 </footer>
|
al@755
|
949 </section>
|
al@778
|
950 <span id="ajaxStatus" style="display:none"></span>
|
al@778
|
951
|
al@778
|
952 <script type="text/javascript">
|
al@778
|
953 var links = document.getElementById('infoTable').getElementsByTagName('a');
|
al@778
|
954 for (var i = 0; i < links.length; i++) {
|
al@778
|
955 console.log('i=%s, icon=%s.', i, links[i].dataset.icon);
|
al@778
|
956 if (links[i].dataset.icon == 'clock') {
|
al@778
|
957 links[i].parentNode.id = 'link' + i;
|
al@778
|
958 pkg = links[i].innerText.replace(/\+/g, '%2B');
|
al@778
|
959 ajax('pkgs.cgi?status&pkg=' + pkg, '1', 'link' + i);
|
al@778
|
960 }
|
al@778
|
961 }
|
al@778
|
962
|
al@778
|
963 </script>
|
al@717
|
964 EOT
|
al@747
|
965
|
al@747
|
966 # Show description
|
al@727
|
967 DESC="$(tazpkg desc $pkg)"
|
al@778
|
968 [ -n "$DESC" ] && echo "<section><pre class="pre-wrap">$DESC</pre></section>"
|
pascal@627
|
969
|
al@747
|
970 # Show configuration files list
|
al@747
|
971 CONFIGS="$(tazpkg list-config $pkg | sed 's|\(.*\)|\1 \1|')"
|
al@785
|
972 [ -n "$CONFIGS" ] && cat <<EOT
|
al@755
|
973 <section>
|
al@755
|
974 <header>$(_ 'Configuration files')</header>
|
al@755
|
975 <pre>$(printf '<a href="index.cgi?file=%s">%s</a>\n' $CONFIGS)</pre>
|
al@755
|
976 </section>
|
al@755
|
977 EOT
|
al@747
|
978
|
al@747
|
979 # Show installed files list
|
al@781
|
980 pkg=${pkg//+/%2B}
|
al@776
|
981 cat <<EOT
|
al@755
|
982 <section>
|
al@776
|
983 <header>$(_ 'Installed files')</header>
|
al@776
|
984 <span id="fileList">
|
al@776
|
985 <div style="text-align: center;"><span id="ajaxStatus"></span>$(_ 'Please wait')</div>
|
al@776
|
986 </span>
|
al@755
|
987 </section>
|
al@776
|
988 <script type="text/javascript">ajax('pkgs.cgi?filelist&pkg=$pkg', '1', 'fileList');</script>
|
pascal@627
|
989 EOT
|
pascal@627
|
990 ;;
|
pascal@627
|
991
|
pascal@627
|
992
|
pascal@627
|
993 *\ admin\ * )
|
pascal@627
|
994 #
|
al@633
|
995 # TazPkg configuration page
|
pascal@627
|
996 #
|
al@814
|
997 tazpanel_header "$(_ 'Administration')"
|
al@814
|
998 loading_msg
|
al@814
|
999
|
pascal@627
|
1000 cmd=$(GET admin)
|
al@747
|
1001 pager="$(GET pager)"; pager=${pager:-$PAGE_SIZE}; pager=${pager:-100}
|
al@747
|
1002 mirror="$(GET mirror)"; mirror="${mirror%/}/"
|
al@747
|
1003 repository="$PKGS_DB/undigest/$(GET repository)"
|
al@747
|
1004 link="$(GET link)"; link=${link%/}
|
al@744
|
1005
|
pascal@627
|
1006 case "$cmd" in
|
pascal@627
|
1007 clean)
|
al@725
|
1008 rm -rf $CACHE_DIR/* ;;
|
pascal@627
|
1009 add-mirror)
|
al@747
|
1010 echo "$mirror" >> $(GET file) ;;
|
al@747
|
1011 rm-mirror)
|
al@747
|
1012 sed -i "/^"$(echo $mirror | sed 's|/|\\/|g')"$/d" $(GET file) ;;
|
al@747
|
1013 select-mirror)
|
al@747
|
1014 tazpkg setup-mirror "${mirror}packages/$(cat /etc/slitaz-release)/" | log ;;
|
pascal@627
|
1015 add-repo)
|
al@747
|
1016 mkdir -p $repository
|
al@747
|
1017 echo "$mirror" > $repository/mirror
|
al@747
|
1018 echo "$mirror" > $repository/mirrors ;;
|
al@747
|
1019 rm-repo)
|
al@747
|
1020 rm -rf $repository ;;
|
al@744
|
1021 setlink)
|
al@747
|
1022 [ -d "$link/$INSTALLED" ] && ln -fs $link $PKGS_DB/fslink ;;
|
al@744
|
1023 removelink)
|
al@744
|
1024 rm -f $PKGS_DB/fslink ;;
|
al@747
|
1025 pager)
|
al@747
|
1026 TP_CONF=/etc/slitaz/tazpanel.conf
|
al@747
|
1027 if [ -z "$PAGE_SIZE" ]; then
|
al@747
|
1028 echo -e "\n# Size of packages list page\nPAGE_SIZE=\"$pager\"" >> $TP_CONF
|
al@747
|
1029 else
|
al@747
|
1030 sed -i "s|PAGE_SIZE=.*|PAGE_SIZE=\"$pager\"|" $TP_CONF
|
al@747
|
1031 fi ;;
|
pascal@627
|
1032 esac
|
al@736
|
1033
|
al@785
|
1034 cat <<EOT
|
al@747
|
1035 <p>$(_ 'TazPkg administration and settings')</p>
|
al@747
|
1036
|
al@755
|
1037 <form id="actions">
|
al@755
|
1038 <input type="hidden" name="admin"/>
|
al@747
|
1039 $(show_button action=saveconf action=listconf action=quickcheck action=fullcheck)
|
al@742
|
1040 </form>
|
pascal@627
|
1041 EOT
|
pascal@627
|
1042 case "$(GET action)" in
|
al@747
|
1043 saveconf)
|
al@806
|
1044 loading_msg "$(_ 'Creating the package...')"
|
al@747
|
1045 echo "<pre>"
|
al@747
|
1046 cd /tmp
|
al@747
|
1047 tazpkg repack-config | filter_taztools_msgs
|
al@747
|
1048 echo -n "$(_ 'Path:') "; ls /tmp/config-*.tazpkg
|
al@747
|
1049 echo "</pre>" ;;
|
al@747
|
1050 listconf)
|
al@747
|
1051 echo "<h4>$(_ 'Configuration files')</h4>"
|
al@747
|
1052 echo "<ul>"
|
al@747
|
1053 tazpkg list-config | while read file; do
|
al@747
|
1054 if [ -e $file ]; then
|
al@747
|
1055 echo "<li><a href=\"index.cgi?file=$file\">$file</a></li>"
|
al@747
|
1056 else
|
al@747
|
1057 echo "<li>$file</li>"
|
al@747
|
1058 fi
|
al@747
|
1059 done
|
al@747
|
1060 echo "</ul>" ;;
|
al@747
|
1061 quickcheck)
|
al@806
|
1062 loading_msg "$(_ 'Checking packages consistency...')"
|
al@747
|
1063 tazpkg check
|
al@811
|
1064 ;;
|
al@747
|
1065 fullcheck)
|
al@806
|
1066 loading_msg "$(_ 'Full packages check...')"
|
al@747
|
1067 tazpkg check --full
|
al@811
|
1068 ;;
|
al@747
|
1069 dvdimage)
|
al@747
|
1070 dev=$(POST dvdimage)
|
al@747
|
1071 mkdir -p /mnt/packages 2> /dev/null
|
al@747
|
1072 echo "<pre>"
|
al@747
|
1073 mount -t iso9660 -o loop,ro $dev /mnt/packages &&
|
al@747
|
1074 /mnt/packages/install.sh &&
|
al@747
|
1075 _ '%s is installed on /mnt/packages' $dev
|
al@747
|
1076 echo "</pre>" ;;
|
al@747
|
1077 dvdusbkey)
|
al@747
|
1078 mkdir -p /mnt/packages 2> /dev/null
|
al@747
|
1079 for tag in "LABEL=\"packages-$version\" TYPE=\"iso9660\"" \
|
al@747
|
1080 "LABEL=\"sources-$version\" TYPE=\"iso9660\"" ; do
|
al@747
|
1081 dev=$(blkid | grep "$tag" | cut -d: -f1)
|
al@747
|
1082 [ -n "$dev" ] || continue
|
pascal@627
|
1083 echo "<pre>"
|
al@747
|
1084 mount -t iso9660 -o ro $dev /mnt/packages &&
|
al@747
|
1085 /mnt/packages/install.sh &&
|
al@747
|
1086 _ '%s is installed on /mnt/packages' $dev
|
al@747
|
1087 echo "</pre>"
|
al@747
|
1088 break
|
al@747
|
1089 done ;;
|
al@747
|
1090 esac
|
al@744
|
1091
|
al@747
|
1092 cache_files=$(find $CACHE_DIR -name '*.tazpkg' | wc -l)
|
al@744
|
1093 cache_size=$(du -sh $CACHE_DIR | cut -f1 | sed 's|\.0||')
|
al@744
|
1094 [ "$cache_files" == 0 ] && cache_size="0K"
|
al@747
|
1095 mirror=$(cat $PKGS_DB/mirror)
|
al@747
|
1096 default_mirror=${mirror%/packages/*}
|
al@785
|
1097 cat <<EOT
|
al@755
|
1098 <section>
|
al@755
|
1099 <header>$(_ 'Packages cache')</header>
|
al@755
|
1100 <form class="wide">
|
al@755
|
1101 <div>$(_ 'Packages in the cache: %s (%s)' $cache_files $cache_size)</div>
|
al@755
|
1102 <footer>$(show_button admin=clean)</footer>
|
al@755
|
1103 </form>
|
al@755
|
1104 </section>
|
pascal@627
|
1105
|
pascal@627
|
1106
|
al@755
|
1107 <section>
|
al@755
|
1108 <header>$(_ 'Current mirror list')</header>
|
pascal@627
|
1109 EOT
|
al@747
|
1110
|
al@747
|
1111 # List mirrors
|
al@747
|
1112 version=$(cat /etc/slitaz-release)
|
al@700
|
1113 for i in $PKGS_DB/mirrors $PKGS_DB/undigest/*/mirrors; do
|
pascal@627
|
1114 [ -s $i ] || continue
|
al@700
|
1115 if [ $i != $PKGS_DB/mirrors ]; then
|
al@747
|
1116 echo "<h4>$(_ 'Repository: %s' "$(repo_name $(dirname $i))")</h4>"
|
pascal@627
|
1117 fi
|
al@785
|
1118 cat <<EOT
|
al@755
|
1119 <form class="wide">
|
al@755
|
1120 <input type="hidden" name="admin" value="select-mirror"/>
|
al@755
|
1121 <table class="wide zebra">
|
al@747
|
1122 EOT
|
al@747
|
1123 while read line; do
|
al@785
|
1124 cat <<EOT
|
al@755
|
1125 <tr>
|
al@755
|
1126 <td>
|
al@755
|
1127 <input type="radio" name="mirror" id="$line" value="$line" onchange="this.form.submit()"
|
al@755
|
1128 $([ "$line" == "$default_mirror/" ] && echo -n 'checked="checked"')>
|
al@755
|
1129 <label for="$line"><code>$line</code></label></td>
|
al@755
|
1130 <td><a data-img="web" href="$line" target="_blank"></a></td>
|
al@755
|
1131 <td><a data-img="remove" href="?admin=rm-mirror&mirror=$line&file=$i" title="$(_ 'Delete')"></a></td>
|
al@755
|
1132 </tr>
|
al@747
|
1133 EOT
|
al@747
|
1134 done < $i
|
al@785
|
1135 cat <<EOT
|
al@755
|
1136 </table>
|
al@755
|
1137 </form>
|
al@747
|
1138
|
al@755
|
1139 <form class="wide">
|
al@755
|
1140 <footer>
|
al@755
|
1141 <input type="hidden" name="file" value="$i" />
|
al@755
|
1142 <input type="text" name="mirror" size="40" />
|
al@755
|
1143 $(show_button admin=add-mirror)
|
al@755
|
1144 </footer>
|
al@755
|
1145 </form>
|
pascal@627
|
1146 EOT
|
pascal@627
|
1147 done
|
al@785
|
1148 cat <<EOT
|
al@755
|
1149 </section>
|
al@755
|
1150
|
al@755
|
1151
|
al@755
|
1152 <section>
|
al@755
|
1153 <header>$(_ 'Private repositories')</header>
|
al@755
|
1154 EOT
|
al@747
|
1155 if [ -n "$(ls $PKGS_DB/undigest 2> /dev/null)" ]; then
|
al@785
|
1156 cat <<EOT
|
al@755
|
1157 <table class="wide zebra">
|
al@755
|
1158 EOT
|
al@747
|
1159 ls $PKGS_DB/undigest 2> /dev/null | while read repo ; do
|
al@747
|
1160 cat <<EOT
|
al@755
|
1161 <tr>
|
al@755
|
1162 <td><code>$repo</code></td>
|
al@755
|
1163 <td><a data-img="remove" href="?admin=rm-repo&repository=$repo" title="$(_ 'Delete')"></a></td>
|
al@755
|
1164 </tr>
|
pascal@627
|
1165 EOT
|
al@747
|
1166 done
|
al@785
|
1167 cat <<EOT
|
al@755
|
1168 </table>
|
al@755
|
1169 EOT
|
al@747
|
1170 fi
|
al@747
|
1171
|
al@785
|
1172 cat <<EOT
|
al@755
|
1173 <form class="wide">
|
al@755
|
1174 <table>
|
al@755
|
1175 <tr><td>$(_ 'Name')</td><td><input type="text" name="repository" size="10"/></td></tr>
|
al@755
|
1176 <tr><td>$(_ 'URL:')</td><td><input type="text" name="mirror" value="http://"></td></tr>
|
al@755
|
1177 </table>
|
al@755
|
1178 <footer>
|
al@755
|
1179 $(show_button admin=add-repo)
|
al@755
|
1180 </footer>
|
al@755
|
1181 </form>
|
al@755
|
1182 </section>
|
pascal@627
|
1183
|
al@747
|
1184
|
al@755
|
1185 <section>
|
al@755
|
1186 <header>$(_ 'Link to another SliTaz installation')</header>
|
al@755
|
1187 <form class="wide">
|
al@755
|
1188 <div>
|
al@755
|
1189 $(_ "This link points to the root of another SliTaz installation. You will be able to install packages using soft links to it.")
|
al@755
|
1190 </div>
|
al@755
|
1191 <input type="text" name="link" value="$(readlink $PKGS_DB/fslink 2> /dev/null)"/>
|
al@755
|
1192 <footer>
|
al@755
|
1193 $(show_button admin=setlink admin=removelink)
|
al@755
|
1194 </footer>
|
al@755
|
1195 </form>
|
al@755
|
1196 </section>
|
pascal@627
|
1197
|
pascal@627
|
1198
|
al@755
|
1199 <section>
|
al@755
|
1200 <header id="dvd">$(_ 'SliTaz packages DVD')</header>
|
pascal@627
|
1201
|
al@755
|
1202 <div>
|
al@755
|
1203 $(_ "A bootable DVD image of all available packages for the %s version is generated every day. It also contains a copy of the website and can be used without an internet connection. This image can be installed on a DVD or a USB key." $version)
|
al@747
|
1204
|
al@755
|
1205 <form method="post" action='?admin&action=dvdimage'>
|
al@755
|
1206 $(_ 'Install from ISO image:')
|
al@755
|
1207 <input type="text" name="dvdimage" size="40" value="/root/packages-$version.iso" />
|
al@755
|
1208 </form>
|
al@755
|
1209 </div>
|
pascal@627
|
1210
|
al@755
|
1211 <footer>
|
al@755
|
1212 <button data-icon="download" onclick='http://mirror.slitaz.org/iso/$version/packages-$version.iso'>
|
al@755
|
1213 $(_ 'Download DVD image')</button>
|
al@755
|
1214 <button data-icon="link" onclick='?admin&action=dvdusbkey'>
|
al@755
|
1215 $(_ 'Install from DVD/USB key')</button>
|
al@755
|
1216 </footer>
|
al@755
|
1217 </section>
|
pascal@627
|
1218
|
al@747
|
1219
|
al@755
|
1220 <section>
|
al@755
|
1221 <header>$(_ 'Packages list')</header>
|
al@755
|
1222 <form class="wide">
|
al@755
|
1223 <div>
|
al@755
|
1224 $(_ 'Long list of packages is paginated. Here you can set the page size (default: 100, turning off the pager: 0).')
|
al@755
|
1225 </div>
|
al@755
|
1226 <input type="hidden" name="admin" value="pager"/>
|
al@755
|
1227 <input type="number" name="pager" value="$pager" min="0" step="10" size="4"/>
|
al@755
|
1228 <footer>
|
al@755
|
1229 <button data-icon="ok" type="submit">$(_ 'Set')</button>
|
al@755
|
1230 </footer>
|
al@755
|
1231 </form>
|
al@755
|
1232 </section>
|
pascal@627
|
1233 EOT
|
al@727
|
1234 ;;
|
al@727
|
1235
|
al@727
|
1236
|
al@727
|
1237 *\ license\ *)
|
al@727
|
1238 #
|
al@727
|
1239 # Show licenses for installed packages
|
al@727
|
1240 #
|
al@814
|
1241 tazpanel_header "$(_ 'Administration')"
|
al@744
|
1242
|
al@727
|
1243 pkg=$(GET license)
|
al@727
|
1244 case $pkg in
|
al@747
|
1245 /*) [ -e $pkg ] && {
|
al@727
|
1246 echo "<h2>${pkg#/usr/share/licenses/}</h2>"
|
al@727
|
1247 case $pkg in
|
al@747
|
1248 *.htm*) cat $pkg ;;
|
al@747
|
1249 *) echo "<pre style=\"white-space: pre-wrap\">"
|
al@727
|
1250 cat $pkg | htmlize | sed 's|\([hf]t*t*ps*://[a-zA-Z0-9./_-]*[a-zA-Z0-9/_-]\)|<a href="\1">\1</a>|'
|
al@727
|
1251 echo "</pre>"
|
al@727
|
1252 ;;
|
al@727
|
1253 esac
|
al@727
|
1254 } ;;
|
al@747
|
1255 *) echo "<h2>$(_ 'Licenses for package %s' $pkg)</h2>"
|
al@747
|
1256 OFFLINE=''
|
al@727
|
1257 if [ -e "$PKGS_DB/installed/$pkg" ]; then
|
al@727
|
1258 for lic in $(grep /usr/share/licenses/ $PKGS_DB/installed/$pkg/files.list); do
|
al@727
|
1259 OFFLINE="$OFFLINE <li><a href=\"?license=$lic\">licenses/<b>${lic#/usr/share/licenses/}</b></a></li>\n"
|
al@727
|
1260 done
|
al@747
|
1261 echo "\
|
al@747
|
1262 Apache|Apache-2.0||||http://www.apache.org/licenses/#Artistic|Artistic-2.0||||#\
|
al@747
|
1263 BSD|BSD-2-Clause||||#BSD3|BSD-3-Clause||||#CC-BY-SA||by-sa/4.0/|||#\
|
al@747
|
1264 CC-SA||by-sa/4.0/|||#CC-BY-ND||by-nd/4.0/|||#CC-BY-NC-SA||by-nc-sa/4.0/|||#\
|
al@747
|
1265 CC-BY-NC-ND||by-nc-nd/4.0/|||#CC-BY-NC||by-nc/4.0/|||#CC-BY||by/4.0/|||#\
|
al@747
|
1266 cc-pd|||||http://creativecommons.org/publicdomain/#CDDL|CDDL-1.0||||#\
|
al@747
|
1267 CECILL|CECILL-2.1||||#Eclipse|EPL-1.0||||#EPL|EPL-1.0||||#FDL|||fdl||#\
|
al@747
|
1268 GPL|gpl-license||gpl|gpl.txt|#GPL2|GPL-2.0||old-licenses/gpl-2.0||#\
|
al@747
|
1269 GPL3|GPL-3.0||gpl|gpl.txt|#ISC|ISC||||#LGPL|lgpl-license||lgpl||#\
|
al@747
|
1270 LGPL2|||old-licenses/lgpl-2.0||#\
|
al@747
|
1271 LGPL2.1|LGPL-2.1||old-licenses/lgpl-2.1|lgpl.txt|#LGPL3|LGPL-3.0||lgpl||#\
|
al@747
|
1272 LPPL|LPPL-1.3c||||#MIT|MIT|||mit.txt|#MPL|MPL-2.0|||mozilla.txt|#\
|
al@747
|
1273 MPL2|MPL-2.0||||#PublicDomain|||||http://creativecommons.org/publicdomain/#\
|
al@747
|
1274 QPL|QPL-1.0||||#SIL_OFL|OFL-1.1||||#OFL|OFL-1.1||||#zlib/libpng|Zlib||||" | \
|
al@747
|
1275 awk -vlicenses="$(. $PKGS_DB/installed/$pkg/receipt; echo "$LICENSE")" \
|
al@747
|
1276 -vtext="$(_ '%s license on %s website' %s %s)" \
|
al@747
|
1277 -vro="$(_ 'Read online:')" -vrl="$(_ 'Read local:')" \
|
al@747
|
1278 -vofflic="$OFFLINE" '
|
al@747
|
1279 BEGIN{ FS="|"; RS="#"; split(licenses, lic, " "); if (offlic) OFFLINE[0]=offlic }
|
al@747
|
1280 function link1(u, l, ll, w) {
|
al@747
|
1281 return sprintf("\t<li><a href=\"%s%s\">" text "</a></li>", u, l, "<b>" ll "</b>", w) }
|
al@747
|
1282 function link2(u, l, ll) {
|
al@747
|
1283 return sprintf("\t<li><a href=\"%s%s\">%s</b></a></li>", u, l, ll) }
|
al@747
|
1284 function link_osl(n) {
|
al@747
|
1285 return link1("http://opensource.org/licenses/", n, n, "OSL") }
|
al@747
|
1286 function link_cc(n) {
|
al@747
|
1287 split(n, ll, "/")
|
al@747
|
1288 return link1("http://creativecommons.org/licenses/", n, ll[1], "Creative Commons") }
|
al@747
|
1289 function link_gnu(n) {
|
al@747
|
1290 split(n, ll, "/")
|
al@747
|
1291 return link1("https://www.gnu.org/licenses/", n ".html", ll[2] ? ll[2] : ll[1], "GNU") }
|
al@747
|
1292 function link_loc(n) {
|
al@747
|
1293 return link2("?license=/usr/share/licenses/", n, "licenses/<b>" n "</b>") }
|
al@747
|
1294 function link_url(n) {
|
al@747
|
1295 return link2(n, "", n) }
|
al@747
|
1296 {
|
al@747
|
1297 if ($1 == lic[1] || $1 == lic[2] || $1 == lic[3] || $1 == lic[4]) {
|
al@747
|
1298 if ($2) ONLINE[$2]=link_osl($2)
|
al@747
|
1299 if ($3) ONLINE[$3]=link_cc($3)
|
al@747
|
1300 if ($4) ONLINE[$4]=link_gnu($4)
|
al@747
|
1301 if ($5) OFFLINE[$5]=link_loc($5)
|
al@747
|
1302 if ($6) OFFLINE[$6]=link_url($6)
|
al@747
|
1303 }
|
al@747
|
1304 }
|
al@747
|
1305 END{
|
al@747
|
1306 if (length(ONLINE) > 0) { print "<p>" ro "</p>\n<ul>"; for (o in ONLINE) print ONLINE[o]; print "</ul>" }
|
al@747
|
1307 if (length(OFFLINE) > 0) { print "<p>" rl "</p>\n<ul>"; for (o in OFFLINE) print OFFLINE[o]; print "</ul>" }
|
al@747
|
1308 }'
|
al@747
|
1309 fi ;;
|
al@727
|
1310 esac
|
al@727
|
1311 ;;
|
al@727
|
1312
|
al@727
|
1313
|
al@744
|
1314 *\ tags\ *)
|
al@744
|
1315 #
|
al@744
|
1316 # Show tag cloud
|
al@744
|
1317 #
|
al@814
|
1318 tazpanel_header "$(_ 'Tags list')"
|
al@744
|
1319
|
al@744
|
1320 brepo="<b>$repo</b>"
|
al@744
|
1321 case $repo in
|
al@744
|
1322 Any) title="$(_ 'List of tags in all repositories')" ;;
|
al@744
|
1323 *) title="$(_ 'List of tags in repository "%s"' "$brepo")" ;;
|
al@744
|
1324 esac
|
al@747
|
1325 echo "<p>$title</p><p id=\"tags\">"
|
al@814
|
1326 to_read=''
|
al@814
|
1327 for i in $(repo_list ''); do
|
al@814
|
1328 if [ -e "$i/packages.info" ]; then
|
al@814
|
1329 to_read="$to_read $i/packages.info"
|
al@814
|
1330 elif [ -e "$i/installed.info" ]; then
|
al@814
|
1331 to_read="$to_read $i/installed.info"
|
al@747
|
1332 fi
|
al@744
|
1333 done
|
al@814
|
1334
|
al@744
|
1335 TAGS="$(awk -F$'\t' '{if($6){print $6}}' $to_read | tr ' ' $'\n' | sort | uniq -c)"
|
al@744
|
1336 MAX="$(echo "$TAGS" | awk '{if ($1 > MAX) MAX = $1} END{print MAX}')"
|
al@744
|
1337 echo "$TAGS" | awk -vMAX="$MAX" '{
|
al@744
|
1338 printf "<a class=\"tag%s\" href=\"?tag=%s\" title=\"%s\">%s</a> ", int($1 * 7 / MAX + 1), $2, $1, $2
|
al@744
|
1339 }'
|
al@744
|
1340 echo "</p>"
|
al@744
|
1341 ;;
|
al@744
|
1342
|
al@744
|
1343
|
al@728
|
1344 *\ tag\ *)
|
al@728
|
1345 #
|
al@744
|
1346 # Show packages with matching tag
|
al@728
|
1347 #
|
al@814
|
1348 tag=$(GET tag)
|
al@814
|
1349 tazpanel_header "$(_ 'Tag "%s"' $tag)"
|
al@744
|
1350
|
al@814
|
1351 [ "$REMOTE_USER" == 'root' ] && cat <<EOT
|
al@762
|
1352 <section>
|
al@762
|
1353 <div>$(_ 'Selected packages:') <span id="countSelected"></span></div>
|
al@762
|
1354 <footer>
|
al@762
|
1355 $(show_button do=Install do=Chblock do=Remove | sed 's|button |button form="pkglist" |g')
|
al@762
|
1356 $(show_button toggle)
|
al@762
|
1357 </footer>
|
al@762
|
1358 </section>
|
pascal@770
|
1359 EOT
|
al@785
|
1360 cat <<EOT
|
al@758
|
1361 <form id="pkglist" class="wide">
|
al@732
|
1362 EOT
|
al@744
|
1363 for i in $(repo_list ""); do
|
al@744
|
1364 show_list all
|
al@744
|
1365 done
|
al@785
|
1366 cat <<EOT
|
al@762
|
1367 </form>
|
al@762
|
1368 <script type="text/javascript">window.onscroll = scrollHandler; setCountSelPkgs();</script>
|
al@762
|
1369 EOT
|
al@744
|
1370 ;;
|
al@732
|
1371
|
al@744
|
1372
|
al@744
|
1373 *\ blocked\ *)
|
al@744
|
1374 #
|
al@744
|
1375 # Show blocked packages list
|
al@744
|
1376 #
|
al@814
|
1377 tazpanel_header "$(_ 'Blocked packages list')"
|
al@744
|
1378
|
al@785
|
1379 cat <<EOT
|
al@762
|
1380 <section>
|
al@762
|
1381 <div>$(_ 'Selected packages:') <span id="countSelected"></span></div>
|
al@762
|
1382 <footer>
|
al@762
|
1383 $(show_button do=Unblock | sed 's|button |button form="pkglist" |g')
|
al@762
|
1384 $(show_button toggle)
|
al@762
|
1385 </footer>
|
al@762
|
1386 </section>
|
al@762
|
1387
|
al@762
|
1388 <form id="pkglist" class="wide">
|
al@744
|
1389 EOT
|
al@744
|
1390 table_head
|
al@744
|
1391 for i in $(cat $PKGS_DB/blocked-packages.list); do
|
al@744
|
1392 awk -F$'\t' -vp="$i" '{
|
al@744
|
1393 if ($1 == p)
|
al@758
|
1394 printf "<tr><td><input type=\"checkbox\" name=\"pkg\" value=\"%s\"><a data-icon=\"pkgib\" href=\"?info=%s\">%s</a></td><td>%s</td><td>%s</td><td><a href=\"%s\"></a></td></tr>\n", $1, gensub(/\+/, "%2B", "g", $1), $1, $2, $4, $5
|
al@744
|
1395 }' $PKGS_DB/installed.info
|
al@744
|
1396 done
|
al@785
|
1397 cat <<EOT
|
al@762
|
1398 </tbody>
|
al@762
|
1399 </table>
|
al@762
|
1400 </form>
|
al@762
|
1401 <script type="text/javascript">window.onscroll = scrollHandler; setCountSelPkgs();</script>
|
al@762
|
1402 EOT
|
al@728
|
1403 ;;
|
al@728
|
1404
|
al@728
|
1405
|
al@786
|
1406 *\ improve\ *)
|
al@786
|
1407 #
|
al@786
|
1408 # Improving packages by the community effort
|
al@786
|
1409 #
|
al@814
|
1410 pkg=$(GET improve)
|
al@814
|
1411 tazpanel_header "$(_ 'Improve package "%s"' $pkg)"
|
al@814
|
1412
|
al@786
|
1413 msg warn 'Under construction!<br/>It is only imitation of working'
|
al@786
|
1414
|
al@786
|
1415 user=$(POST user); type=$(POST type); text="$(POST text)"
|
al@786
|
1416 login=$(POST login); password=$(POST password)
|
al@786
|
1417
|
al@786
|
1418 login_c=$(COOKIE login); password_c=$(COOKIE password)
|
al@786
|
1419 mail_hash=$(COOKIE mail_hash); user_name=$(COOKIE user_name)
|
al@786
|
1420
|
al@786
|
1421 n=$'\n'
|
al@786
|
1422
|
al@786
|
1423 if [ -n "$login" ]; then
|
al@786
|
1424 # Get mail hash and user Name from bugs.slitaz.org
|
al@786
|
1425 page="$(busybox wget --post-data "auth=${login}&pass=${password}&id=" \
|
al@786
|
1426 -O- "http://bugs.slitaz.org/bugs.cgi?user=${login}")"
|
al@786
|
1427 # Parse page and get:
|
al@786
|
1428 mail_hash="$(echo "$page" | fgrep '<h2>' | cut -d/ -f5 | cut -c 1-32)"
|
al@786
|
1429 user_name="$(echo "$page" | fgrep '<h2>' | cut -d'>' -f3 | cut -d'<' -f1)"
|
al@786
|
1430
|
al@786
|
1431 # Put variables to the session Cookies (they clean in browser close)
|
al@786
|
1432 cat <<EOT
|
al@786
|
1433 <script type="text/javascript">
|
al@786
|
1434 document.cookie = "login=$login";
|
al@786
|
1435 document.cookie = "password=$password";
|
al@786
|
1436 document.cookie = "mail_hash=$mail_hash";
|
al@786
|
1437 document.cookie = "user_name=$user_name";
|
al@786
|
1438 </script>
|
al@786
|
1439 EOT
|
al@786
|
1440 login_c="$login"; password_c="$password"
|
al@786
|
1441 fi
|
al@786
|
1442
|
al@786
|
1443 if [ -z "$login_c" ]; then
|
al@786
|
1444 cat <<EOT
|
al@786
|
1445 <section>
|
al@786
|
1446 <div>$(_ 'Please log in using your TazBug account.')</div>
|
al@786
|
1447 <form method="post">
|
al@786
|
1448 <input type="hidden" name="improve" value="$pkg"/>
|
al@786
|
1449 <table>
|
al@786
|
1450 <tr><td>$(_ 'Login:')</td>
|
al@786
|
1451 <td><input type="text" name="login"/></td></tr>
|
al@786
|
1452 <tr><td>$(_ 'Password:')</td>
|
al@786
|
1453 <td><input type="password" name="password"/></td></tr>
|
al@786
|
1454 <tr><td colspan="2">
|
al@814
|
1455 <label><input type="checkbox" name="rememberme"/>$(_ 'Remember me')</label></td></tr>
|
al@814
|
1456 <tr><td colspan="2">
|
al@786
|
1457 <button type="submit" data-icon="user">$(_ 'Log in')</button></td></tr>
|
al@786
|
1458 </table>
|
al@786
|
1459 </form>
|
al@786
|
1460 <footer>
|
al@786
|
1461 <a href="http://bugs.slitaz.org/bugs.cgi?signup&online" target="_blank">$(_ 'Create new account')</a>
|
al@786
|
1462 </footer>
|
al@786
|
1463 </section>
|
al@786
|
1464 EOT
|
al@786
|
1465 xhtml_footer; exit 0
|
al@786
|
1466 fi
|
al@786
|
1467
|
al@786
|
1468
|
al@786
|
1469 # Get receipt variables, show Install/Remove buttons
|
al@786
|
1470 if [ -d $INSTALLED/$pkg ]; then
|
al@786
|
1471 . $INSTALLED/$pkg/receipt
|
al@786
|
1472 else
|
al@786
|
1473 cd $PKGS_DB
|
al@786
|
1474 eval "$(awk -F$'\t' -vp=$pkg '
|
al@786
|
1475 $1==p{
|
al@786
|
1476 printf "VERSION=\"%s\"; SHORT_DESC=\"%s\"; TAGS=\"%s\"; ", $2, $4, $6
|
al@786
|
1477 }' packages.info undigest/*/packages.info)"
|
al@786
|
1478 fi
|
al@786
|
1479
|
al@786
|
1480 RECEIPT="$(wget -O - http://hg.slitaz.org/wok/raw-file/tip/$pkg/receipt | htmlize)"
|
al@786
|
1481 DESCRIPTION="$(wget -O - http://hg.slitaz.org/wok/raw-file/tip/$pkg/description.txt | htmlize)"
|
al@786
|
1482 DESCRIPTION="$(separator)$n${DESCRIPTION:-(empty)}$n$(separator)"
|
al@786
|
1483
|
al@786
|
1484 if [ -z "$type" ]; then
|
al@786
|
1485 cat <<EOT
|
al@786
|
1486 <section>
|
al@786
|
1487 <header>
|
al@786
|
1488 $(_ 'Improve package "%s"' $pkg)
|
al@786
|
1489 <form><button name="info" value="$pkg" data-icon="back">$(_ 'Back')</button></form>
|
al@786
|
1490 </header>
|
al@786
|
1491
|
al@786
|
1492 <div style="display:none">
|
al@786
|
1493 <span id="newVersion">Current version: $VERSION${n}New version: $VERSION${n}Link to announce: http://</span>
|
al@786
|
1494 <span id="improveShortDesc">Short description (English):$n$SHORT_DESC</span>
|
al@786
|
1495 <span id="translateShortDesc">Short description (English):$n$SHORT_DESC$n${n}Language: $LANG${n}Short description:$n$SHORT_DESC</span>
|
al@786
|
1496 <span id="improveDesc">Description (English):$n$DESCRIPTION</span>
|
al@786
|
1497 <span id="translateDesc">Language: $LANG${n}Description:$n$DESCRIPTION</span>
|
al@786
|
1498 <span id="improveCategory">Old category: $CATEGORY${n}New category: $CATEGORY</span>
|
al@786
|
1499 <span id="improveTags">Tags: $TAGS</span>
|
al@786
|
1500 <span id="addIcon">Link to application icon (48x48px): http://</span>
|
al@786
|
1501 <span id="addScreenshot">Link to application screenshot: http://</span>
|
al@786
|
1502 <span id="improveReceipt">$RECEIPT</span>
|
al@786
|
1503 <span id="improveOther"></span>
|
al@786
|
1504 </div>
|
al@786
|
1505
|
al@786
|
1506 <form method="post" class="wide">
|
al@786
|
1507
|
al@786
|
1508 <table class="wide">
|
al@786
|
1509 <tr><td style="vertical-align:bottom">
|
al@786
|
1510 <input type="hidden" name="improve" value="$pkg"/>
|
al@786
|
1511 <input type="hidden" name="user" value="$login_c"/>
|
al@786
|
1512 $(_ 'How can you help:')<br/>
|
al@786
|
1513 <select name='type' id="improveType" onchange="improveAction()">
|
al@786
|
1514 <option value=''>$(_ 'Please select an action')
|
al@786
|
1515 <option value='newVersion'>$(_ 'Report new version')
|
al@786
|
1516 <option value='improveShortDesc'>$(_ 'Improve short description')
|
al@786
|
1517 <option value='translateShortDesc'>$(_ 'Translate short description')
|
al@786
|
1518 <option value='improveDesc'>$(_ 'Add or improve description')
|
al@786
|
1519 <option value='translateDesc'>$(_ 'Translate description')
|
al@786
|
1520 <option value='improveCategory'>$(_ 'Improve category')
|
al@786
|
1521 <option value='improveTags'>$(_ 'Add or improve tags')
|
al@786
|
1522 <option value='addIcon'>$(_ 'Add application icon')
|
al@786
|
1523 <option value='addScreenshot'>$(_ 'Add application screenshot')
|
al@786
|
1524 <option value='improveReceipt'>$(_ 'Improve receipt')
|
al@786
|
1525 <option value='improveOther'>$(_ 'Other')
|
al@786
|
1526 </select>
|
al@786
|
1527 </td>
|
al@786
|
1528 <td id="user_info">$user_name
|
al@786
|
1529 <img src="http://www.gravatar.com/avatar/$mail_hash?s=48&d=identicon"
|
al@786
|
1530 style="border-radius: 0.3rem"/>
|
al@786
|
1531 </td></tr>
|
al@786
|
1532 </table>
|
al@786
|
1533
|
al@786
|
1534 <textarea name="text" id="improveText" style="width:100%; resize: vertical; min-height:10rem"></textarea>
|
al@814
|
1535 <footer>
|
al@814
|
1536 <button type="submit" data-icon="slitaz">$(_ 'Send')</button>
|
al@814
|
1537 </footer>
|
al@786
|
1538 </form>
|
al@786
|
1539 </section>
|
al@786
|
1540 EOT
|
al@786
|
1541 else
|
al@786
|
1542 cat <<EOT
|
al@786
|
1543 <section>
|
al@786
|
1544 <header>
|
al@786
|
1545 $(_ 'Thank you!')
|
al@786
|
1546 <form><button name="info" value="$pkg" data-icon="back">$(_ 'Back')</button></form>
|
al@786
|
1547 </header>
|
al@786
|
1548 <div>The following information was sent to SliTaz developers:</div>
|
al@786
|
1549 <pre class="scroll"><b>User:</b> $user
|
al@786
|
1550 <b>Type:</b> $type
|
al@786
|
1551 <b>Package:</b> $pkg
|
al@786
|
1552 <b>Message:</b>
|
al@786
|
1553 $(echo "$text" | htmlize)</pre>
|
al@786
|
1554 </section>
|
al@786
|
1555 EOT
|
al@786
|
1556 fi
|
al@786
|
1557 ;;
|
al@786
|
1558
|
al@786
|
1559
|
al@786
|
1560 *)
|
pascal@627
|
1561 #
|
pascal@627
|
1562 # Default to summary
|
pascal@627
|
1563 #
|
al@814
|
1564 tazpanel_header
|
al@814
|
1565 loading_msg
|
al@744
|
1566
|
al@785
|
1567 cat <<EOT
|
al@806
|
1568 <form>
|
pascal@627
|
1569 EOT
|
al@700
|
1570 fslink=$(readlink $PKGS_DB/fslink)
|
al@724
|
1571 [ -n "$fslink" -a -d "$fslink/$INSTALLED" ] && show_button linkable
|
al@747
|
1572 show_button recharge up admin
|
al@785
|
1573 cat <<EOT
|
al@755
|
1574 </form>
|
pascal@627
|
1575
|
al@755
|
1576 <section>
|
al@755
|
1577 <header>$(_ 'Summary')</header>
|
al@755
|
1578
|
al@755
|
1579 <table class="wide zebra">
|
al@755
|
1580 <tr>
|
al@755
|
1581 <td>$(_ 'Last recharge:')</td>
|
al@755
|
1582 <td>$(list=$PKGS_DB/ID
|
al@745
|
1583 if [ -e $list ]; then
|
al@755
|
1584 # Timezone offset as string, ex. '+0200' for EET (+2 hours)
|
al@755
|
1585 ohhmm="$(date +%z)"
|
al@755
|
1586 # Timezone offset in the seconds
|
al@755
|
1587 offset=$(( 60 * (60 * ${ohhmm:0:3} + ${ohhmm:3:2}) ))
|
al@747
|
1588 daynow=$(( ($(date +%s) + $offset) / 86400 ))
|
al@747
|
1589 dayupd=$(( ($(date -r $list +%s) + $offset) / 86400 ))
|
al@747
|
1590 days=$(( $daynow - $dayupd ))
|
al@745
|
1591 time=$(date -r $list +%R)
|
al@745
|
1592 ago="$(_p '%d day ago.' '%d days ago.' $days $days)"
|
al@745
|
1593 case $days in
|
al@745
|
1594 0) _ 'Today at %s.' $time;;
|
al@745
|
1595 1) _ 'Yesterday at %s.' $time;;
|
al@745
|
1596 [2-9]) echo $ago;;
|
al@745
|
1597 *) echo "<span style='color:red'>$ago</span>"
|
al@745
|
1598 _ 'It is recommended to [recharge] the lists.' | \
|
al@755
|
1599 sed 's|\[|<a data-icon="refresh" href="?recharge">|;s|\]|</a>|';;
|
al@745
|
1600 esac
|
al@745
|
1601 else
|
al@745
|
1602 _ 'never.'
|
al@745
|
1603 _ 'You need to [download] the lists for further work.' | \
|
al@768
|
1604 sed 's|\[|<a data-icon="download" href="?recharge" data-root>|;s|\]|</a>|'
|
al@745
|
1605 fi)</td></tr>
|
al@755
|
1606 <tr>
|
al@755
|
1607 <td>$(_ 'Installed packages:')</td>
|
al@755
|
1608 <td><a href="?list&my=my&cat=all&repo=Any">
|
al@755
|
1609 <b>$(cat $PKGS_DB/installed.info | wc -l)</b>
|
al@755
|
1610 </a></td></tr>
|
al@755
|
1611 <tr>
|
al@755
|
1612 <td>$(_ 'Mirrored packages:')</td>
|
al@755
|
1613 <td><a href="?list&my=no&cat=all&repo=Any">
|
al@755
|
1614 <b>$(cat $PKGS_DB/packages.list | wc -l)</b>
|
al@755
|
1615 </a></td></tr>
|
al@755
|
1616 <tr>
|
al@755
|
1617 <td>$(_ 'Upgradeable packages:')</td>
|
al@755
|
1618 <td><a href="?up">
|
al@755
|
1619 <b>$(cat $PKGS_DB/packages.up | wc -l)</b>
|
al@755
|
1620 </a></td></tr>
|
al@755
|
1621 <tr>
|
al@755
|
1622 <td>$(_ 'Installed files:')</td>
|
al@755
|
1623 <td><b>$(cat $INSTALLED/*/files.list | wc -l)</b></td></tr>
|
al@755
|
1624 <tr>
|
al@755
|
1625 <td>$(_ 'Blocked packages:')</td>
|
al@755
|
1626 <td><a href="?blocked">
|
al@755
|
1627 <b>$(cat $PKGS_DB/blocked-packages.list | wc -l)</b>
|
al@755
|
1628 </a></td></tr>
|
al@755
|
1629 </table>
|
al@755
|
1630 </section>
|
pascal@627
|
1631
|
pascal@627
|
1632
|
al@755
|
1633 <section>
|
al@755
|
1634 <header>
|
al@755
|
1635 $(_ 'Latest log entries')
|
al@755
|
1636 <form action="index.cgi">
|
al@755
|
1637 <button name="file" value="$LOG" data-icon="view">$(_ 'Show')</button>
|
al@755
|
1638 </form>
|
al@755
|
1639 </header>
|
al@755
|
1640 <pre>$(tail -n 5 $LOG | tac | fgrep "-" | awk '{print $1, $2, $3, $4, $5, "<a href=\"?info=" $6 "\">" $6 "</a>", $7}')</pre>
|
al@755
|
1641 </section>
|
pascal@627
|
1642 EOT
|
pascal@627
|
1643 ;;
|
pascal@627
|
1644 esac
|
pascal@627
|
1645
|
pascal@627
|
1646 # xHTML 5 footer
|
al@633
|
1647 export TEXTDOMAIN='tazpkg'
|
pascal@627
|
1648 xhtml_footer
|
pascal@627
|
1649 exit 0
|