Drop main() prototype. Syncs with NetBSD-8
[minix.git] / distrib / sets / listpkgs
blobf63ea84df7eb6a5bda21618c328c6b4e5217f3b2
1 #!/bin/sh
3 # $NetBSD: listpkgs,v 1.12 2006/01/04 13:35:55 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