1996-02-13 00:58:46 +03:00
|
|
|
#! /bin/sh
|
1997-02-18 10:06:00 +03:00
|
|
|
#
|
2005-07-05 12:41:16 +04:00
|
|
|
# $NetBSD: makesrctars,v 1.20 2005/07/05 08:41:16 tron Exp $
|
2003-05-10 10:07:26 +04:00
|
|
|
#
|
|
|
|
# makesrctars srcdir setdir
|
|
|
|
# Create source tarballs in setdir from the source under srcdir.
|
1997-02-18 10:06:00 +03:00
|
|
|
#
|
1996-02-13 00:58:46 +03:00
|
|
|
|
2004-04-20 10:36:34 +04:00
|
|
|
prog=${0##*/}
|
|
|
|
|
|
|
|
# set defaults
|
2002-04-11 10:04:42 +04:00
|
|
|
: ${CKSUM=cksum}
|
2004-04-20 10:36:34 +04:00
|
|
|
: ${PAX=pax}
|
|
|
|
|
|
|
|
xsrcdir=
|
2002-04-11 10:04:42 +04:00
|
|
|
|
2002-04-12 11:08:37 +04:00
|
|
|
GZIP=-9
|
1996-02-13 00:58:46 +03:00
|
|
|
export GZIP
|
|
|
|
|
2004-04-20 10:36:34 +04:00
|
|
|
usage()
|
|
|
|
{
|
|
|
|
cat 1>&2 <<USAGE
|
|
|
|
Usage: ${prog} [-x xsrcdir] srcdir setdir
|
|
|
|
-x xsrcdir build xsrc.tgz from xsrcdir
|
|
|
|
srcdir location of sources
|
|
|
|
setdir where to write the .tgz files to
|
|
|
|
USAGE
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# handle args
|
|
|
|
while getopts x: ch; do
|
|
|
|
case ${ch} in
|
|
|
|
x)
|
|
|
|
xsrcdir=${OPTARG}
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $((${OPTIND} - 1))
|
|
|
|
|
2003-05-10 10:07:26 +04:00
|
|
|
if [ $# -ne 2 ]; then
|
|
|
|
echo "Usage: $0 srcdir setdir"
|
1996-02-13 00:58:46 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
2003-05-10 10:07:26 +04:00
|
|
|
srcdir=$1
|
|
|
|
setdir=$2
|
1996-02-13 00:58:46 +03:00
|
|
|
|
2003-05-10 10:07:26 +04:00
|
|
|
if [ ! -d "${setdir}" ]; then
|
|
|
|
echo "${setdir} is not a directory"
|
1996-02-13 00:58:46 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2003-05-10 10:07:26 +04:00
|
|
|
makeset()
|
|
|
|
{
|
|
|
|
set=$1.tgz
|
|
|
|
shift
|
|
|
|
echo "Creating ${set}"
|
|
|
|
set -f
|
2005-05-22 07:05:15 +04:00
|
|
|
find $* \
|
2004-05-09 17:46:00 +04:00
|
|
|
! \( \( -name obj -o -name 'obj.*' \) \( -type l -o -type d \) -prune \) \
|
2003-05-10 10:07:26 +04:00
|
|
|
-print \
|
2005-05-22 07:05:15 +04:00
|
|
|
| sort \
|
2004-04-20 10:36:34 +04:00
|
|
|
| ${PAX} -w -d -s'|^\.|'${srcprefix}'|' \
|
2003-05-10 10:07:26 +04:00
|
|
|
| gzip \
|
|
|
|
> "${setdir}/${set}"
|
|
|
|
set +f
|
|
|
|
}
|
|
|
|
|
1996-02-13 00:58:46 +03:00
|
|
|
|
2004-04-20 10:36:34 +04:00
|
|
|
# create (base)src sets
|
|
|
|
#
|
|
|
|
|
|
|
|
if ! cd "${srcdir}"; then
|
|
|
|
echo "Can't chdir to ${srcdir}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
srcprefix=usr/src
|
|
|
|
|
2004-04-20 07:40:45 +04:00
|
|
|
makeset src . \
|
|
|
|
! \( \( -path ./gnu \
|
|
|
|
-o -path ./share \
|
|
|
|
-o -path ./sys \
|
2005-07-05 12:41:16 +04:00
|
|
|
-o -path ./usr.bin/config \
|
2004-04-20 07:40:45 +04:00
|
|
|
\) -prune \)
|
1997-12-30 02:31:06 +03:00
|
|
|
|
2003-05-10 10:07:26 +04:00
|
|
|
makeset gnusrc ./gnu
|
1996-02-13 00:58:46 +03:00
|
|
|
|
2005-07-05 12:41:16 +04:00
|
|
|
makeset syssrc ./sys ./usr.bin/config \
|
2003-05-10 10:07:26 +04:00
|
|
|
! \( -path ./sys/arch/\*/compile/\* -type d \
|
|
|
|
! -name CVS -prune \)
|
1996-02-13 00:58:46 +03:00
|
|
|
|
2003-05-10 10:07:26 +04:00
|
|
|
makeset sharesrc ./share
|
1996-02-13 00:58:46 +03:00
|
|
|
|
2004-04-20 10:36:34 +04:00
|
|
|
|
|
|
|
# create xsrc sets
|
|
|
|
#
|
|
|
|
if [ -n "${xsrcdir}" ]; then
|
|
|
|
if ! cd "${xsrcdir}"; then
|
|
|
|
echo "Can't chdir to ${xsrcdir}"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
srcprefix=usr/xsrc
|
|
|
|
makeset xsrc .
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2004-04-20 07:40:45 +04:00
|
|
|
echo "Creating checksum files"
|
2003-05-10 10:07:26 +04:00
|
|
|
(cd ${setdir}
|
2002-04-11 10:04:42 +04:00
|
|
|
${CKSUM} -o1 *.tgz > BSDSUM
|
|
|
|
${CKSUM} *.tgz > CKSUM
|
|
|
|
${CKSUM} -m *.tgz > MD5
|
|
|
|
${CKSUM} -o2 *.tgz > SYSVSUM
|
|
|
|
)
|