c71e0408fb
contain the correct permissions. Makefile: - set SETSENV to the list of variables we wish to pass to each shell script and use that, rather than duplicating the effort below - call maketars with "-M ${METALOG}" if UNPRIVED is set. getdirs.awk: - takes a list of filenames and outputs the list along with all the directories used by those filenames maketars: - support "-M metalog" - merge etc/mtree/NetBSD.dist with the "-M metalog" for use in the tgz build - for a given set, find the union between the set list and the metalog generated above and use that as the list of files to ${PAX} up as the tgz file.
123 lines
2.5 KiB
Bash
Executable File
123 lines
2.5 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $NetBSD: maketars,v 1.18 2002/02/27 10:51:47 lukem Exp $
|
|
#
|
|
# Make release tar files for some or all lists. Usage:
|
|
# maketars [-b] [-x] [-a arch] [-m machine] [-s setsdir]
|
|
# [-M metalog] [-d destdir] [-t tardir] [setname ...]
|
|
#
|
|
|
|
# set defaults
|
|
: ${MAKE=make}
|
|
: ${PAX=pax}
|
|
: ${MTREE=mtree}
|
|
|
|
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=
|
|
|
|
# handle args
|
|
while : ; do
|
|
case $1 in
|
|
-b*)
|
|
lists="$xlists $nlists"
|
|
;;
|
|
-x*)
|
|
lists=$xlists
|
|
;;
|
|
-a*)
|
|
machine_arch=$2; shift
|
|
;;
|
|
-M*)
|
|
metalog=$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] [-M metalog]
|
|
[-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]
|
|
-M metalog metalog file
|
|
-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
|
|
|
|
SDIR=`mktemp -d /tmp/maketar.XXXXXX` || exit 1
|
|
trap "/bin/rm -rf $SDIR ; exit 0" EXIT INT QUIT PIPE
|
|
|
|
if [ -n "$metalog" ]; then
|
|
echo "parsing $metalog"
|
|
${MTREE} -D -k all -f /usr/src/etc/mtree/NetBSD.dist | \
|
|
sed -e 's,\(.*\) \(\..*\),\2 \1,' > $SDIR/metadirs
|
|
sed -e "s,^\.$dest,.," < $metalog > $SDIR/metafiles
|
|
cat $SDIR/metadirs $SDIR/metafiles | sort -u > $SDIR/metalog
|
|
fi
|
|
|
|
GZIP=-9 # for pax -z
|
|
export GZIP
|
|
|
|
es=0
|
|
for setname in $lists; do
|
|
out=$setname.tgz
|
|
echo "making $out"
|
|
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.full
|
|
echo "/set uname=root gname=wheel" > $SDIR/plist.$setname
|
|
join $SDIR/flist.full $SDIR/metalog >> $SDIR/plist.$setname
|
|
else
|
|
mv $SDIR/flist.$setname $SDIR/plist.$setname
|
|
fi
|
|
|
|
( cd $dest ; \
|
|
${PAX} -w -d -z ${metalog:+-N$dest/etc} ${metalog:+-M} \
|
|
< ${SDIR}/plist.$setname ) > ${tars}/$out
|
|
es=$(($es + $?))
|
|
done
|
|
exit $es
|