This script takes the packing lists we generated earlier and generates the

corresponding tarball from it.  It uses the packing list name to determine
the tarball name.  If the tarball name ends in 'gz', it will be gzipped, if
it ends in 'bz', it will be bzip2'd.
This commit is contained in:
John Baldwin 2000-07-26 01:36:22 +00:00
parent 62f26f9acd
commit ca4c7dfbf6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=63866

View File

@ -0,0 +1,79 @@
#!/bin/sh
#
# This script takes a directory containing the base install of X, a directory
# containing the packing lists for the tarballs, and generates the distribution
# tarballs in a 3rd destination directory.
# generate_tarball <packing list> <tarball>
#
# Takes the packing list listed in the first argument and generates a
# corresponding tarball relative to the source directory in a file with the
# name listed in the second argument.
generate_tarball() {
echo "Generating $2 from $1..."
tar_arguments='cnTfp';
# handle gzip/bzip2/compress
case $2 in
*gz)
tar_arguments="${tar_arguments}z"
;;
*bz)
tar_arguments="${tar_arguments}y"
;;
*Z)
tar_arguments="${tar_arguments}Z"
;;
esac
cat $1 | (cd ${source_dir} ; tar ${tar_arguments} - - ) > $2
}
# output the usage
#
usage() {
echo "$0 <source_dir> <plist_dir> <tarball_dir>"
echo
echo "Where <source_dir> is a directory containing the X distribution,"
echo "<plist_dir> is the directory containing all of the packing lists"
echo "generated by generate_plists.sh, and <tarball_dir> is the"
echo "directory to put all the tarballs under."
exit 1
}
# copy the directory structure of the packing list directory over into the
# tarball directory
#
mirror_directories() {
echo "Creating tarball directory structure..."
find ${plist_dir} -type d | \
sed -e "s:^${plist_dir}:mkdir -p ${tarball_dir}:" | \
sh -x || exit 1
}
# build all the tarballs
#
build_tarballs() {
for plist in `find ${plist_dir} ! -type d`; do
archive=`echo ${plist} | \
sed -e "s:^${plist_dir}:${tarball_dir}:" \
-e 's/\.plist$//'`
generate_tarball ${plist} ${archive}
done
}
# check for enough arguments
if [ $# -ne 3 ]; then
usage
fi
# setup the variables
source_dir=$1
plist_dir=$2
tarball_dir=$3
# do all the work
if mirror_directories; then
build_tarballs
fi