#! /bin/sh # # $NetBSD: makesrctars,v 1.27 2005/10/21 04:11:49 jmc Exp $ # # makesrctars srcdir setdir # Create source tarballs in setdir from the source under srcdir. # prog=${0##*/} # set defaults : ${CKSUM:=cksum} : ${MTREE:=/usr/sbin/mtree} : ${PAX:=pax} xsrcdir= GZIP=-9 export GZIP usage() { cat 1>&2 < /tmp/in$$ egrep=$* if [ "$egrep" = "" ]; then egrep='.' fi set -f ${MTREE} -c -X /tmp/in$$ | ${MTREE} -C -k type | \ egrep -v 'type=link' | egrep $egrep | \ sed -e 's:type=file:& mode=0664:' \ -e 's:type=dir:& mode=0775:' \ -e 's:$: uname=root gname=wsrc:' | \ ${PAX} -M -N ${PASSWD} -w -d -s'|^\.|'${srcprefix}'|' | \ gzip > "${setdir}/${set}" rm -f /tmp/in$$ )} # create (base)src sets # if ! cd "${srcdir}"; then echo "Can't chdir to ${srcdir}" exit 1 fi srcprefix=usr/src export setdir MTREE PAX CKSUM GZIP PASSWD srcprefix makeset src . -v '^\.\/gnu|^\.\/share|^\.\/sys|^\.\/usr\.bin\/config' makeset gnusrc gnu makeset syssrc . -e '^\..type=dir|^\.\/sys|^\.\/usr\.bin.type=dir|^\.\/usr\.bin\/config' makeset sharesrc share # 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 echo "Creating checksum files" (cd ${setdir} ${CKSUM} -o1 *.tgz > BSDSUM ${CKSUM} *.tgz > CKSUM ${CKSUM} -a md5 *.tgz > MD5 ${CKSUM} -o2 *.tgz > SYSVSUM ${CKSUM} -a sha512 *.tgz > SHA512 ) exit 0