xref: /minix/distrib/sets/listpkgs (revision 00b67f09)
1#!/bin/sh
2#
3# $NetBSD: listpkgs,v 1.12 2006/01/04 13:35:55 apb Exp $
4#
5# List all packages in the given pkgset by parsing the list files.
6#
7
8rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
9. "${rundir}/sets.subr"
10
11prefix=/
12
13usage()
14{
15	cat 1>&2 <<USAGE
16Usage: ${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
21USAGE
22	exit 1
23}
24
25# handle args
26while getopts a:m:s: ch; do
27	case ${ch} in
28	a)
29		MACHINE_ARCH="${OPTARG}"
30		MACHINE_CPU="$(arch_to_cpu "${OPTARG}")"
31		;;
32	m)
33		MACHINE="${OPTARG}"
34		;;
35	s)
36		setsdir="${OPTARG}"
37		;;
38	*)
39		usage
40		;;
41	esac
42done
43shift $((${OPTIND} - 1))
44if [ $# -ne 1 ]; then
45	usage
46fi
47setname="$1"
48
49list_set_files "${setname}" | ${AWK} '{print $2}' | ${SORT} -u
50