b852db83fb
* Add an optional third field to the sets file which is a list of comma separated keywords that control if the line is printed. Currently supported keywords kerberos4 ${MKKERBEROS4} != no kerberos ${MKKERBEROS} != no lint ${MKLINT} != no obsolete ${obsolete} != 0. In this case, non obsolete files are not printed. (This will allow future support for builds with variables such as MKHESIOD and MKYP set to "no".) * Use sh(1)'s getopts where appropriate, and otherwise cleanup the various scripts. * Move defaults for sets.subr from sets.defaults into sets.subr. Move replicated code for determining stuff such as shlibs type from various scripts into sets.subr. * Merge the obsolete.*, krb.*, krb4.* and lint.* into the appropriate main lists with the relevant third field keyword(s).
178 lines
3.5 KiB
Bash
Executable File
178 lines
3.5 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $NetBSD: maketars,v 1.47 2003/12/29 03:13:25 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 <<USAGE
|
|
Usage: ${prog} [-b] [-x] [-i idir] [-a arch] [-m machine] [-s setsdir]
|
|
[-M metalog] [-N etcdir] [-d dest] [-t targetdir] [setname ...]
|
|
-b make netbsd + x11 lists
|
|
-x only make x11 lists
|
|
-i idir install sets to idir 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 [$setsdir]
|
|
-M metalog metalog file
|
|
-N etcdir etc dir for metalog use [$dest/etc]
|
|
-d dest \$DESTDIR [$dest]
|
|
-t targetdir \$RELEASEDIR [$tars]
|
|
[setname ...] sets to build [$lists]
|
|
USAGE
|
|
exit 1
|
|
}
|
|
|
|
# handle args
|
|
while getopts bxi:a:m:s:M:N:d:t: ch; do
|
|
case ${ch} in
|
|
b)
|
|
lists="$xlists $nlists"
|
|
;;
|
|
x)
|
|
lists="$xlists"
|
|
;;
|
|
i)
|
|
installdir=${OPTARG}
|
|
;;
|
|
a)
|
|
machine_arch=${OPTARG}
|
|
machine_cpu=$(arch_to_cpu ${OPTARG})
|
|
;;
|
|
m)
|
|
machine=${OPTARG}
|
|
;;
|
|
s)
|
|
setsdir=${OPTARG}
|
|
;;
|
|
M)
|
|
metalog=${OPTARG}
|
|
;;
|
|
N)
|
|
etcdir=${OPTARG}
|
|
;;
|
|
d)
|
|
dest=${OPTARG}
|
|
;;
|
|
t)
|
|
tars=${OPTARG}
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
done
|
|
shift $((${OPTIND} - 1))
|
|
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" -a -z "$installdir" ]; then
|
|
echo \$RELEASEDIR must be set, or -i must be used
|
|
exit 1
|
|
fi
|
|
|
|
if [ -z "$dest" ]; then
|
|
echo \$DESTDIR must be set
|
|
exit 1
|
|
fi
|
|
: ${etcdir:=${dest}/etc}
|
|
|
|
SDIR=$(${MKTEMP} -d /tmp/${prog}.XXXXXX)
|
|
|
|
es=0
|
|
cleanup()
|
|
{
|
|
es=$?
|
|
/bin/rm -rf $SDIR
|
|
exit $es
|
|
}
|
|
trap cleanup 0 2 3 13 # EXIT INT QUIT PIPE
|
|
|
|
if [ -n "$metalog" ]; then
|
|
echo "Parsing $metalog"
|
|
(
|
|
cat ${etcdir}/mtree/NetBSD.dist
|
|
echo "/unset all"
|
|
cat $metalog 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
|