Home | History | Annotate | Line # | Download | only in sets
listpkgs revision 1.12
      1   1.1   jwise #!/bin/sh
      2   1.1   jwise #
      3  1.12     apb # $NetBSD: listpkgs,v 1.12 2006/01/04 13:35:55 apb Exp $
      4   1.2   lukem #
      5   1.2   lukem # List all packages in the given pkgset by parsing the list files.
      6   1.1   jwise #
      7   1.1   jwise 
      8  1.11     apb rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
      9  1.12     apb . "${rundir}/sets.subr"
     10   1.6  dyoung 
     11   1.1   jwise prefix=/
     12   1.1   jwise 
     13   1.7   lukem usage()
     14   1.7   lukem {
     15   1.7   lukem 	cat 1>&2 <<USAGE
     16   1.7   lukem Usage: ${0##*/} [-a arch] [-m machine] [-s setsdir] [-p prefix] setname
     17  1.11     apb 	-a arch		set arch (e.g, m68k, mips, powerpc)	[${MACHINE_ARCH}]
     18  1.11     apb 	-m machine	set machine (e.g, amiga, i386, macppc)	[${MACHINE}]
     19  1.11     apb 	-s setsdir	directory to find sets			[${setsdir}]
     20   1.7   lukem 	setname set to list packages for
     21   1.7   lukem USAGE
     22   1.7   lukem 	exit 1
     23   1.1   jwise }
     24   1.1   jwise 
     25   1.1   jwise # handle args
     26   1.7   lukem while getopts a:m:s: ch; do
     27   1.7   lukem 	case ${ch} in
     28   1.7   lukem 	a)
     29  1.11     apb 		MACHINE_ARCH="${OPTARG}"
     30  1.11     apb 		MACHINE_CPU="$(arch_to_cpu "${OPTARG}")"
     31   1.1   jwise 		;;
     32   1.7   lukem 	m)
     33  1.11     apb 		MACHINE="${OPTARG}"
     34   1.1   jwise 		;;
     35   1.7   lukem 	s)
     36  1.11     apb 		setsdir="${OPTARG}"
     37   1.1   jwise 		;;
     38   1.7   lukem 	*)
     39   1.1   jwise 		usage
     40   1.1   jwise 		;;
     41   1.1   jwise 	esac
     42   1.1   jwise done
     43   1.7   lukem shift $((${OPTIND} - 1))
     44   1.7   lukem if [ $# -ne 1 ]; then
     45   1.1   jwise 	usage
     46   1.1   jwise fi
     47   1.7   lukem setname="$1"
     48   1.1   jwise 
     49  1.11     apb list_set_files "${setname}" | ${AWK} '{print $2}' | ${SORT} -u
     50