#!/bin/sh # # $NetBSD: maketars,v 1.34 2002/12/25 23:44:06 lukem Exp $ # # Make release tar files for some or all lists. Usage: # maketars [-b] [-x] [-i installdir] [-a arch] [-m machine] [-s setsdir] # [-M metalog] [-N etcdir] [-d destdir] [-t tardir] [setname ...] # # set defaults : ${PAX=pax} : ${MTREE=mtree} make="${MAKE:-make} -j 1 -f `dirname $0`/Makefile" 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 metalog= installdir= etcdir= # handle args while : ; do case $1 in -b*) lists="$xlists $nlists" ;; -x*) lists=$xlists ;; -i*) installdir=$2; shift ;; -a*) machine_arch=$2; shift ;; -M*) metalog=$2; shift ;; -m*) machine=$2; shift ;; -N*) etcdir=$2; shift ;; -s*) setd=$2; shift ;; -d*) dest=$2; shift ;; -t*) tars=$2; shift ;; -*) cat 1>&2 < $SDIR/metalog fi GZIP=-9 # for pax -z export GZIP es=0 for setname in $lists; do out=$setname.tgz if [ -n "$installdir" ]; then echo "Copying set $setname" else echo "Creating $out" fi sh $setd/makeflist -a $machine_arch -m $machine -s $setd $setname \ > $SDIR/flist.$setname if [ -n "$metalog" ]; then awk -f getdirs.awk $SDIR/flist.$setname | sort -u \ > $SDIR/flist.$setname.full ( echo "/set uname=root gname=wheel" awk -f join.awk $SDIR/flist.$setname.full $SDIR/metalog ) > $SDIR/plist.$setname else mv $SDIR/flist.$setname $SDIR/plist.$setname fi if [ -n "$installdir" ]; then ( cd $dest ; \ ${PAX} -O -rwpe -d -N${etcdir} ${metalog:+-M} \ $installdir < ${SDIR}/plist.$setname ) else ( cd $dest ; \ ${PAX} -O -w -d -z -N${etcdir} ${metalog:+-M} \ < ${SDIR}/plist.$setname ) > ${tars}/$out fi es=$(($es + $?)) done exit $es