#!/bin/sh # # $NetBSD: maketars,v 1.48 2004/01/03 02:38:58 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 ...] # # The default sets are "base comp etc games man misc text" # # If '-i installdir' is given, copy the given sets to installdir # (using pax -rw ...) instead of creating tar files. # In this case, remove "etc" from the list of default sets. # prog=${0##*/} # set defaults : ${HOST_SH=sh} : ${MKTEMP=mktemp} : ${MTREE=mtree} : ${PAX=pax} . $(dirname $0)/sets.subr lists=$nlists tars=$RELEASEDIR dest=$DESTDIR metalog= installdir= etcdir= usage() { cat 1>&2 </dev/null ) | ${MTREE} -C -k all -N ${etcdir} > $SDIR/metalog rv=$? if [ $rv -ne 0 ]; then echo "${prog}: mtree failed, exiting" exit $rv fi fi GZIP=-9 # for pax -z export GZIP for setname in $lists; do out=$setname.tgz if [ -n "$installdir" ]; then echo "Copying set $setname" else if [ -n "$metalog" -a $tars/$out -nt "$metalog" ]; then echo "$out is up to date" continue fi echo "Creating $out" fi ${HOST_SH} $setsdir/makeflist -a $MACHINE_ARCH -m $MACHINE \ -s $setsdir $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 if [ $es -gt 255 ] ; then es=255 fi exit $es