summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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