summaryrefslogtreecommitdiffstats
path: root/urpmf
blob: 06514da15e8ad474876a3d90f9379ae92a7588d5 (plain)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh

# NOTE TO MANTAINERS: when you add a string that is displayed to
# the user use $ECHO not echo (that will use gettext if available)

# i18n support
ECHO=`which gettext 2> /dev/null`
[ -z "$ECHO" ] && ECHO="echo" || ECHO="$ECHO -s"
TEXTDOMAIN="urpmi"
export TEXTDOMAIN

dir="/var/lib/urpmi"
options=

while true
do
    case $1 in
	-h|--help)
	    TMPDATA=`$ECHO "urpmf version %s"`
	    printf "$TMPDATA" `rpm -q rpmtools --qf '%{VERSION}'` ; echo
	    $ECHO "Copyright (C) 1999,2000,2001 MandrakeSoft."
	    $ECHO "This is free software and may be redistributed under the terms of the GNU GPL."
	    echo
	    $ECHO "usage: urpmf [options] <file>"
	    $ECHO "  --quiet         - do not print tag name (default if no tag given on command"
	    $ECHO "                    line, incompatible with interactive mode)."
	    $ECHO "  --all           - print all tags."
	    $ECHO "  --name          - print tag name: rpm filename (assumed if no tag given on"
	    $ECHO "                    command line but without package name)."
	    $ECHO "  --group         - print tag group: group."
	    $ECHO "  --size          - print tag size: size."
	    $ECHO "  --serial        - print tag serial: serial."
	    $ECHO "  --summary       - print tag summary: summary."
	    $ECHO "  --description   - print tag description: description."
	    $ECHO "  --provides      - print tag provides: all provides (mutliple lines)."
	    $ECHO "  --requires      - print tag requires: all requires (multiple lines)."
	    $ECHO "  --files         - print tag files: all files (multiple lines)."
	    $ECHO "  --conflicts     - print tag conflicts: all conflicts (multiple lines)."
	    $ECHO "  --obsoletes     - print tag obsoletes: all obsoletes (multiple lines)."
	    $ECHO "  --prereqs       - print tag prereqs: all prereqs (multiple lines)."
	    exit 1
	    ;;
	--*)
	    options="$1 $options"
	    shift
	    ;;
	*)
	    if [ $# -gt 1 ]; then
		$ECHO "usage: urpmf [options] <file>"
		$ECHO "try urpmf --help for more options"
		exit 1
	    fi
	    if /bin/ls $dir/hdlist.* >/dev/null 2>/dev/null; then
		parsehdlist ${options:---files --quiet} $dir/hdlist.* | grep -E "$1"
		exit $?
	    else
		$ECHO "urpmi is not installed"
		exit 1
	    fi
	    ;;
    esac
done