[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: a2ps - Dokumentation in Sid



Frank Küster <frank@debian.org> wrote:

> Das gibt's nur als Skript in den Weiten des Netzes.  Ich habe eine
> Variante, die auch noch die Frage "welche Version ist in testing/..."
> beantwortet, ich hänge sie mal an.

Und habe es latürnich vergessen, hier kommt es.

#! /bin/sh

#   findpkg - Find files and packages in Debian
#   Copyright (c) 2000,03  Martin Schulze <joey@infodrom.org>
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program; if not, write to the Free Software
#   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA

# Updates: http://www.infodrom.org/Infodrom/tools/findpkg.html

server=ftp.de.debian.org

#dist=woody
dist=unstable
searchdists=

arch=`dpkg --print-installation-architecture`
prepattern='.*'
postpattern=

if [ $# -gt 0 ]
then
  while [ $1 ]; do
    case $1 in
      -e)
      prepattern=' '
      postpattern='$'
      ;;
      --update|-u)
      tmp=`tempfile`
      for mydist in oldstable stable testing unstable; do
	  wget -O $tmp http://${server}/debian/dists/${mydist}/Contents-${arch}.gz
	  cp $tmp /var/lib/dpkg/Contents-${mydist}-${arch}.gz
	  chmod go+r /var/lib/dpkg/Contents-${mydist}-${arch}.gz
	  rm -f $tmp
      done
      for mydist in oldstable stable testing unstable; do
	  wget -O $tmp http://${server}/pub/debian/dists/${mydist}/main/binary-${arch}/Packages.gz
	  cp $tmp /var/lib/dpkg/Packages-${mydist}-${arch}.gz
	  wget -O $tmp http://${server}/pub/debian/dists/${mydist}/contrib/binary-${arch}/Packages.gz
	  cat $tmp >> /var/lib/dpkg/Packages-${mydist}-${arch}.gz
	  wget -O $tmp http://${server}/pub/debian/dists/${mydist}/non-free/binary-${arch}/Packages.gz
	  cat $tmp >> /var/lib/dpkg/Packages-${mydist}-${arch}.gz
	  chmod go+r /var/lib/dpkg/Packages-${mydist}-${arch}.gz
	  rm -f $tmp
      done
      ;;
      --oldstable|-o)
      searchdists="${searchdists} oldstable"
      ;;
      --stable|-s) #stale ;-)
      searchdists="${searchdists} stable"
      ;;
      --testing|-r) #rusting ;-)
      searchdists="${searchdists} testing"
      ;;
      --unstable|-b) #broken ;-)
      searchdists="${searchdists} unstable"
      ;;
      -v)
      for mydist in ${searchdists:-oldstable stable testing unstable}; do
	  echo
	  echo "***************** ${mydist} *****************"
	  echo
	  zgrep -A 8 "^Package:${prepattern}$2${postpattern}" /var/lib/dpkg/Packages-${mydist}-${arch}.gz | egrep '^Package|^Version'
      done
      shift $#
      ;;
      -*)
      echo "No such parameter \`$1'"
      ;;
      *)
      for mydist in ${searchdists:-oldstable stable testing unstable}; do
	  zgrep "$@" /var/lib/dpkg/Contents-${mydist}-${arch}.gz
      done
      shift $#
      ;;
    esac
    shift
  done
fi

Aufruf:

findpkg <pattern>

   liefert alle Dateinamen, die auf <pattern> passen, und die Paketnamen
   dazu.

findpkg [-o|-s|-r|-b] <pattern>

  schränkt die Treffer auf oldstable, stale, rusting oder broken ein, es
  gibt auch Langformen (dann mit Klarnamen stable, testing, unstable),
  und diese Optionen sind kombinierbar (additiv)

findpkg -v <pattern>

  liefert alle Pakete, die auf <pattern> passen, und die Versionen dazu,
  entweder aus allen Distributionen oder mit [-o|-s|-r|-b] aus den
  ausgewählten. 

Gruß, Frank
-- 
Frank Küster
Inst. f. Biochemie der Univ. Zürich
Debian Developer

Reply to: