3 # Copyright (c) 2006-07 Matthias Schmidt <schmidtm@mathematik.uni-marburg.de>
7 # Redistribution and use in source and binary forms, with or without
8 # modification, are permitted provided that the following conditions are met:
10 # - Redistributions of source code must retain the above copyright notice,
11 # this list of conditions and the following disclaimer.
12 # - Redistributions in binary form must reproduce the above copyright notice,
13 # this list of conditions and the following disclaimer in the documentation
14 # and/or other materials provided with the distribution.
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 # $DragonFly: src/usr.bin/pkg_search/pkg_search.sh,v 1.3 2007/12/13 17:14:57 swildner Exp $
31 VERSION=`uname -r | cut -d '.' -f 1,2`
34 if [ $UNAME = "DragonFly" ]; then
36 PKGSUM=${PORTSDIR}/pkg_summary
37 PKGSRCBOX1=http://pkgbox.dragonflybsd.org/packages/${UNAME}-${VERSION}/i386/
38 PKGSRCBOX2=http://pkgbox.dragonflybsd.org/packages/DragonFly-1.10.1/i386/
40 if [ ! -f ${PKGSUM} ]; then
41 echo "No pkgsrc(7) tree found. Fetching pkg_summary(5) file."
42 FETCHPATH=${PKGSRCBOX1}/All/pkg_summary.bz2
44 fetch -o ${PKGSUM}.bz2 ${FETCHPATH}
46 FETCHPATH=${PKGSRCBOX2}/All/pkg_summary.bz2
47 fetch -o ${PKGSUM}.bz2 ${FETCHPATH}
50 echo "Unable to fetch pkg_summary"
53 bunzip2 < ${PKGSUM}.bz2 > ${PKGSUM}
57 if [ -e ${PKGSUM} -a ! -e ${PORTSDIR}/${INDEXFILE} ]; then
63 echo "usage: $0 [-k | -v] package"
70 if [ ${SIMPLE} -eq 1 ]; then
71 grep "PKGNAME=$2" ${PKGSUM} | cut -d '=' -f 2
74 awk -F\| -v name="$2" \
76 if ($1 ~ name || $4 ~ name || $10 ~ name) { \
78 printf("%-20s\t%-25s\n", $1, $4); \
80 }' ${PORTSDIR}/${INDEXFILE}
84 if [ ${SIMPLE} -eq 1 ]; then
85 grep "PKGNAME=$2" ${PKGSUM} | cut -d '=' -f 2
88 awk -F\| -v name="$2" \
92 printf("Name\t: %s-50\nDir\t: %-50s\nDesc\t: %-50s\nURL\t: %-50s\nDeps\t: %s\n\n", $1, $2, $4, $10, $9); \
94 }' ${PORTSDIR}/${INDEXFILE}
97 if [ ${SIMPLE} -eq 1 ]; then
98 grep "PKGNAME=$1" ${PKGSUM} | cut -d '=' -f 2
102 awk -F\| -v name="$1" \
106 printf("%-20s\t%-25s\n", $1, $4); \
108 }' ${PORTSDIR}/${INDEXFILE}