wok-6.x view xarchiver/stuff/xarchiver.cgi @ rev 17438
Add perl-image-magick
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Mon Dec 08 14:44:54 2014 +0100 (2014-12-08) |
parents | |
children | 61fdfde9104b |
line source
1 #!/bin/sh
2 # Web utility to show & install suggested packages for xarchiver
3 # Aleksej Bobylev <al.bobylev@gmail.com>, 2014.
5 . /usr/lib/slitaz/httphelper.sh
6 . /etc/slitaz/slitaz.conf
7 . /lib/libtaz.sh
8 . /etc/locale.conf; export LANG LC_ALL
9 export TEXTDOMAIN='tazpkg'
11 case "$(GET)" in
12 img)
13 header "HTTP/1.1 200 OK\nContent-type: image/png"
14 case "$(GET img)" in
15 yes) cat /usr/share/icons/SliTaz/actions/22/gtk-ok.png ;;
16 not) cat /usr/share/icons/SliTaz/actions/22/gtk-remove.png ;;
17 fav) cat /usr/share/icons/hicolor/16x16/apps/xarchiver.png ;;
18 log) cat /usr/share/icons/hicolor/48x48/apps/xarchiver.png ;;
19 esac ;;
20 *)
21 header
22 cat << EOT
23 <!DOCTYPE html>
24 <html>
25 <head>
26 <meta charset="utf-8" />
27 <title>Xarchiver</title>
28 <link rel="shortcut icon" type="image/png" href="?img=fav">
29 <style type="text/css">
30 *{font-family:sans}
31 img{vertical-align:middle;}
32 #installer{display:none}
33 </style>
34 <script type="text/javascript">
35 function inst(actpkg) {
36 document.getElementById("installer").src = "http://localhost:82/pkgs.cgi?do=" + actpkg
37 }
38 function on_load(iframe) {
39 if (iframe.src !== "http://localhost/cgi-bin/xarchiver.cgi") {location.reload(false)}
40 }
41 </script>
42 </head>
43 <body>
44 <div style="border:1pt solid gray; border-radius:6pt; margin:6pt; padding:6pt;">
45 <table><tr><td style="vertical-align:top"><img src="?img=log" /></td>
46 <td>$(cat $INSTALLED/xarchiver/description.txt)</td></table>
47 </div>
48 <p>Here you can install some SliTaz packages using TazPanel on the background.
49 Note that you always have tiny versions of <strong>gzip</strong> and <strong>cpio</strong> (as part of Busybox), so you may not install its "official" versions.</p>
50 <table>
51 <tbody>
52 EOT
53 for pkg in ar arj bzip2 cpio gzip lha lzma lzop rar xz zip 7z xdg-utils; do
55 case $pkg in
56 ar) pkg2=binutils ;;
57 7z) pkg2=p7zip-full ;;
58 *) pkg2=$pkg ;;
59 esac
61 if [ -d $INSTALLED/$pkg2 ]; then
62 img=yes; act=Remove; desc="$(_ Remove)"
63 else
64 img=not; act=Install; desc="$(_ Install)"
65 fi
66 echo "<tr><td><img src=\"?img=$img\" /> $pkg</td></td><td><button type=\"submit\" onclick='inst(\"${act}&${pkg2}\")'>$desc</button></td></tr>"
67 done
68 cat << EOT
69 </tbody>
70 </table>
71 <iframe id="installer" src="" onload="on_load(this)"></iframe>
72 </body>
73 </html>
74 EOT
75 ;;
76 esac
77 exit 0