tazpkg view lib/tazpkgbox/package_infos @ rev 97

tazpkgbox: add files button
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue May 20 10:17:33 2008 +0000 (2008-05-20)
parents e64d6b7e4d73
children 404417fa9f93
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 if [ "$1" = "list_files" ]; then
11 tazpkg list-files $2 | awk '
12 BEGIN { ls=0 } {
13 if (/^===/) ls=1-ls;
14 else if (ls) system("stat -c \"%A|%U|%G|%s|%n\" " $0);
15 }'
16 exit 0
17 fi
19 export LIST_FILES="
20 <window title=\"$PKG files\" icon-name=\"system-file-manager\">
21 <vbox>
22 <tree>
23 <width>600</width><height>160</height>
24 <label>Access | User | Group | Size | Name</label>
25 <input> $0 list_files $PKG </input>
26 </tree>
27 <hbox>
28 <button>
29 <input file icon=\"gtk-close\"></input>
30 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
31 </button>
32 </hbox>
33 </vbox>
34 </window>
35 "
37 # Installed or not installed, that the question.
38 if [ -d /var/lib/tazpkg/installed/$PKG ]; then
39 PACKED_SIZE=""
40 DEPENDS=""
41 . /var/lib/tazpkg/installed/$PKG/receipt
42 PACKAGE_INFOS="
43 <window title=\"Package: $PKG\" icon-name=\"package-x-generic\">
44 <vbox>
46 <tree>
47 <width>460</width><height>160</height>
48 <label>Package|$PKG</label>
49 <item icon=\"tazpkg\">Version: | $VERSION</item>
50 <item icon=\"tazpkg\">Category: | $CATEGORY</item>"
51 [ -n "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
52 <item icon=\"tazpkg\">Depends: | $DEPENDS</item>"
53 [ -n "$PACKED_SIZE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
54 <item icon=\"tazpkg\">Size: | $PACKED_SIZE ($UNPACKED_SIZE installed)</item>"
55 PACKAGE_INFOS="$PACKAGE_INFOS
56 <item icon=\"system-users\">Maintainer: | $MAINTAINER</item>
57 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
58 </tree>
60 <hbox>"
61 grep -q post_install /var/lib/tazpkg/installed/$PKG/receipt && PACKAGE_INFOS="$PACKAGE_INFOS
62 <button>
63 <label>Reconfigure</label>
64 <input file icon=\"reload\"></input>
65 <action>xterm -T \"Reconfigure $PACKAGE\" $XTERM_OPTS -e \"\
66 tazpkg reconfigure $PACKAGE; sleep 2\"</action>
67 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
68 </button>"
69 if grep -q ^$PKG$ /var/lib/tazpkg/blocked-packages.list; then
70 PACKAGE_INFOS="$PACKAGE_INFOS
71 <button>
72 <label>Unblock</label>
73 <input file icon=\"up\"></input>
74 <action>xterm -T \"Unblock $PACKAGE\" $XTERM_OPTS -e \"\
75 tazpkg unblock $PACKAGE; sleep 2\"</action>
76 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
77 </button>"
78 else
79 PACKAGE_INFOS="$PACKAGE_INFOS
80 <button>
81 <label>Block</label>
82 <input file icon=\"down\"></input>
83 <action>xterm -T \"Block $PACKAGE\" $XTERM_OPTS -e \"\
84 tazpkg block $PACKAGE; sleep 2\"</action>
85 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
86 </button>"
87 fi
88 PACKAGE_INFOS="$PACKAGE_INFOS
89 <button>
90 <label>Remove</label>
91 <input file icon=\"edit-delete\"></input>
92 <action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
93 tazpkg remove $PACKAGE; sleep 2\"</action>
94 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
95 </button>
96 <button>
97 <label>Repack</label>
98 <input file icon=\"edit-redo\"></input>
99 <action>xterm -T \"Repack $PACKAGE\" $XTERM_OPTS -e \"\
100 cd /var/cache/tazpkg; \
101 tazpkg repack $PACKAGE; sleep 2\"</action>
102 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
103 </button>
104 <button>
105 <label>Files</label>
106 <input file icon=\"tazpkg\"></input>
107 <action type=\"launch\">LIST_FILES</action>
108 </button>
109 <button>
110 <input file icon=\"gtk-close\"></input>
111 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
112 </button>
113 </hbox>
115 </vbox>
116 </window>
117 "
118 export PACKAGE_INFOS
119 else
120 RES=`grep "^$PKG" /var/lib/tazpkg/packages.desc | head -n 1`
121 PACKAGE=`echo "$RES" | cut -d "|" -f 1`
122 VERSION=`echo "$RES" | cut -d "|" -f 2`
123 CATEGORY=`echo "$RES" | cut -d "|" -f 4`
124 WEB_SITE=`echo "$RES" | cut -d "|" -f 5`
125 SIZES=`grep -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt | tail -1`
126 PACKAGE_INFOS="
127 <window title=\"Package: $PACKAGE\" icon-name=\"package-x-generic\">
128 <vbox>
130 <tree>
131 <width>460</width><height>140</height>
132 <label>Package|$PKG</label>
133 <item icon=\"tazpkg\">Name: | $PACKAGE</item>
134 <item icon=\"tazpkg\">Version: | $VERSION</item>
135 <item icon=\"tazpkg\">Category: | $CATEGORY</item>"
136 [ -n "$SIZES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
137 <item icon=\"tazpkg\">Size: | $SIZES</item>"
138 PACKAGE_INFOS="$PACKAGE_INFOS
139 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
140 </tree>
142 <hbox>
143 <button>
144 <label>Get-install</label>
145 <input file icon=\"go-next\"></input>
146 <action>xterm -T \"Install $PACKAGE\" $XTERM_OPTS -e \"\
147 tazpkg get-install $PACKAGE; sleep 2\"</action>
148 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
149 </button>
150 <button>
151 <label>Get</label>
152 <input file icon=\"go-next\"></input>
153 <action>xterm -T \"Get $PACKAGE\" $XTERM_OPTS -e \"\
154 cd /var/cache/tazpkg; tazpkg get $PACKAGE; sleep 2\"</action>
155 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
156 </button>
157 <button>
158 <input file icon=\"gtk-close\"></input>
159 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
160 </button>
161 </hbox>
163 </vbox>
164 </window>
165 "
166 export PACKAGE_INFOS
167 fi
169 gtkdialog --center --program=PACKAGE_INFOS
171 exit 0