From 2080abc055696783ce6cb99daee268be6222953d Mon Sep 17 00:00:00 2001
From: toy <toy>
Date: Sat, 18 Oct 2003 15:45:57 +0000
Subject: [PATCH] Add options to make-dist.sh:

   -G to select the group to use for the installation
   -O to select the owner
   -b for bzip compression
   -g for gzip compression (the default, if none given)
---
 tools/make-dist.sh       | 44 ++++++++++++++++++++++++----
 tools/make-extra-dist.sh | 43 ++++++++++++++++++++--------
 tools/make-main-dist.sh  | 62 ++++++++++++++++++++++++++--------------
 3 files changed, 110 insertions(+), 39 deletions(-)

diff --git a/tools/make-dist.sh b/tools/make-dist.sh
index 1f40b2c07..f82d9bcaa 100755
--- a/tools/make-dist.sh
+++ b/tools/make-dist.sh
@@ -1,9 +1,34 @@
 #!/bin/sh
 
-if [ "$1" = "" -o "$2" = "" -o "$3" = "" -o "$4" = "" ]
-then
-	echo "Usage: $0 target-directory version arch os"
-	exit 1
+usage() {
+    echo "make-dist.sh: [-hbg] [-G group] [-O owner] dir version arch os"
+    echo "  -h           This help"
+    echo "  -b           Use bzip2 compression"
+    echo "  -g           Use gzip compression"
+    echo "  -G group     Group to use"
+    echo "  -O owner     Owner to use"
+    echo "   dir         Directory where the build is located"
+    echo "   version     Version (usually date and/or other version info)"
+    echo "   arch        Architecture (x86, sparc, etc.)"
+    echo "   os          OS (linux, solaris8, etc.)"
+    exit 1
+}
+
+while getopts "G:O:bgh?" arg
+do
+    case $arg in
+	G) GROUP=$OPTARG ;;
+	O) OWNER=$OPTARG ;;
+	b) ENABLE_BZIP=-b ;;
+	g) ENABLE_GZIP=-g  ;;
+	h | \?) usage; exit 1 ;;
+    esac
+done
+	
+shift `expr $OPTIND - 1`
+
+if [ $# -ne 4 ]; then
+    usage
 fi
 
 if [ ! -d "$1" ]
@@ -18,5 +43,12 @@ ARCH=$3
 OS=$4
 ROOT=`dirname $0`
 
-$ROOT/make-main-dist.sh $TARGET $VERSION $ARCH $OS || exit 1
-$ROOT/make-extra-dist.sh $TARGET $VERSION $ARCH $OS || exit 2
+# If no compression options given, default to gzip
+if [ -z "$ENABLE_GZIP" -a -z "$ENABLE_BZIP" ]; then
+    ENABLE_GZIP="-g"
+fi
+
+OPTIONS="${GROUP:+ -G ${GROUP}} ${OWNER:+ -O ${OWNER}} $ENABLE_GZIP $ENABLE_BZIP"
+
+$ROOT/make-main-dist.sh $OPTIONS $TARGET $VERSION $ARCH $OS || exit 1
+$ROOT/make-extra-dist.sh $OPTIONS $TARGET $VERSION $ARCH $OS || exit 2
diff --git a/tools/make-extra-dist.sh b/tools/make-extra-dist.sh
index 6c8f6a7c0..3a13e4c8c 100755
--- a/tools/make-extra-dist.sh
+++ b/tools/make-extra-dist.sh
@@ -1,5 +1,18 @@
 #!/bin/sh
 
+while getopts "G:O:bgh?" arg
+do
+    case $arg in
+	G) GROUP="-g $OPTARG" ;;
+	O) OWNER="-o $OPTARG" ;;
+	b) ENABLE_BZIP=-b ;;
+	g) ENABLE_GZIP=-g  ;;
+	h | \?) usage; exit 1 ;;
+    esac
+done
+
+shift `expr $OPTIND - 1`
+
 if [ "$1" = "" -o "$2" = "" -o "$3" = "" -o "$4" = "" ]
 then
 	echo "Usage: $0 target-directory version arch os"
@@ -40,31 +53,37 @@ echo Cleaning $DESTDIR
 [ -d $DESTDIR ] && rm -rf $DESTDIR
 
 echo Installing extra components
