tazpkg view lib/tazpkgbox/package_infos @ rev 135

Fix more typos
author Mike D. Smith <MikeDSmith25@gmail.com>
date Sun Jul 20 07:42:20 2008 +0000 (2008-07-20)
parents 6f2370eaac9d
children db7e865c0a11
line source
1 #!/bin/sh
2 #
3 # Dialog box to provide package info 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 if [ "$1" = "list_files_mirror" ]; then
20 unlzma -c /var/lib/tazpkg/files.list.lzma | grep -- "^$2:" | \
21 awk '{ print substr($0,index($0,":")+2) }'
22 exit 0
23 fi
25 export LIST_FILES="
26 <window title=\"$PKG files\" icon-name=\"system-file-manager\">
27 <vbox>
28 <tree>
29 <width>600</width><height>160</height>
30 <label>Access | User | Group | Size | Name</label>
31 <input> $0 list_files $PKG </input>
32 </tree>
33 <hbox>
34 <button>
35 <input file icon=\"gtk-close\"></input>
36 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
37 </button>
38 </hbox>
39 </vbox>
40 </window>
41 "
43 export LIST_FILES_MIRROR="
44 <window title=\"$PKG files\" icon-name=\"system-file-manager\">
45 <vbox>
46 <tree>
47 <width>300</width><height>160</height>
48 <label>File Name</label>
49 <input> $0 list_files_mirror $PKG </input>
50 </tree>
51 <hbox>
52 <button>
53 <input file icon=\"gtk-close\"></input>
54 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
55 </button>
56 </hbox>
57 </vbox>
58 </window>
59 "
61 # Installed or not installed, that the question.
62 if [ -d /var/lib/tazpkg/installed/$PKG ]; then
63 PACKED_SIZE=""
64 DEPENDS=""
65 MAINTAINER=""
66 . /var/lib/tazpkg/installed/$PKG/receipt
67 MAINTAINER=$(echo "$MAINTAINER" | sed 's/[<>|]/ /g')
68 PACKAGE_INFOS="
69 <window title=\"Package: $PKG\" icon-name=\"package-x-generic\">
70 <vbox>
72 <tree>
73 <width>460</width><height>160</height>
74 <label>Package|$PKG</label>
75 <variable>FIELD</variable>
76 <item icon=\"tazpkg\">Version: | $VERSION</item>
77 <item icon=\"tazpkg\">Category: | $CATEGORY</item>"
78 [ -n "$DEPENDS" ] && PACKAGE_INFOS="$PACKAGE_INFOS
79 <item icon=\"tazpkg\">Depends: | $(echo $DEPENDS)</item>"
80 [ -n "$PACKED_SIZE" ] && PACKAGE_INFOS="$PACKAGE_INFOS
81 <item icon=\"tazpkg\">Size: | $PACKED_SIZE ($UNPACKED_SIZE installed)</item>"
82 [ -n "$MAINTAINER" ] && PACKAGE_INFOS="$PACKAGE_INFOS
83 <item icon=\"system-users\">Maintainer: | $MAINTAINER</item>"
84 PACKAGE_INFOS="$PACKAGE_INFOS
85 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
86 <action>case \$FIELD in Web*) firefox $WEB_SITE &;; esac</action>
87 </tree>
89 <hbox>"
90 [ $CATEGORY = non-free -a ! -d /var/lib/tazpkg/installed/${PKG#get-} ] && PACKAGE_INFOS="$PACKAGE_INFOS
91 <button>
92 <label>Install</label>
93 <input file icon=\"go-next\"></input>
94 <action>xterm -T \"Install ${PKG#get-}\" $XTERM_OPTS -e \"\
95 $PKG; sleep 5\"</action>
96 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
97 </button>"
98 grep -q post_install /var/lib/tazpkg/installed/$PKG/receipt && PACKAGE_INFOS="$PACKAGE_INFOS
99 <button>
100 <label>Reconfigure</label>
101 <input file icon=\"reload\"></input>
102 <action>xterm -T \"Reconfigure $PACKAGE\" $XTERM_OPTS -e \"\
103 tazpkg reconfigure $PACKAGE; sleep 2\"</action>
104 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
105 </button>"
106 if grep -q ^$PKG$ /var/lib/tazpkg/blocked-packages.list; then
107 PACKAGE_INFOS="$PACKAGE_INFOS
108 <button>
109 <label>Unblock</label>
110 <input file icon=\"up\"></input>
111 <action>xterm -T \"Unblock $PACKAGE\" $XTERM_OPTS -e \"\
112 tazpkg unblock $PACKAGE; sleep 2\"</action>
113 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
114 </button>"
115 else
116 PACKAGE_INFOS="$PACKAGE_INFOS
117 <button>
118 <label>Block</label>
119 <input file icon=\"down\"></input>
120 <action>xterm -T \"Block $PACKAGE\" $XTERM_OPTS -e \"\
121 tazpkg block $PACKAGE; sleep 2\"</action>
122 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
123 </button>"
124 fi
125 PACKAGE_INFOS="$PACKAGE_INFOS
126 <button>
127 <label>Remove</label>
128 <input file icon=\"edit-delete\"></input>
129 <action>xterm -T \"Remove $PACKAGE\" $XTERM_OPTS -e \"\
130 tazpkg remove $PACKAGE; sleep 2\"</action>
131 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
132 </button>
133 <button>
134 <label>Repack</label>
135 <input file icon=\"edit-redo\"></input>
136 <action>xterm -T \"Repack $PACKAGE\" $XTERM_OPTS -e \"\
137 cd /var/cache/tazpkg; \
138 tazpkg repack $PACKAGE; sleep 2\"</action>
139 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
140 </button>
141 <button>
142 <label>Files</label>
143 <input file icon=\"tazpkg\"></input>
144 <action type=\"launch\">LIST_FILES</action>
145 </button>
146 <button>
147 <input file icon=\"gtk-close\"></input>
148 <action type=\"closewindow\">INSTALLED_PACKAGE_ACTIONS</action>
149 </button>
150 </hbox>
152 </vbox>
153 </window>
154 "
155 export PACKAGE_INFOS
156 else
157 RES=`grep "^$PKG" /var/lib/tazpkg/packages.desc | head -n 1`
158 PACKAGE=`echo "$RES" | cut -d "|" -f 1`
159 VERSION=`echo "$RES" | cut -d "|" -f 2`
160 CATEGORY=`echo "$RES" | cut -d "|" -f 4`
161 WEB_SITE=`echo "$RES" | cut -d "|" -f 5`
162 SIZES=`grep -A 3 "^$(echo $PACKAGE)$" /var/lib/tazpkg/packages.txt | tail -1`
163 PACKAGE_INFOS="
164 <window title=\"Package: $PACKAGE\" icon-name=\"package-x-generic\">
165 <vbox>
167 <tree>
168 <width>460</width><height>140</height>
169 <label>Package|$PKG</label>
170 <item icon=\"tazpkg\">Name: | $PACKAGE</item>
171 <item icon=\"tazpkg\">Version: | $VERSION</item>
172 <item icon=\"tazpkg\">Category: | $CATEGORY</item>"
173 [ -n "$SIZES" ] && PACKAGE_INFOS="$PACKAGE_INFOS
174 <item icon=\"tazpkg\">Size: | $SIZES</item>"
175 PACKAGE_INFOS="$PACKAGE_INFOS
176 <item icon=\"applications-internet\">Web site: | $WEB_SITE</item>
177 </tree>
179 <hbox>"
180 [ $CATEGORY = non-free ] && PACKAGE_INFOS="$PACKAGE_INFOS
181 <checkbox>
182 <label>Auto exec</label>
183 <variable>AUTO_EXEC</variable>
184 <default>true</default>
185 </checkbox>"
186 PACKAGE_INFOS="$PACKAGE_INFOS
187 <checkbox>
188 <label>Auto install depends</label>
189 <variable>AUTO_DEPENDS</variable>
190 <default>true</default>
191 </checkbox>
192 <button>
193 <label>Get-install</label>
194 <input file icon=\"go-next\"></input>
195 <action>xterm -T \"Install $PACKAGE\" $XTERM_OPTS -e \"\
196 if [ \$AUTO_DEPENDS != true ]; then tazpkg get-install $PACKAGE;\
197 else yes y | tazpkg get-install $PACKAGE; fi; \
198 [ \${AUTO_EXEC}$CATEGORY = truenon-free ] && $PACKAGE; \
199 sleep 2\"</action>
200 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
201 </button>
202 <button>
203 <label>Get</label>
204 <input file icon=\"go-next\"></input>
205 <action>xterm -T \"Get $PACKAGE\" $XTERM_OPTS -e \"\
206 cd /var/cache/tazpkg; tazpkg get $PACKAGE; sleep 2\"</action>
207 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
208 </button>
209 <button>
210 <label>Files</label>
211 <input file icon=\"tazpkg\"></input>
212 <action type=\"launch\">LIST_FILES_MIRROR</action>
213 </button>
214 <button>
215 <input file icon=\"gtk-close\"></input>
216 <action type=\"closewindow\">MIRRORED_PACKAGE_ACTIONS</action>
217 </button>
218 </hbox>
220 </vbox>
221 </window>
222 "
223 export PACKAGE_INFOS
224 fi
226 gtkdialog --center --program=PACKAGE_INFOS
228 exit 0