NetBSD/distrib/sets/maketars

88 lines
1.6 KiB
Bash
Executable File

#!/bin/sh
#
# $NetBSD: maketars,v 1.16 2001/11/24 03:08:27 thorpej Exp $
#
# Make release tar files for some or all lists. Usage:
# maketars [-b] [-x] [-a arch] [-m machine] [-s setsdir] [-d destdir] \
# [-t tardir] [setname ...]
#
# set defaults
: ${MAKE=make}
machine=`${MAKE} print_machine`
machine_arch=`${MAKE} print_machine_arch`
setd=`pwd`
nlists="base comp etc games man misc text"
xlists="xbase xcomp xcontrib xfont xserver xmisc"
lists=$nlists
tars=$RELEASEDIR
dest=$DESTDIR
# handle args
while : ; do
case $1 in
-b*)
lists="$xlists $nlists"
;;
-x*)
lists=$xlists
;;
-a*)
machine_arch=$2; shift
;;
-m*)
machine=$2; shift
;;
-s*)
setd=$2; shift
;;
-d*)
dest=$2; shift
;;
-t*)
tars=$2; shift
;;
-*)
cat 1>&2 <<USAGE
Usage: $0 [-b] [-x] [-a arch] [-m machine] [-s setsdir]
[-d dest] [-t tars] [setname ...]
-b make netbsd + x11 lists
-x only make x11 lists
-a arch set arch (e.g, m68k, mipseb, mipsel, powerpc) [$machine_arch]
-m machine set machine (e.g, amiga, i386, macppc) [$machine]
-s setsdir directory to find sets [$setd]
-d dest \$DESTDIR [$dest]
-t tars \$RELEASEDIR [$tars]
[setname ...] sets to build [$lists]
USAGE
exit 1
;;
*)
break
;;
esac
shift
done
if [ -n "$*" ]; then
lists="$*"
fi
if [ -z "$tars" ]; then
echo \$RELEASEDIR must be set
exit 1
fi
if [ -z "$dest" ]; then
echo \$DESTDIR must be set
exit 1
fi
trap 'rm -f ${dest}/tmp/flist' 0
set -e
for setname in $lists; do
out=$setname.tgz
echo "making $out"
sh $setd/makeflist -a $machine_arch -m $machine -s $setd $setname > ${dest}/tmp/flist
(cd $dest ; pax -w -d -z < ${dest}/tmp/flist) > ${tars}/$out
done