You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2010/10/21 08:05:32 UTC
svn commit: r1025839 -
/commons/proper/daemon/trunk/src/native/unix/support/mkdist.sh
Author: mturk
Date: Thu Oct 21 06:05:32 2010
New Revision: 1025839
URL: http://svn.apache.org/viewvc?rev=1025839&view=rev
Log:
Add gpg to mkdist RM's helper
Modified:
commons/proper/daemon/trunk/src/native/unix/support/mkdist.sh
Modified: commons/proper/daemon/trunk/src/native/unix/support/mkdist.sh
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/support/mkdist.sh?rev=1025839&r1=1025838&r2=1025839&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/support/mkdist.sh (original)
+++ commons/proper/daemon/trunk/src/native/unix/support/mkdist.sh Thu Oct 21 06:05:32 2010
@@ -25,13 +25,44 @@
# If the os argument is not provided current os name will be used.
#
#
-if [ ".$1" = . ];then
- arch="`uname -m`"
+gpgopts="-ba"
+arch=""
+for o
+do
+ case "$o" in
+ *=*) a=`echo "$o" | sed 's/^[-_a-zA-Z0-9]*=//'`
+ ;;
+ *) a=''
+ ;;
+ esac
+ case "$o" in
+ --passphrase=* )
+ gpgopts="$gpgopts --passphrase $a"
+ shift
+ ;;
+ --arch=* )
+ arch="$a"
+ shift
+ ;;
+ --os=* )
+ osname="$a"
+ shift
+ ;;
+ * )
+ break
+ ;;
+ esac
+done
+
+
+if [ ".$arch" = . ];then
+ arch=`uname -m 2>/dev/null | tr '[A-Z]' '[a-z]'` || arch="unknown"
echo "No architecture provided. Using $arch"
-else
- arch=$1
fi
-osname=$2
+if [ ".$osname" = . ];then
+ osname=`uname -s 2>/dev/null | tr '[A-Z]' '[a-z]'` || osname="unknown"
+ echo "No OS name provided. Using $osname"
+fi
topdir=.
major_sed='/#define.*JSVC_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p'
minor_sed='/#define.*JSVC_MINOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p'
@@ -39,18 +70,34 @@ patch_sed='/#define.*JSVC_PATCH_VERSION/
vmajor="`sed -n $major_sed $topdir/native/version.h`"
vminor="`sed -n $minor_sed $topdir/native/version.h`"
vpatch="`sed -n $patch_sed $topdir/native/version.h`"
-test ".$osname" = . && osname="`uname -s | tr [A-Z] [a-z]`"
verdst="commons-daemon-$vmajor.$vminor.$vpatch-bin-$osname-$arch"
extfiles="LICENSE.txt NOTICE.txt RELEASE-NOTES.txt"
for i in $extfiles
do
cp ../../../$i .
done
-echo "Creating $verdst.tar.gz ..."
-tar cfz $verdst.tar.gz jsvc $extfiles
+# Try to locate a MD5 binary
+md5_bin="`which md5sum 2>/dev/null || type md5sum 2>&1`"
+if [ -x "$md5_bin" ]; then
+ MD5SUM="$md5_bin --binary "
+else
+ MD5SUM="echo 00000000000000000000000000000000 "
+fi
+# Try to locate a SHA1 binary
+sha1_bin="`which sha1sum 2>/dev/null || type sha1sum 2>&1`"
+if [ -x "$sha1_bin" ]; then
+ SHA1SUM="$sha1_bin --binary "
+else
+ SHA1SUM="echo 0000000000000000000000000000000000000000 "
+fi
+dstfile=$verdst.tar.gz
+echo "Creating $dstfile ..."
+tar cfz $dstfile jsvc $extfiles
if [ ".$?" = .0 ]; then
- md5sum --binary $verdst.tar.gz > $verdst.tar.gz.md5
- sha1sum --binary $verdst.tar.gz > $verdst.tar.gz.sha1
+ echo "Signing $dstfile"
+ gpg $gpgopts $dstfile
+ $MD5SUM $dstfile > $dstfile.md5
+ $SHA1SUM $dstfile > $dstfile.sha1
else
rm $verdst.tar.gz >/dev/null 2>&1
fi