No empty .Rs/.Re
[netbsd-mini2440.git] / distrib / sets / listpkgs
blob5b6759dacc4d970a7d09f7daf586a738169ed0f9
1 #!/bin/sh
3 # $NetBSD: listpkgs,v 1.11 2006/01/03 18:31:09 apb Exp $
5 # List all packages in the given pkgset by parsing the list files.
8 rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
9 . "${rundir}/sets.subr"
11 prefix=/
13 usage()
15 cat 1>&2 <<USAGE
16 Usage: ${0##*/} [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
17 -a arch set arch (e.g, m68k, mips, powerpc) [${MACHINE_ARCH}]
18 -m machine set machine (e.g, amiga, i386, macppc) [${MACHINE}]
19 -s setsdir directory to find sets [${setsdir}]
20 setname set to list packages for
21 USAGE
22 exit 1
25 # handle args
26 while getopts a:m:s: ch; do
27 case ${ch} in
29 MACHINE_ARCH="${OPTARG}"
30 MACHINE_CPU="$(arch_to_cpu "${OPTARG}")"
33 MACHINE="${OPTARG}"
36 setsdir="${OPTARG}"
39 usage
41 esac
42 done
43 shift $((${OPTIND} - 1))
44 if [ $# -ne 1 ]; then
45 usage
47 setname="$1"
49 list_set_files "${setname}" | ${AWK} '{print $2}' | ${SORT} -u