rev |
line source |
pankso@7
|
1 #!/bin/sh
|
pankso@7
|
2 #
|
paul@52
|
3 # TazPKG CGI interface - Manage packages via a browser
|
pankso@7
|
4 #
|
paul@52
|
5 # This CGI interface intensively uses tazpkg to manage packages and have
|
paul@52
|
6 # its own code for some tasks. Please KISS, it is important and keep speed
|
pankso@7
|
7 # in mind. Thanks, Pankso.
|
pankso@7
|
8 #
|
pankso@44
|
9 # (C) 2011 SliTaz GNU/Linux - GNU gpl v3
|
pankso@7
|
10 #
|
pankso@7
|
11 echo "Content-Type: text/html"
|
pankso@7
|
12 echo ""
|
pankso@7
|
13
|
pankso@17
|
14 . lib/libtazpanel
|
pankso@17
|
15 get_config
|
pankso@7
|
16
|
pankso@7
|
17 # Include gettext helper script.
|
pankso@7
|
18 . /usr/bin/gettext.sh
|
pankso@7
|
19
|
pankso@7
|
20 # Export package name for gettext.
|
pankso@39
|
21 TEXTDOMAIN='tazpanel'
|
pankso@7
|
22 export TEXTDOMAIN
|
pankso@7
|
23
|
pankso@49
|
24 # xHTML 5 header with special side bar fo categories.
|
pankso@34
|
25 TITLE="- Packages"
|
pankso@41
|
26 xhtml_header | sed 's/id="content"/id="content-sidebar"/'
|
pankso@67
|
27
|
pankso@7
|
28
|
pankso@7
|
29 # We need packages information for list and search
|
pankso@7
|
30 parse_packages_desc() {
|
pankso@45
|
31 IFS="|"
|
pankso@45
|
32 cut -f 1,2,3,5 -d "|" | while read PACKAGE VERSION SHORT_DESC WEB_SITE
|
pankso@7
|
33 do
|
pankso@7
|
34 echo '<tr>'
|
pankso@46
|
35 if [ -d $INSTALLED/${PACKAGE% } ]; then
|
pankso@46
|
36 echo -e "<td><input type='checkbox' name='pkg' value='$PACKAGE'>\n
|
pankso@45
|
37 <a href='$SCRIPT_NAME?info=$PACKAGE'>
|
pankso@45
|
38 <img src='$IMAGES/tazpkg-installed.png'/>$PACKAGE</a></td>"
|
pankso@7
|
39 else
|
pankso@46
|
40 echo -e "<td><input type='checkbox' name='pkg' value='$PACKAGE'>\n
|
pascal@62
|
41 <a href='$SCRIPT_NAME?info=$PACKAGE'>
|
pascal@62
|
42 <img src='$IMAGES/tazpkg.png'/>$PACKAGE</a></td>"
|
pankso@7
|
43 fi
|
pankso@45
|
44 echo "<td>$VERSION</td>"
|
pankso@45
|
45 echo "<td class='desc'>$SHORT_DESC</td>"
|
pankso@45
|
46 echo "<td><a href='$WEB_SITE'>web</a></td>"
|
pankso@7
|
47 echo '</tr>'
|
pankso@7
|
48 done
|
pankso@45
|
49 unset IFS
|
pankso@7
|
50 }
|
pankso@7
|
51
|
pankso@7
|
52 # Remove status and ESC char from tazpkg commands output
|
pankso@7
|
53 filter_tazpkg_msgs() {
|
pankso@7
|
54 grep ^[a-zA-Z0-9] | sed s'/\.*\]//'
|
pankso@7
|
55 }
|
pankso@7
|
56
|
pankso@7
|
57 # Display a full summary of packages stats
|
pankso@7
|
58 packages_summary() {
|
pankso@37
|
59 gettext "Last recharge : "
|
pankso@37
|
60 stat=`stat -c %y $LOCALSTATE/packages.list | \
|
pankso@37
|
61 sed 's/\(:..\):.*/\1/' | awk '{print $1}'`
|
pankso@37
|
62 mtime=`find /var/lib/tazpkg/packages.list -mtime +10`
|
pankso@37
|
63 echo -n "$stat "
|
pankso@37
|
64 if [ "$mtime" ]; then
|
pankso@37
|
65 echo "(Older than 10 days)"
|
pankso@37
|
66 else
|
pankso@37
|
67 echo "(Not older than 10 days)"
|
pankso@37
|
68 fi
|
pankso@8
|
69 gettext "Installed packages : "
|
pankso@7
|
70 ls $INSTALLED | wc -l
|
pankso@8
|
71 gettext "Mirrored packages : "
|
pankso@7
|
72 cat $LOCALSTATE/packages.list | wc -l
|
pankso@49
|
73 gettext "Upgradeable packages : "
|
pankso@47
|
74 cat $LOCALSTATE/packages.up | wc -l
|
pankso@44
|
75 #gettext "Installed files : "
|
pankso@44
|
76 #cat $INSTALLED/*/files.list | wc -l
|
pankso@8
|
77 gettext "Blocked packages : "
|
pankso@8
|
78 cat $LOCALSTATE/blocked-packages.list | wc -l
|
pankso@7
|
79 }
|
pankso@7
|
80
|
pankso@10
|
81 # Parse mirrors list to be able to have an icon an remove link
|
pankso@10
|
82 list_mirrors() {
|
pankso@10
|
83 cat $LOCALSTATE/mirrors | while read line
|
pankso@10
|
84 do
|
pankso@10
|
85 cat << EOT
|
pankso@10
|
86 <li><a href="$SCRIPT_NAME?config=rm-mirror=$line"><img
|
pankso@10
|
87 src="$IMAGES/clear.png" /></a><a href="$line">$line</a></li>
|
pankso@10
|
88 EOT
|
pankso@10
|
89 done
|
pankso@10
|
90 }
|
pankso@10
|
91
|
pankso@7
|
92 #
|
pankso@7
|
93 # xHTML functions
|
pankso@7
|
94 #
|
pankso@7
|
95
|
pankso@17
|
96 # ENTER will search but user may search for a button, so put one.
|
pankso@9
|
97 search_form() {
|
pankso@9
|
98 cat << EOT
|
pankso@9
|
99 <div class="search">
|
pankso@17
|
100 <form method="get" action="$SCRIPT_NAME">
|
pankso@17
|
101 <p>
|
pankso@17
|
102 <input type="text" name="search" size="20">
|
pankso@17
|
103 <input type="submit" value="`gettext "Search"`">
|
pankso@17
|
104 </p>
|
pankso@17
|
105 </form>
|
pankso@9
|
106 </div>
|
pankso@9
|
107 EOT
|
pankso@9
|
108 }
|
pankso@9
|
109
|
pankso@17
|
110 table_head() {
|
pankso@7
|
111 cat << EOT
|
pankso@7
|
112 <tr id="thead">
|
pankso@7
|
113 <td>`gettext "Name"`</td>
|
pankso@7
|
114 <td>`gettext "Version"`</td>
|
pankso@7
|
115 <td>`gettext "Description"`</td>
|
pankso@7
|
116 <td>`gettext "Web"`</td>
|
pankso@7
|
117 </tr>
|
pankso@7
|
118 EOT
|
pankso@7
|
119 }
|
pankso@7
|
120
|
pankso@41
|
121 sidebar() {
|
pankso@7
|
122 cat << EOT
|
pankso@41
|
123 <div id="sidebar">
|
pankso@41
|
124 <h4>Categories</h4>
|
pankso@41
|
125 <a class="active_base-system" href="$SCRIPT_NAME?cat=base-system">Base-system</a>
|
pankso@41
|
126 <a class="active_x-window" href="$SCRIPT_NAME?cat=x-window">X window</a>
|
pankso@41
|
127 <a class="active_utilities" href="$SCRIPT_NAME?cat=utilities">Utilities</a>
|
pankso@41
|
128 <a class="active_network" href="$SCRIPT_NAME?cat=network">Network</a>
|
pankso@41
|
129 <a class="active_games" href="$SCRIPT_NAME?cat=games">Games</a>
|
pankso@41
|
130 <a class="active_graphics" href="$SCRIPT_NAME?cat=graphics">Graphics</a>
|
pankso@41
|
131 <a class="active_office" href="$SCRIPT_NAME?cat=office">Office</a>
|
pankso@41
|
132 <a class="active_multimedia" href="$SCRIPT_NAME?cat=multimedia">Multimedia</a>
|
pankso@41
|
133 <a class="active_developement" href="$SCRIPT_NAME?cat=development">Development</a>
|
pankso@41
|
134 <a class="active_system-tools" href="$SCRIPT_NAME?cat=system-tools">System tools</a>
|
pankso@41
|
135 <a class="active_security" href="$SCRIPT_NAME?cat=security">Security</a>
|
pankso@41
|
136 <a class="active_misc" href="$SCRIPT_NAME?cat=misc">Misc</a>
|
pankso@41
|
137 <a class="active_meta" href="$SCRIPT_NAME?cat=meta">Meta</a>
|
pankso@41
|
138 <a class="active_non-free" href="$SCRIPT_NAME?cat=non-free">Non free</a>
|
pankso@9
|
139 </div>
|
pankso@7
|
140 EOT
|
pankso@7
|
141 }
|
pankso@7
|
142
|
pankso@45
|
143 #
|
pankso@45
|
144 # Commands
|
pankso@45
|
145 #
|
pankso@45
|
146
|
pankso@45
|
147 case "$QUERY_STRING" in
|
pankso@45
|
148 list*)
|
pankso@45
|
149 #
|
pankso@45
|
150 # List installed packages. This is the default because parsing
|
pankso@45
|
151 # the full packages.desc can be long and take some resources
|
pankso@45
|
152 #
|
pankso@45
|
153 cd $INSTALLED
|
pankso@45
|
154 search_form
|
pankso@45
|
155 sidebar
|
pankso@45
|
156 LOADING_MSG="Listing packages..."
|
pankso@45
|
157 loading_msg
|
pankso@45
|
158 cat << EOT
|
pankso@45
|
159 <h2>`gettext "My packages"`</h2>
|
pankso@45
|
160 <form method='get' action='$SCRIPT_NAME'>
|
pankso@45
|
161 <div id="actions">
|
pankso@46
|
162 <div class="float-left">
|
pankso@46
|
163 `gettext "Selection:"`
|
pankso@46
|
164 <input type="submit" name="do" value="Remove" />
|
pankso@46
|
165 </div>
|
pankso@46
|
166 <div class="float-right">
|
pankso@46
|
167 `gettext "List:"`
|
pankso@46
|
168 <input type="submit" name="recharge" value="Recharge" />
|
pankso@47
|
169 <input type="submit" name="up" value="Upgrade" />
|
pankso@46
|
170 </div>
|
pankso@41
|
171 </div>
|
pankso@7
|
172 EOT
|
pankso@7
|
173 table_start
|
pankso@41
|
174 table_head
|
pankso@7
|
175 for pkg in *
|
pankso@7
|
176 do
|
pankso@7
|
177 . $pkg/receipt
|
pankso@7
|
178 echo '<tr>'
|
pankso@7
|
179 # Use default tazpkg icon since all packages displayed are
|
pankso@7
|
180 # installed
|
pankso@7
|
181 echo "<td class='pkg'>
|
pankso@7
|
182 <input type='checkbox' name='pkg' value=\"$pkg\" />
|
pankso@7
|
183 <a href='$SCRIPT_NAME?info=$pkg'><img
|
pankso@41
|
184 src='$IMAGES/tazpkg-installed.png'/>$pkg</a></td>"
|
pankso@7
|
185 echo "<td>$VERSION</td>"
|
pankso@7
|
186 echo "<td class='desc'>$SHORT_DESC</td>"
|
pankso@7
|
187 echo "<td><a href='$WEB_SITE'>web</a></td>"
|
pankso@7
|
188 echo '</tr>'
|
pankso@7
|
189 done
|
pankso@7
|
190 table_end
|
pankso@7
|
191 echo '</form>' ;;
|
pankso@41
|
192 cat*)
|
pankso@45
|
193 #
|
pankso@41
|
194 # List all available packages by category on mirror. Listing all
|
paul@52
|
195 # packages is too resource intensive and not useful.
|
pankso@45
|
196 #
|
pankso@9
|
197 cd $LOCALSTATE
|
pankso@41
|
198 category=${QUERY_STRING#cat=}
|
pankso@41
|
199 [ "${QUERY_STRING}" == "cat" ] && category="base-system"
|
pankso@9
|
200 search_form
|
pankso@41
|
201 sidebar | sed s/"active_${category}"/"active"/
|
pankso@45
|
202 LOADING_MSG="Listing packages..."
|
pankso@45
|
203 loading_msg
|
pankso@9
|
204 cat << EOT
|
pankso@41
|
205 <h2>`gettext "Category:"` $category</h2>
|
pankso@9
|
206 <form method='get' action='$SCRIPT_NAME'>
|
pankso@9
|
207 <div id="actions">
|
pankso@45
|
208 <div class="float-left">
|
pankso@45
|
209 `gettext "Selection:"`
|
pankso@45
|
210 <input type="submit" name="do" value="Install" />
|
pankso@45
|
211 <input type="submit" name="do" value="Remove" />
|
pankso@45
|
212 </div>
|
pankso@45
|
213 <div class="float-right">
|
pankso@45
|
214 `gettext "List:"`
|
pankso@45
|
215 <input type="submit" name="recharge" value="Recharge" />
|
pankso@47
|
216 <input type="submit" name="up" value="Upgrade" />
|
pankso@45
|
217 <a class="button" href='$SCRIPT_NAME?list'>
|
pankso@45
|
218 <img src="$IMAGES/tazpkg.png" />`gettext "My packages"`</a>
|
pankso@45
|
219 </div>
|
pankso@9
|
220 EOT
|
pankso@9
|
221 echo '</div>'
|
pankso@7
|
222 table_start
|
pankso@17
|
223 table_head
|
pankso@41
|
224 grep "| $category |" packages.desc | parse_packages_desc
|
pankso@7
|
225 table_end
|
pankso@7
|
226 echo '</form>' ;;
|
pankso@7
|
227 search=*)
|
pankso@45
|
228 #
|
pankso@63
|
229 # Search for packages. Here default is to search in packages.desc
|
pankso@63
|
230 # and so get result including packages names and descriptions
|
pankso@45
|
231 #
|
pankso@7
|
232 pkg=${QUERY_STRING#*=}
|
pankso@9
|
233 cd $LOCALSTATE
|
pankso@9
|
234 search_form
|
pankso@41
|
235 sidebar
|
pankso@45
|
236 LOADING_MSG="Searching packages..."
|
pankso@45
|
237 loading_msg
|
pankso@7
|
238 cat << EOT
|
pankso@17
|
239 <h2>`gettext "Search packages"`</h2>
|
pankso@7
|
240 <form method="get" action="$SCRIPT_NAME">
|
pankso@9
|
241 <div id="actions">
|
pankso@45
|
242 <div class="float-left">
|
pankso@45
|
243 `gettext "Selection:"`
|
pankso@45
|
244 <input type="submit" name="do" value="Install" />
|
pankso@45
|
245 <input type="submit" name="do" value="Remove" />
|
pankso@45
|
246 <a href="`cat $PANEL/lib/checkbox.js`">`gettext "Toogle all"`</a>
|
pankso@45
|
247 </div>
|
pankso@45
|
248 <div class="float-right">
|
pankso@45
|
249 `gettext "List:"`
|
pankso@45
|
250 <input type="submit" name="recharge" value="Recharge" />
|
pankso@47
|
251 <input type="submit" name="up" value="Upgrade" />
|
pankso@45
|
252 <a class="button" href='$SCRIPT_NAME?list'>
|
pankso@45
|
253 <img src="$IMAGES/tazpkg.png" />`gettext "My packages"`</a>
|
pankso@45
|
254 </div>
|
pankso@7
|
255 EOT
|
pankso@9
|
256 echo '</div>'
|
pankso@7
|
257 table_start
|
pankso@17
|
258 table_head
|
pankso@63
|
259 grep -i $pkg packages.desc | parse_packages_desc
|
pankso@7
|
260 table_end
|
pankso@7
|
261 echo '</form>' ;;
|
pankso@41
|
262 recharge*)
|
pankso@45
|
263 #
|
pankso@7
|
264 # Let recharge the packages list
|
pankso@45
|
265 #
|
pankso@9
|
266 search_form
|
pankso@41
|
267 sidebar
|
pankso@45
|
268 LOADING_MSG="Recharging lists..."
|
pankso@45
|
269 loading_msg
|
pankso@8
|
270 cat << EOT
|
pankso@9
|
271 <h2>`gettext "Recharge"`</h2>
|
pankso@9
|
272 <form method='get' action='$SCRIPT_NAME'>
|
pankso@9
|
273 <div id="actions">
|
pankso@41
|
274 <div class="float-left">
|
pankso@41
|
275 <p>
|
pankso@45
|
276 `gettext "Recharge checks for new or updated packages"`
|
pankso@41
|
277 </p>
|
pankso@41
|
278 </div>
|
pankso@41
|
279 <div class="float-right">
|
pankso@41
|
280 <p>
|
pankso@47
|
281 <a class="button" href='$SCRIPT_NAME?up'>
|
pankso@45
|
282 `gettext "Check upgrade"`</a>
|
pankso@41
|
283 <a class="button" href='$SCRIPT_NAME?list'>
|
pankso@41
|
284 <img src="$IMAGES/tazpkg.png" />`gettext "My packages"`</a>
|
pankso@41
|
285 </p>
|
pankso@41
|
286 </div>
|
pankso@41
|
287 </div>
|
pankso@22
|
288 <pre>
|
pankso@8
|
289 EOT
|
pankso@76
|
290 echo "$(date +%Y%M%d-%H:%M) Recharging packages list" | log
|
pankso@8
|
291 tazpkg recharge | filter_tazpkg_msgs
|
pankso@45
|
292 cat << EOT
|
pankso@45
|
293 </pre>
|
pankso@45
|
294 <p>
|
paul@52
|
295 `gettext "Packages lists are up-to-date. You should check for upgrades now."`
|
pankso@45
|
296 </p>
|
pankso@45
|
297 EOT
|
pankso@45
|
298 ;;
|
pankso@47
|
299 up*)
|
pankso@45
|
300 #
|
pankso@45
|
301 # Ugrade packages
|
pankso@45
|
302 #
|
pankso@9
|
303 cd $LOCALSTATE
|
pankso@9
|
304 search_form
|
pankso@41
|
305 sidebar
|
paul@52
|
306 LOADING_MSG="Checking for upgrades..."
|
pankso@45
|
307 loading_msg
|
pankso@8
|
308 cat << EOT
|
paul@52
|
309 <h2>`gettext "Up packages"`</h2>
|
pankso@8
|
310 <form method="get" action="$SCRIPT_NAME">
|
pankso@9
|
311 <div id="actions">
|
pankso@47
|
312 <div class="float-left">
|
pankso@47
|
313 `gettext "Selection:"`
|
pankso@47
|
314 <input type="submit" name="do" value="Install" />
|
pankso@47
|
315 <input type="submit" name="do" value="Remove" />
|
pankso@47
|
316 <a href="`cat $PANEL/lib/checkbox.js`">`gettext "Toogle all"`</a>
|
pankso@47
|
317 </div>
|
pankso@47
|
318 <div class="float-right">
|
pankso@47
|
319 `gettext "List:"`
|
pankso@47
|
320 <input type="submit" name="recharge" value="Recharge" />
|
pankso@47
|
321 <a class="button" href='$SCRIPT_NAME?list'>
|
pankso@47
|
322 <img src="$IMAGES/tazpkg.png" />`gettext "My packages"`</a>
|
pankso@47
|
323 </div>
|
pankso@45
|
324 </div>
|
pankso@8
|
325 EOT
|
pankso@47
|
326 tazpkg up --check >/dev/null
|
pankso@8
|
327 table_start
|
pankso@17
|
328 table_head
|
pankso@47
|
329 for pkg in `cat packages.up`
|
pankso@8
|
330 do
|
pankso@8
|
331 grep "^$pkg |" $LOCALSTATE/packages.desc | parse_packages_desc
|
pankso@8
|
332 done
|
pankso@8
|
333 table_end
|
pankso@8
|
334 echo '</form>' ;;
|
pankso@7
|
335 do=*)
|
pankso@45
|
336 #
|
pankso@7
|
337 # Do an action on one or some packages
|
pankso@45
|
338 #
|
pankso@7
|
339 cmdline=`echo ${QUERY_STRING#do=} | sed s'/&/ /g'`
|
pankso@7
|
340 cmd=`echo ${cmdline} | awk '{print $1}'`
|
pankso@7
|
341 pkgs=`echo $cmdline | sed -e s'/+/ /g' -e s'/pkg=//g' -e s/$cmd//`
|
pankso@41
|
342 case $cmd in
|
pankso@41
|
343 install|Install)
|
pankso@41
|
344 cmd=get-install opt=--forced ;;
|
pankso@41
|
345 remove|Remove)
|
pankso@41
|
346 cmd=remove ;;
|
pankso@41
|
347 esac
|
pankso@9
|
348 search_form
|
pankso@41
|
349 sidebar
|
pankso@45
|
350 LOADING_MSG="${cmd}ing packages..."
|
pankso@45
|
351 loading_msg
|
pankso@9
|
352 cat << EOT
|
pankso@9
|
353 <h2>Tazpkg: $cmd</h2>
|
pankso@9
|
354 <form method="get" action="$SCRIPT_NAME">
|
pankso@9
|
355 <div id="actions">
|
pankso@41
|
356 <div class="float-left">
|
pankso@41
|
357 <p>
|
paul@52
|
358 `gettext "Performing tasks on packages"`
|
pankso@41
|
359 </p>
|
pankso@41
|
360 </div>
|
pankso@41
|
361 <div class="float-right">
|
pankso@41
|
362 <p>
|
pankso@41
|
363 <a class="button" href='$SCRIPT_NAME?list'>
|
pankso@41
|
364 <img src="$IMAGES/tazpkg.png" />`gettext "My packages"`</a>
|
pankso@41
|
365 </p>
|
pankso@41
|
366 </div>
|
pankso@41
|
367 </div>
|
pankso@9
|
368 EOT
|
pankso@45
|
369 echo '<div class="box">'
|
pankso@10
|
370 gettext "Executing $cmd for:$pkgs"
|
pankso@45
|
371 echo '</div>'
|
pankso@7
|
372 for pkg in $pkgs
|
pankso@7
|
373 do
|
pankso@10
|
374 echo '<pre>'
|
pankso@45
|
375 echo 'o' | tazpkg $cmd $pkg $opt 2>/dev/null | filter_tazpkg_msgs
|
pankso@7
|
376 echo '</pre>'
|
pankso@7
|
377 done ;;
|
pankso@7
|
378 info=*)
|
pankso@45
|
379 #
|
pankso@45
|
380 # Packages info
|
pankso@45
|
381 #
|
pankso@7
|
382 pkg=${QUERY_STRING#*=}
|
pankso@9
|
383 search_form
|
pankso@41
|
384 sidebar
|
pascal@62
|
385 if [ -d $INSTALLED/$pkg ]; then
|
pascal@62
|
386 . $INSTALLED/$pkg/receipt
|
pascal@62
|
387 files=`cat $INSTALLED/$pkg/files.list | wc -l`
|
pankso@64
|
388 action=$(gettext "Remove")
|
pascal@62
|
389 else
|
pascal@62
|
390 cd $LOCALSTATE
|
pankso@64
|
391 LOADING_MSG=$(gettext "Getting package info...")
|
pankso@64
|
392 loading_msg
|
pascal@62
|
393 IFS='|'
|
pascal@62
|
394 set -- $(grep "^$pkg |" packages.desc)
|
pascal@62
|
395 unset IFS
|
pascal@62
|
396 PACKAGE=$1
|
pascal@62
|
397 VERSION="$(echo $2)"
|
pascal@62
|
398 SHORT_DESC="$(echo $3)"
|
pascal@62
|
399 CATEGORY="$(echo $4)"
|
pascal@62
|
400 WEB_SITE="$(echo $5)"
|
pankso@64
|
401 action=$(gettext "Install")
|
pascal@62
|
402 fi
|
pankso@7
|
403 cat << EOT
|
pankso@41
|
404 <h2>`gettext "Package"` $PACKAGE</h2>
|
pankso@9
|
405 <div id="actions">
|
pankso@41
|
406 <div class="float-left">
|
pankso@41
|
407 <p>
|
pankso@64
|
408 <a class="button" href='$SCRIPT_NAME?do=$action&$pkg'>$action</a>
|
pankso@41
|
409 </p>
|
pankso@41
|
410 </div>
|
pankso@41
|
411 <div class="float-right">
|
pankso@41
|
412 <p>
|
pankso@41
|
413 <a class="button" href='$SCRIPT_NAME?list'>
|
pankso@41
|
414 <img src="$IMAGES/tazpkg.png" />`gettext "My packages"`</a>
|
pankso@41
|
415 </p>
|
pankso@41
|
416 </div>
|
pankso@9
|
417 </div>
|
pankso@22
|
418 <pre>
|
pankso@7
|
419 Name : $PACKAGE
|
pankso@7
|
420 Version : $VERSION
|
pankso@7
|
421 Description : $SHORT_DESC
|
pankso@41
|
422 Category : $CATEGORY
|
pascal@62
|
423 EOT
|
pascal@62
|
424 if [ -d $INSTALLED/$pkg ]; then
|
pascal@62
|
425 cat << EOT
|
pankso@10
|
426 Maintainer : $MAINTAINER
|
pankso@8
|
427 Depends : `for i in $DEPENDS; do echo -n \
|
pankso@8
|
428 "<a href="$SCRIPT_NAME?info=$i">$i</a> "; done`
|
pankso@7
|
429 Website : <a href="$WEB_SITE">$WEB_SITE</a>
|
pankso@7
|
430 Sizes : $PACKED_SIZE/$UNPACKED_SIZE
|
pankso@7
|
431 </pre>
|
pankso@7
|
432
|
pankso@41
|
433 <p>`gettext "Installed files:"` `cat $INSTALLED/$pkg/files.list | wc -l`</p>
|
pankso@7
|
434 <pre>
|
pankso@7
|
435 `cat $INSTALLED/$pkg/files.list`
|
pankso@7
|
436 </pre>
|
pankso@7
|
437 EOT
|
pascal@62
|
438 else
|
pascal@62
|
439 cat << EOT
|
pascal@62
|
440 Website : <a href="$WEB_SITE">$WEB_SITE</a>
|
pascal@62
|
441 Sizes : `grep -A 3 ^$pkg$ packages.txt | tail -n 1 | sed 's/ *//'`
|
pascal@62
|
442 </pre>
|
pascal@62
|
443
|
pascal@62
|
444 <p>`gettext "Installed files:"`</p>
|
pascal@62
|
445 <pre>
|
pascal@62
|
446 `unlzma -c files.list.lzma | sed "/^$pkg: /!d;s/^$pkg: //"`
|
pascal@62
|
447 </pre>
|
pascal@62
|
448 EOT
|
pascal@62
|
449 fi
|
pankso@7
|
450 ;;
|
pankso@10
|
451 config*)
|
pankso@45
|
452 #
|
pankso@10
|
453 # Tazpkg configuration page
|
pankso@45
|
454 #
|
pankso@10
|
455 cmd=${QUERY_STRING#*=}
|
pankso@10
|
456 case "$cmd" in
|
pankso@10
|
457 clean)
|
pankso@10
|
458 rm -rf /var/cache/tazpkg/* ;;
|
pankso@10
|
459 add-mirror*=http*|add-mirror*=ftp*)
|
pankso@10
|
460 # Decode url
|
pankso@10
|
461 mirror=`httpd -d ${cmd#*=}`
|
pankso@10
|
462 echo "$mirror" >> $LOCALSTATE/mirrors ;;
|
pankso@10
|
463 rm-mirror=http://*|rm-mirror=ftp://*)
|
pankso@10
|
464 mirror=${QUERY_STRING#*=rm-mirror=}
|
pankso@10
|
465 sed -i -e "s@$mirror@@" -e '/^$/d' $LOCALSTATE/mirrors ;;
|
pankso@10
|
466 esac
|
pankso@10
|
467 cache_files=`find /var/cache/tazpkg -name *.tazpkg | wc -l`
|
pankso@10
|
468 cache_size=`du -sh /var/cache/tazpkg`
|
pankso@41
|
469 sidebar
|
pankso@10
|
470 cat << EOT
|
pankso@10
|
471 <h2>`gettext "Configuration"`</h2>
|
pankso@10
|
472 <div>
|
pankso@10
|
473 <p>`gettext "Tazpkg configuration and settings"`</p>
|
pankso@10
|
474 </div>
|
pankso@10
|
475 <div>
|
pankso@10
|
476 <form method="get" action="$SCRIPT_NAME">
|
pankso@17
|
477 <p>
|
pankso@17
|
478 `gettext "Packages in the cache:"` $cache_files ($cache_size)
|
pankso@17
|
479 <input type="hidden" name="config" value="clean" />
|
pankso@17
|
480 <input type="submit" value="Clean" />
|
pankso@17
|
481 </p>
|
pankso@10
|
482 </form>
|
pankso@10
|
483 </div>
|
pankso@17
|
484
|
pankso@10
|
485 <h3>`gettext "Current mirror list"`</h3>
|
pankso@10
|
486 <div class="box">
|
pankso@10
|
487 <ul>
|
pankso@10
|
488 `list_mirrors`
|
pankso@10
|
489 </ul>
|
pankso@10
|
490 </div>
|
pankso@10
|
491 <form method="get" action="$SCRIPT_NAME">
|
pankso@10
|
492 <p>
|
pankso@10
|
493 <input type="hidden" name="config" value="add-mirror" />
|
pankso@10
|
494 <input type="text" name="mirror" size="60">
|
pankso@10
|
495 <input type="submit" value="Add mirror" />
|
pankso@10
|
496 </p>
|
pankso@10
|
497 </form>
|
pankso@10
|
498 EOT
|
pankso@10
|
499 ;;
|
pankso@7
|
500 *)
|
pankso@14
|
501 #
|
pankso@7
|
502 # Default to summary
|
pankso@14
|
503 #
|
pankso@10
|
504 search_form
|
pankso@41
|
505 sidebar
|
pankso@7
|
506 cat << EOT
|
pankso@9
|
507 <h2>`gettext "Summary"`</h2>
|
pankso@9
|
508 <div id="actions">
|
pankso@45
|
509 <a class="button" href='$SCRIPT_NAME?list'>
|
pankso@45
|
510 <img src="$IMAGES/tazpkg.png" />`gettext "My packages"`</a>
|
pankso@45
|
511 <a class="button" href='$SCRIPT_NAME?recharge'>
|
pankso@45
|
512 <img src="$IMAGES/recharge.png" />`gettext "Recharge list"`</a>
|
pankso@47
|
513 <a class="button" href='$SCRIPT_NAME?up'>
|
pankso@45
|
514 <img src="$IMAGES/update.png" />`gettext "Check upgrade"`</a>
|
pankso@45
|
515 <a class="button" href='$SCRIPT_NAME?config'>
|
pankso@45
|
516 <img src="$IMAGES/edit.png" />`gettext "Configuration"`</a>
|
pankso@9
|
517 </div>
|
pankso@41
|
518 <pre class="pre-main">
|
pankso@7
|
519 `packages_summary`
|
pankso@7
|
520 </pre>
|
pankso@41
|
521
|
pankso@10
|
522 <h3>`gettext "Latest log entries"`</h3>
|
pankso@10
|
523 <pre>
|
pankso@45
|
524 `tail -n 5 /var/log/tazpkg.log | fgrep "-" | \
|
pankso@10
|
525 awk '{print $1, $2, $3, $4, $5, $6, $7}'`
|
pankso@10
|
526 </pre>
|
pankso@10
|
527
|
pankso@7
|
528 EOT
|
pankso@10
|
529 ;;
|
pankso@7
|
530 esac
|
pankso@7
|
531
|
pankso@7
|
532 # xHTML 5 footer
|
pankso@33
|
533 xhtml_footer
|
pankso@7
|
534 exit 0
|