tazpkg view lib/tazpkgbox/package_infos @ rev 93

tazpkgbox: add block/unblock button
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon May 19 21:13:14 2008 +0000 (2008-05-19)
parents fff4fbde912a
children be31f9fb294a
line source
1 #!/bin/sh
2 #
3 # Dialog box to provide package infos and actions
4 #
6 XTERM_OPTS="-geometry 80x16+120+120"
8 PKG=`cat /tmp/tazpkgbox/pkg | sed s/" "/""/g`
10 # Installed or not installed, that the question.
11 if [ -d /var/lib/tazpkg/installed/$PKG ]; then
12 PACKED_SIZE=""
13 DEPENDS=""
14 . /var/lib/tazpkg/installed/$PKG/receipt
15 PACKAGE_INFOS="
16 <window title=\"Package: $PKG\" icon-name=\"package-x-generic\">
17 <vbox>
19 <tree>
20 <width>460</width><height>160</height>
21 <label>Package|$PKG</label>
22 <item icon=\"tazpkg\">Version: | $VERSION</item>
23 <item icon=\"tazpkg\">Category: | $CATEGORY</item>"
24 [ -n "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
25 <item icon=\"tazpkg\">Depends: | $DEPENDS</item>"
26 [ -n "$PACKED_SIZE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
27 <item icon=\"tazpkg\">Size: | $PACKED_SIZE ($UNPACKED_SIZE installed)</item>"
28 PACKAGE_INFOS="$PACKAGE_INFOS
29 <item icon=\"system-users\">Maintainer: | $MAINTAINER</item>
30 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
31 </tree>
33 <hbox>"
34 grep -q post_install /var/lib/tazpkg/installed/$PKG/receipt && PACKAGE_INFOS="$PACKAGE_INFOS
35 <button>
36 <label>Reconfigure</label>
37 <input file icon=\"reload\"></input>
38 <action>xterm -T \"Reconfigure $PACKAGE\" $XTERM_OPTS -e \"\
39 tazpkg reconfigure $PACKAGE; sleep 2\"</action>
40 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
41 </button>"
42 if grep -q ^$PKG$ /var/lib/tazpkg/blocked-packages.list; then
43 PACKAGE_INFOS="$PACKAGE_INFOS
44 <button>
45 <label>Unblock</label>
46 <input file icon=\"up\"></input>
47 <action>xterm -T \"Unblock $PACKAGE\" $XTERM_OPTS -e \"\
48 tazpkg unblock $PACKAGE; sleep 2\"</action>
49 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
50 </button>"
51 else
52 PACKAGE_INFOS="$PACKAGE_INFOS
53 <button>
54 <label>Block</label>
55 <input file icon=\"down\"></input>
56 <action>xterm -T \"Block $PACKAGE\" $XTERM_OPTS -e \"\
57 tazpkg block $PACKAGE; sleep 2\"</action>
58 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
59 </button>"
60 fi
61 PACKAGE_INFOS="$PACKAGE_INFOS
62 <button>
63 <label>Remove</label>
64 <input file icon=\"edit-delete\"></input>
65 <action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
66 tazpkg remove $PACKAGE; sleep 2\"</action>
67 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
68 </button>
69 <button>
70 <label>Repack</label>
71 <input file icon=\"edit-redo\"></input>
72 <action>xterm -T \"Repack $PACKAGE\" $XTERM_OPTS -e \"\
73 cd /var/cache/tazpkg; \
74 tazpkg repack $PACKAGE; sleep 2\"</action>
75 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
76 </button>
77 <button>
78 <input file icon=\"gtk-close\"></input>
79 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
80 </button>
81 </hbox>
83 </vbox>
84 </window>
85 "
86 export PACKAGE_INFOS
87 else
88 RES=`grep "^$PKG" /var/lib/tazpkg/packages.desc | head -n 1`
89 PACKAGE=`echo "$RES" | cut -d "|" -f 1`
90 VERSION=`echo "$RES" | cut -d "|" -f 2`
91 CATEGORY=`echo "$RES" | cut -d "|" -f 4`
92 WEB_SITE=`echo "$RES" | cut -d "|" -f 5`
93 SIZES=`grep -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt | tail -1`
94 PACKAGE_INFOS="
95 <window title=\"Package: $PACKAGE\" icon-name=\"package-x-generic\">
96 <vbox>
98 <tree>
99 <width>460</width><height>140</height>
100 <label>Package|$PKG</label>
101 <item icon=\"tazpkg\">Name: | $PACKAGE</item>
102 <item icon=\"tazpkg\">Version: | $VERSION</item>
103 <item icon=\"tazpkg\">Category: | $CATEGORY</item>"
104 [ -n "$SIZES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
105 <item icon=\"tazpkg\">Size: | $SIZES</item>"
106 PACKAGE_INFOS="$PACKAGE_INFOS
107 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
108 </tree>
110 <hbox>
111 <button>
112 <label>Get-install</label>
113 <input file icon=\"go-next\"></input>
114 <action>xterm -T \"Install $PACKAGE\" $XTERM_OPTS -e \"\
115 tazpkg get-install $PACKAGE; sleep 2\"</action>
116 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
117 </button>
118 <button>
119 <label>Get</label>
120 <input file icon=\"go-next\"></input>
121 <action>xterm -T \"Get $PACKAGE\" $XTERM_OPTS -e \"\
122 cd /var/cache/tazpkg; tazpkg get $PACKAGE; sleep 2\"</action>
123 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
124 </button>
125 <button>
126 <input file icon=\"gtk-close\"></input>
127 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
128 </button>
129 </hbox>
131 </vbox>
132 </window>
133 "
134 export PACKAGE_INFOS
135 fi
137 gtkdialog --center --program=PACKAGE_INFOS
139 exit 0