NetBSD/distrib/sets/listpkgs
dyoung 17b5668ccd Factor duplicated code for setting variables such as machine_cpu
and machine_arch to their defaults into sets.defaults, and source
it at the top of each script.

Also, to be consistent with variable naming, s/arch/machine_arch/.

sets.defaults introduces two new variables, krb and krb4, which
will affect whether Kerberos- or Kerberos IV-only files are put
into the set lists.
2003-11-25 07:19:46 +00:00

72 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
#
# $NetBSD: listpkgs,v 1.6 2003/11/25 07:19:46 dyoung Exp $
#
# List all packages in the given pkgset by parsing the list files.
#
# set defaults
. ./sets.defaults
setd=`dirname $0`
prefix=/
. ./sets.subr
usage() {
exec 1>&2
echo "Usage: $0 [-a arch] [-m machine] [-s setsdir] [-p prefix] setname"
echo " -a arch set arch (e.g, m68k, mips, powerpc) [$machine_arch]"
echo " -m machine set machine (e.g, amiga, i386, macppc) [$machine]"
echo " -s setsdir directory to find sets [$setd]"
echo " setname set to list packages for"
exit 1
}
# handle args
while : ; do
case $1 in
-a*)
machine_arch=$2; shift
;;
-m*)
machine=$2; shift
;;
-s*)
setd=$2; shift
;;
-*)
usage
exit 1
;;
*)
break
;;
esac
shift
done
if [ -n "$1" ]; then
setname="$1"
else
usage
exit 1
fi
# Convert mipse[lb] to mips after processing command line arguments.
machine_arch=`echo $machine_arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3,`
# Compute toolchain used on target cpu.
if [ "$machine_arch" = "mips" -o "$machine" = "alpha" -o "$machine_arch" = "powerpc" -o "$machine_arch" = "sparc" -o "$machine_arch" = "sparc64" -o "$machine_arch" = "i386" -o "$machine_arch" = "arm" -o "$machine" = "mvme68k" -o "$machine" = "hp300" ]; then
shlib=elf
else
if [ "$machine_arch" = "sh3" ]; then
shlib=
else
shlib=aout
fi
fi
list_set_files $setname | awk -- '/^[^#]/ {print $2}' | sort -u