minix/distrib/sets/makesums
Lionel Sambuc 9152e1c5a7 Upgrading build system to new NetBSD revision
The tested targets are the followgin ones:
 * tools
 * distribution
 * sets
 * release

The remaining NetBSD targets have not been disabled nor tested
*at all*. Try them at your own risk, they may reboot the earth.

For all compliant Makefiles, objects and generated files are put in
MAKEOBJDIR, which means you can now keep objects between two branch
switching. Same for DESTDIR, please refer to build.sh options.

Regarding new or modifications of Makefiles a few things:
 * Read share/mk/bsd.README
 * If you add a subdirectory, add a Makefile in it, and have it called
   by the parent through the SUBDIR variable.
 * Do not add arbitrary inclusion which crosses to another branch of
   the hierarchy; If you can't do without it, put a comment on why.
   If possible, do not use inclusion at all.
 * Use as much as possible the infrastructure, it is here to make
   life easier, do not fight it.

Sets and package are now used to track files.
We have one set called "minix", composed of one package called "minix-sys"
2012-11-15 16:07:29 +01:00

79 lines
2 KiB
Bash
Executable file

#!/bin/sh
#
# $NetBSD: makesums,v 1.16 2009/09/19 07:09:54 snj Exp $
#
# Make checksum files for files in ``tardir''. Usage:
# makesums [-a] [-t tardir] [setname [...]]
#
# If -t is omitted, RELEASEDIR must be set and not empty.
# The ``setname'' arguments comprise a list of files to checksum,
# and may be omitted (in which case ``*.tgz'' is used).
# If -A is given, then the checksum are appended to possibly existing files.
# NOTE: Don't use this when running parallel jobs
# If -a is given, then the list of sets is ignored, and ``*'' is used.
#
# After shell glob expansion, the list of sets is filtered to remove known
# output file names (of the form *SUM, SHA512 and MD5), non-existent files, and
# subdirectories. If this filtering leaves no files, then no output files are
# produced. Otherwise the resulting list of files are checksummed and two
# output files (MD5 and SHA512) are produced.
#
prog="${0##*/}"
rundir="$(dirname "$0")" # ${0%/*} isn't good enough when there's no "/"
. "${rundir}/sets.subr"
# set defaults
targetdir="${RELEASEDIR}"
dash_all=no
append=\>
usage()
{
cat 1>&2 <<USAGE
Usage: ${prog} [-A] [-a] [-t targetdir] [setname [...]]
-A Append to possible existing checksum files
-a checksum all plain files instead of [setname [...]]
-t targetdir \${RELEASEDIR} [${targetdir}]
setname [...] sets to checksum [*.tgz]
USAGE
exit 1
}
# handle args
while getopts aAt: ch; do
case ${ch} in
A)
append=\>\>
;;
a)
dash_all=yes
;;
t)
targetdir="${OPTARG}"
;;
*)
usage
;;
esac
done
shift $((${OPTIND} - 1))
if [ -z "${targetdir}" ]; then
echo >&2 "${prog}: \${RELEASEDIR} must be set or provided with -t"
exit 1
fi
cd "${targetdir}"
pat="$*"
if [ "${dash_all}" = yes ]; then
pat='*'
elif [ -z "${pat}" ]; then
pat='*.tgz'
fi
lists="$(${FIND} ${pat} -prune \( -type f -o -type l \) \
\! -name '*SUM' \! -name MD5 \! -name SHA512 2>/dev/null)"
if [ -n "${lists}" ]; then
eval ${CKSUM} -a md5 ${lists} ${append} MD5
eval ${CKSUM} -a sha512 ${lists} ${append} SHA512
fi