-install -d -g bin -o root -m 0755 $DESTDIR/lib/cmucl/lib
-install -d -g bin -o root -m 0755 $DESTDIR/lib/cmucl/lib/subsystems
-install -g bin -o root -m 0644 $TARGET/clx/clx-library.$FASL \
+install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib
+install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/subsystems
+install ${GROUP} ${OWNER} -m 0644 $TARGET/clx/clx-library.$FASL \
 	$DESTDIR/lib/cmucl/lib/subsystems/
-install -g bin -o root -m 0644 $TARGET/hemlock/hemlock-library.$FASL \
+install ${GROUP} ${OWNER} -m 0644 $TARGET/hemlock/hemlock-library.$FASL \
 	$DESTDIR/lib/cmucl/lib/subsystems/
-# install -d -g bin -o root -m 0755 $DESTDIR/lib/cmucl/lib/fonts/
-# install -g bin -o root -m 0644 misc/8x13u.snf misc/fonts.dir \
+# install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/fonts/
+# install ${GROUP} ${OWNER} -m 0644 misc/8x13u.snf misc/fonts.dir \
 #	$DESTDIR/lib/cmucl/lib/fonts/
-install -g bin -o root -m 0644 src/hemlock/XKeysymDB \
+install ${GROUP} ${OWNER} -m 0644 src/hemlock/XKeysymDB \
 	src/hemlock/hemlock11.cursor src/hemlock/hemlock11.mask \
 	$TARGET/hemlock/spell-dictionary.bin \
 	$DESTDIR/lib/cmucl/lib/
-install -g bin -o root -m 0755 src/hemlock/mh-scan $DESTDIR/lib/cmucl/lib/
-install -g bin -o root -m 0644 $TARGET/interface/clm-library.$FASL  \
+install ${GROUP} ${OWNER} -m 0755 src/hemlock/mh-scan $DESTDIR/lib/cmucl/lib/
+install ${GROUP} ${OWNER} -m 0644 $TARGET/interface/clm-library.$FASL  \
 	$DESTDIR/lib/cmucl/lib/subsystems/
-install -g bin -o root -m 0755 $TARGET/motif/server/motifd \
+install ${GROUP} ${OWNER} -m 0755 $TARGET/motif/server/motifd \
 	$DESTDIR/lib/cmucl/lib/
 
 sync ; sleep 1 ; sync ; sleep 1 ; sync
 echo Tarring extra components
-( cd $DESTDIR ; tar cf - lib ) | \
+if [ -n "$ENABLE_GZIP" ]; then
+    echo "  Compressing with gzip"
+    ( cd $DESTDIR ; tar cf - lib ) | \
 	gzip -c > cmucl-$VERSION-$ARCH-$OS.extra.tar.gz
-( cd $DESTDIR ; tar cf - lib ) | \
+fi
+if [ -n "$ENABLE_BZIP" ]; then
+    echo "  Compressing with bzip"
+    ( cd $DESTDIR ; tar cf - lib ) | \
 	bzip2 -c > cmucl-$VERSION-$ARCH-$OS.extra.tar.bz2
+fi
 
 echo Cleaning $DESTDIR
 [ -d $DESTDIR ] && rm -rf $DESTDIR
diff --git a/tools/make-main-dist.sh b/tools/make-main-dist.sh
index f6a3d1e62..acad2b7a1 100755
--- a/tools/make-main-dist.sh
+++ b/tools/make-main-dist.sh
@@ -1,5 +1,18 @@
 #!/bin/sh
 
+while getopts "G:O:bgh?" arg
+do
+    case $arg in
+	G) GROUP="-g $OPTARG" ;;
+	O) OWNER="-o $OPTARG" ;;
+	b) ENABLE_BZIP=-b ;;
+	g) ENABLE_GZIP=-g  ;;
+	h | \?) usage; exit 1 ;;
+    esac
+done
+
+shift `expr $OPTIND - 1`
+
 if [ "$1" = "" -o "$2" = "" -o "$3" = "" -o "$4" = "" ]
 then
 	echo "Usage: $0 target-directory version arch os"
@@ -40,45 +53,52 @@ echo Cleaning $DESTDIR
 [ -d $DESTDIR ] && rm -rf $DESTDIR
 
 echo Installing main components
