File: what-is

package info (click to toggle)
feta 1.4.15
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 444 kB
  • ctags: 85
  • sloc: perl: 1,200; sh: 192; makefile: 55
file content (41 lines) | stat: -rwxr-xr-x 1,085 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
# Copyright (c) 2001 Graham Williams, Kayon Toga, Joe Wreschnig
# Feta plugin for querying Debian servers.
# Licensed under the GNU GPL.

OPTS=`getopt -n configure -o V,q,t,y -- $@`
if [ $? != 0 ] ; then exit 1; fi
eval set -- "$OPTS"
QUIET=0

while true ; do
 case "$1" in
  -q) QUIET=1; shift;;
  -t|-V|-y) shift;;
  --) shift; break;;
 esac
done

if [ $# -eq 0 ]; then
 echo "E: You must provide at least one package name."
 exit 1
fi

if [ $QUIET -eq 0 ]; then
 echo "If you recieve no response, the package is not available on the Debian"
 echo "servers."
fi

if ping -c 1 packages.debian.org 2>&1 >/dev/null; then
 for i in $*; do
 echo
 echo "Contacting Debian server about $i... "
  results=${scratch_dir}/whatis.results
  wget --output-document=- http://packages.debian.org/cgi-bin/search_packages.pl\?keywords=$i\&searchon=names\&subword=1\&release=all 2> /dev/null |
   egrep '<TD><B><A HREF|<TD COLSPAN=2>' |
    perl -p -e 's|<[^>]*>||g;s|^  ||g;s|^&nbsp; | |;s|&nbsp;||g;s|&quot;|"|g;'
 done
else
 echo "E: The Debian server could not be contacted."
 exit 1
fi