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