Add '-i installdir', to copy the given sets from $DESTDIR to installdir

instead of creating tar files.  If the default sets are used, "etc" is
removed from the list, because it's highly unlikely that it's wanted
in that case.

Tested against a DESTDIR created with "make UNPRIVED= DESTDIR=.... build".
This commit is contained in:
lukem 2002-12-12 08:51:49 +00:00
parent 98bc8767ae
commit 25193201ba

View File

@ -1,10 +1,10 @@
#!/bin/sh
#
# $NetBSD: maketars,v 1.27 2002/11/26 06:22:23 lukem Exp $
# $NetBSD: maketars,v 1.28 2002/12/12 08:51:49 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 ...]
# [-M metalog] [-d destdir] [-t tardir] [-i installdir] [setname ...]
#
# set defaults
@ -21,6 +21,7 @@ lists=$nlists
tars=$RELEASEDIR
dest=$DESTDIR
metalog=
installdir=
# handle args
while : ; do
@ -31,6 +32,9 @@ while : ; do
-x*)
lists=$xlists
;;
-i*)
installdir=$2; shift
;;
-a*)
machine_arch=$2; shift
;;
@ -55,6 +59,7 @@ 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
-i targdir install sets to targdir instead of creating tar files
-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]
@ -71,12 +76,15 @@ USAGE
esac
shift
done
if [ -n "$installdir" ]; then # if -i, remove etc from default list
lists=$(echo $lists | sed -e 's/ etc / /')
fi
if [ -n "$*" ]; then
lists="$*"
fi
if [ -z "$tars" ]; then
echo \$RELEASEDIR must be set
if [ -z "$tars" -a -z "$installdir" ]; then
echo \$RELEASEDIR must be set, or -i must be used
exit 1
fi
@ -109,7 +117,7 @@ done
trap "/bin/rm -rf $SDIR ; exit 0" 0 2 3 13 # EXIT INT QUIT PIPE
if [ -n "$metalog" ]; then
echo "parsing $metalog"
echo "Parsing $metalog"
(
cat ${DESTDIR}/etc/mtree/NetBSD.dist
echo "/unset all"
@ -124,7 +132,11 @@ export GZIP
es=0
for setname in $lists; do
out=$setname.tgz
echo "making $out"
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
@ -138,9 +150,15 @@ for setname in $lists; do
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
if [ -n "$installdir" ]; then
( cd $dest ; \
${PAX} -rwpe -d ${metalog:+-N$dest/etc} ${metalog:+-M} \
$installdir < ${SDIR}/plist.$setname )
else
( cd $dest ; \
${PAX} -w -d -z ${metalog:+-N$dest/etc} ${metalog:+-M} \
< ${SDIR}/plist.$setname ) > ${tars}/$out
fi
es=$(($es + $?))
done
exit $es