summaryrefslogtreecommitdiffstats
path: root/release
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2000-07-26 01:36:22 +0000
committerjhb <jhb@FreeBSD.org>2000-07-26 01:36:22 +0000
commitc17e1af42f6fe2d122a3dec1f92f59e6e5fbd603 (patch)
tree529794f88324497e92fe289974327beac759c703 /release
parentc6cb18036eba309d3f65eee8d8aca0cbd0741384 (diff)
downloadFreeBSD-src-c17e1af42f6fe2d122a3dec1f92f59e6e5fbd603.zip
FreeBSD-src-c17e1af42f6fe2d122a3dec1f92f59e6e5fbd603.tar.gz
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.
Diffstat (limited to 'release')
-rwxr-xr-xrelease/scripts/X11/generate_tarballs.sh79
1 files changed, 79 insertions, 0 deletions
diff --git a/release/scripts/X11/generate_tarballs.sh b/release/scripts/X11/generate_tarballs.sh
new file mode 100755
index 0000000..437b007
--- /dev/null
+++ b/release/scripts/X11/generate_tarballs.sh
@@ -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
OpenPOWER on IntegriCloud