makeobsolete revision 1.28
1#!/bin/sh
2#
3# $NetBSD: makeobsolete,v 1.28 2006/01/04 13:35:55 apb Exp $
4#
5# Print out the obsolete files for a set
6# Usage: makeobsolete [-b] [-x] [-a arch] [-m machine] [-s setsdir] \
7#    [-t target] [setname ...]
8#
9
10rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
11. "${rundir}/sets.subr"
12lists="${nlists}"
13target=./dist
14obsolete=1
15
16usage()
17{
18	cat 1>&2 <<USAGE
19Usage: ${0##*/} [-a arch] [-m machine] [-s setsdir] [setname ...]
20	-b		make netbsd + x11 lists
21	-x 		only make x11 lists
22	-a arch		set arch (e.g, m68k, mips, powerpc)	[${MACHINE_ARCH}]
23	-m machine	set machine (e.g, amiga, i386, macppc)	[${MACHINE}]
24	-s setsdir	directory to find sets	[${setd}]
25	-t target	target directory [${target}]
26	[setname ...] 	sets to build
27USAGE
28	exit 1
29}
30
31while getopts bxa:m:s:t: ch; do
32	case ${ch} in
33	b)
34		lists="${xlists} ${nlists}"
35		;;
36	x)
37		lists="${xlists}"
38		;;
39	a)
40		MACHINE_ARCH="${OPTARG}"
41		MACHINE_CPU="$(arch_to_cpu "${OPTARG}")"
42		;;
43	m)
44		MACHINE="${OPTARG}"
45		;;
46	s)
47		setsdir="${OPTARG}"
48		;;
49	t)
50		target="${OPTARG}"
51		;;
52	*)
53		usage
54		;;
55	esac
56done
57shift $((${OPTIND} - 1))
58if [ -n "$1" ]; then
59	lists="$*"
60fi
61
62if [ ! -d "${target}" ] ; then
63	echo "target directory [${target}] doesn't exist"
64	exit 1
65fi
66
67for setname in ${lists}; do
68	file="${target}/${setname}"
69	list_set_files "${setname}" | ${AWK} '{print $1}' | \
70		${SORT} -ru > "${file}"
71done
72