-install -d -g bin -o root -m 0755 $DESTDIR/bin
-install -d -g bin -o root -m 0755 $DESTDIR/doc/cmucl
-install -d -g bin -o root -m 0755 $DESTDIR/lib/cmucl
-install -d -g bin -o root -m 0755 $DESTDIR/lib/cmucl/lib
-install -d -g bin -o root -m 0755 $DESTDIR/lib/cmucl/lib/subsystems
-install -d -g bin -o root -m 0755 $DESTDIR/man/man1
-install -g bin -o root -m 0755 $TARGET/lisp/lisp $DESTDIR/bin/
-install -g bin -o root -m 0644 $TARGET/lisp/lisp.core $DESTDIR/lib/cmucl/lib/
-install -g bin -o root -m 0755 src/tools/load-foreign.csh src/tools/config \
+install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/bin
+install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/doc/cmucl
+install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl
+install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib
+install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/lib/cmucl/lib/subsystems
+install -d ${GROUP} ${OWNER} -m 0755 $DESTDIR/man/man1
+install ${GROUP} ${OWNER} -m 0755 $TARGET/lisp/lisp $DESTDIR/bin/
+install ${GROUP} ${OWNER} -m 0644 $TARGET/lisp/lisp.core $DESTDIR/lib/cmucl/lib/
+install ${GROUP} ${OWNER} -m 0755 src/tools/load-foreign.csh src/tools/config \
 	$DESTDIR/lib/cmucl/lib/
-install -g bin -o root -m 0644 src/tools/config.lisp \
+install ${GROUP} ${OWNER} -m 0644 src/tools/config.lisp \
 	$DESTDIR/lib/cmucl/lib/
-install -g bin -o root -m 0644 src/code/generic-site.lisp \
+install ${GROUP} ${OWNER} -m 0644 src/code/generic-site.lisp \
 	$DESTDIR/lib/cmucl/lib/
-install -g bin -o root -m 0644 $TARGET/lisp/lisp.nm $TARGET/lisp/lisp.map \
+install ${GROUP} ${OWNER} -m 0644 $TARGET/lisp/lisp.nm $TARGET/lisp/lisp.map \
 	$TARGET/lisp/internals.h $TARGET/lisp/internals.inc $DESTDIR/lib/cmucl/
-install -g bin -o root -m 0755 src/tools/sample-wrapper $DESTDIR/lib/cmucl/
+install ${GROUP} ${OWNER} -m 0755 src/tools/sample-wrapper $DESTDIR/lib/cmucl/
+
 for f in gray-streams gray-compat simple-streams iodefs
 do
-  install -g bin -o root -m 0644 $TARGET/pcl/$f-library.$FASL $DESTDIR/lib/cmucl/lib/subsystems/
+    install ${GROUP} ${OWNER} -m 0644 $TARGET/pcl/$f-library.$FASL $DESTDIR/lib/cmucl/lib/subsystems/
 done
 
-install -g bin -o root -m 0644 src/general-info/cmucl.1 \
+install ${GROUP} ${OWNER} -m 0644 src/general-info/cmucl.1 \
 	$DESTDIR/man/man1/
-install -g bin -o root -m 0644 src/general-info/lisp.1 \
+install ${GROUP} ${OWNER} -m 0644 src/general-info/lisp.1 \
 	$DESTDIR/man/man1/
-install -g bin -o root -m 0644 src/general-info/README $DESTDIR/doc/cmucl/
+install ${GROUP} ${OWNER} -m 0644 src/general-info/README $DESTDIR/doc/cmucl/
 if [ -f src/general-info/release-$VERSION.txt ] 
 then
-	install -g bin -o root -m 0644 src/general-info/release-$VERSION.txt \
+	install ${GROUP} ${OWNER} -m 0644 src/general-info/release-$VERSION.txt \
 		$DESTDIR/doc/cmucl/
 fi
 
 sync ; sleep 1 ; sync ; sleep 1 ; sync
 echo Tarring main components
-( cd $DESTDIR ; tar cf - bin doc lib man ) | \
+if [ -n "$ENABLE_GZIP" ]; then
+    echo "  Compressing with gzip"
+    ( cd $DESTDIR ; tar cf - bin doc lib man ) | \
 	gzip -c > cmucl-$VERSION-$ARCH-$OS.tar.gz
-( cd $DESTDIR ; tar cf - bin doc lib man ) | \
-	bzip2 -c > cmucl-$VERSION-$ARCH-$OS.tar.bz2
+fi
+if [ -n "$ENABLE_BZIP" ]; then
+    echo "  Compressing with bzip"
+    ( cd $DESTDIR ; tar cf - bin doc lib man ) | \
+	bzip2 > cmucl-$VERSION-$ARCH-$OS.tar.bz2
+fi
 
 echo Cleaning $DESTDIR
 [ -d $DESTDIR ] && rm -rf $DESTDIR
-- 
GitLab