3 # Copyright (c) 2007 The DragonFly Project. All rights reserved.
5 # This code is derived from software contributed to The DragonFly Project
6 # by Matthias Schmidt <schmidtm@mathematik.uni-marburg.de>, University of
11 # Redistribution and use in source and binary forms, with or without
12 # modification, are permitted provided that the following conditions are met:
14 # - Redistributions of source code must retain the above copyright notice,
15 # this list of conditions and the following disclaimer.
16 # - Redistributions in binary form must reproduce the above copyright notice,
17 # this list of conditions and the following disclaimer in the documentation
18 # and/or other materials provided with the distribution.
19 # - Neither the name of The DragonFly Project nor the names of its
20 # contributors may be used to endorse or promote products derived
21 # from this software without specific, prior written permission.
23 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
27 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30 # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31 # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32 # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33 # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 # $DragonFly: src/usr.bin/pkg_search/pkg_search.sh,v 1.4 2007/12/27 11:52:10 matthias Exp $
38 VERSION
=`uname -r | cut -d '.' -f 1,2`
41 if [ $UNAME = "DragonFly" ]; then
43 PKGSUM
=${PORTSDIR}/pkg_summary
44 PKGSRCBOX1
=http
://pkgbox.dragonflybsd.org
/packages
/${UNAME}-${VERSION}/i386
/
45 PKGSRCBOX2
=http
://pkgbox.dragonflybsd.org
/packages
/DragonFly-1.10
.1/i386
/
47 if [ ! -f ${PKGSUM} ]; then
48 echo "No pkgsrc(7) tree found. Fetching pkg_summary(5) file."
49 FETCHPATH
=${PKGSRCBOX1}/All
/pkg_summary.bz2
51 fetch
-o ${PKGSUM}.bz2
${FETCHPATH}
53 FETCHPATH
=${PKGSRCBOX2}/All
/pkg_summary.bz2
54 fetch
-o ${PKGSUM}.bz2
${FETCHPATH}
57 echo "Unable to fetch pkg_summary"
60 bunzip2
< ${PKGSUM}.bz2
> ${PKGSUM}
64 if [ -e ${PKGSUM} -a ! -e ${PORTSDIR}/${INDEXFILE} ]; then
70 echo "usage: $0 [-k | -v] package"
77 if [ ${SIMPLE} -eq 1 ]; then
78 grep "PKGNAME=$2" ${PKGSUM} | cut
-d '=' -f 2
81 awk -F\|
-v name
="$2" \
83 if ($1 ~ name || $4 ~ name || $10 ~ name) { \
85 printf("%-20s\t%-25s\n", $1, $4); \
87 }' ${PORTSDIR}/${INDEXFILE}
91 if [ ${SIMPLE} -eq 1 ]; then
92 grep "PKGNAME=$2" ${PKGSUM} | cut
-d '=' -f 2
95 awk -F\|
-v name
="$2" \
99 printf("Name\t: %s-50\nDir\t: %-50s\nDesc\t: %-50s\nURL\t: %-50s\nDeps\t: %s\n\n", $1, $2, $4, $10, $9); \
101 }' ${PORTSDIR}/${INDEXFILE}
104 if [ ${SIMPLE} -eq 1 ]; then
105 grep "PKGNAME=$1" ${PKGSUM} | cut
-d '=' -f 2
109 awk -F\|
-v name
="$1" \
113 printf("%-20s\t%-25s\n", $1, $4); \
115 }' ${PORTSDIR}/${INDEXFILE}