httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1308873 - /httpd/site/trunk/tools/hash-sign.sh
Date Tue, 03 Apr 2012 12:48:38 GMT
Author: jim
Date: Tue Apr  3 12:48:38 2012
New Revision: 1308873

URL: http://svn.apache.org/viewvc?rev=1308873&view=rev
Log:
Support gpg2 and prefer it over gpg and prefer both over pgp

Modified:
    httpd/site/trunk/tools/hash-sign.sh

Modified: httpd/site/trunk/tools/hash-sign.sh
URL: http://svn.apache.org/viewvc/httpd/site/trunk/tools/hash-sign.sh?rev=1308873&r1=1308872&r2=1308873&view=diff
==============================================================================
--- httpd/site/trunk/tools/hash-sign.sh (original)
+++ httpd/site/trunk/tools/hash-sign.sh Tue Apr  3 12:48:38 2012
@@ -25,6 +25,7 @@ echo "Generating MD5/SHA1 checksum files
 echo ""
 
 # check for executables
+gpg2="`which gpg2 2> /dev/null | head -1`"
 gpg="`which gpg 2> /dev/null | head -1`"
 pgp="`which pgp 2> /dev/null | head -1`"
 openssl="`which openssl 2> /dev/null | head -1`"
@@ -46,6 +47,22 @@ if test -x "${openssl}"; then
           sed -e 's#^SHA1(\(.*\))= \([0-9a-f]*\)$#\2 *\1#' > ${file}.sha1
     fi
   done
+# no openssl found - check if we have gpg2
+elif test -x "${gpg2}"; then
+  for file in ${allfiles}; do
+    if test -f "${file}"; then
+      echo "gpg2: creating md5 checksum file for ${file} ..."
+      ${gpg2} --print-md md5 ${file} |\
+          sed -e '{N;s#\n##;}' |\
+          sed -e 's#\(.*\): \(.*\)#\2::\1#;s#[\r\n]##g;s# ##g' \
+              -e 'y#ABCDEF#abcdef#;s#::# *#' > ${file}.md5
+      echo "gpg: creating sha1 checksum file for ${file} ..."
+      ${gpg2} --print-md sha1 ${file} |\
+          sed -e '{N;s#\n##;}' |\
+          sed -e 's#\(.*\): \(.*\)#\2::\1#;s#[\r\n]##g;s# ##g' \
+              -e 'y#ABCDEF#abcdef#;s#::# *#' > ${file}.sha1
+    fi
+  done
 # no openssl found - check if we have gpg
 elif test -x "${gpg}"; then
   for file in ${allfiles}; do
@@ -104,18 +121,18 @@ echo ""
 echo "Signing the files ..."
 echo ""
 
-# if found we use pgp for signing the files
-if test -x "${pgp}"; then
+# We have gpg2
+elif test -x "${gpg2}"; then
   if test -n "${user}"; then
-    args="-u ${user}"
+    args="-u ${user} ${args}"
   fi
   for file in ${allfiles}; do
     if test -f "${file}"; then
-      echo "pgp: creating asc signature file for ${file} ..."
-      ${pgp} -sba ${file} ${args}
+      echo "gpg2: creating asc signature file for ${file} ..."
+      ${gpg2} --armor ${args} --detach-sign ${file}
     fi
   done
-# no pgp found - check for gpg
+# no gpg2 found - check for gpg
 elif test -x "${gpg}"; then
   if test -n "${user}"; then
     args="-u ${user} ${args}"
@@ -126,6 +143,17 @@ elif test -x "${gpg}"; then
       ${gpg} --armor ${args} --detach-sign ${file}
     fi
   done
+# ... no GnuPG? Try PGP
+elif test -x "${pgp}"; then
+  if test -n "${user}"; then
+    args="-u ${user}"
+  fi
+  for file in ${allfiles}; do
+    if test -f "${file}"; then
+      echo "pgp: creating asc signature file for ${file} ..."
+      ${pgp} -sba ${file} ${args}
+    fi
+  done
 else
   echo "PGP or GnuPG not found!  Not signing release!"
 fi



Mime
View raw message