Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: CVS

svn commit: r833623 - /httpd/site/trunk/dist/tools/roll.sh

 

 

Apache cvs RSS feed   Index | Next | Previous | View Threaded


fuankg at apache

Nov 6, 2009, 5:02 PM

Post #1 of 1 (56 views)
Permalink
svn commit: r833623 - /httpd/site/trunk/dist/tools/roll.sh

Author: fuankg
Date: Sat Nov 7 01:02:19 2009
New Revision: 833623

URL: http://svn.apache.org/viewvc?rev=833623&view=rev
Log:
make checksum output equal regardless of used tools.

Modified:
httpd/site/trunk/dist/tools/roll.sh

Modified: httpd/site/trunk/dist/tools/roll.sh
URL: http://svn.apache.org/viewvc/httpd/site/trunk/dist/tools/roll.sh?rev=833623&r1=833622&r2=833623&view=diff
==============================================================================
--- httpd/site/trunk/dist/tools/roll.sh (original)
+++ httpd/site/trunk/dist/tools/roll.sh Sat Nov 7 01:02:19 2009
@@ -82,33 +82,89 @@

echo $split
echo ""
-echo "Cleaning up and signing the files ..."
+echo "Generating MD5/SHA1 checksum files ..."
echo ""

-md5sum="`which md5sum md5 2> /dev/null | head -1`"
-if test -x "${md5sum}"; then
- ${md5sum} ${dirname}.tar.gz > ${dirname}.tar.gz.md5
- ${md5sum} ${dirname}.tar.bz2 > ${dirname}.tar.bz2.md5
- if test -f "${dirname}-deps.tar.gz"; then
- ${md5sum} ${dirname}-deps.tar.gz > ${dirname}-deps.tar.gz.md5
- fi
- if test -f "${dirname}-deps.tar.bz2"; then
- ${md5sum} ${dirname}-deps.tar.bz2 > ${dirname}-deps.tar.bz2.md5
- fi
-fi
-
+# check for executables
+gpg="`which gpg 2> /dev/null | head -1`"
openssl="`which openssl 2> /dev/null | head -1`"
+md5sum="`which md5sum 2> /dev/null | head -1`"
+sha1sum="`which sha1sum 2> /dev/null | head -1`"
+md5="`which md5 2> /dev/null | head -1`"
+sha1="`which sha1 2> /dev/null | head -1`"
+
+set -- ${dirname}.tar.gz ${dirname}.tar.bz2 ${dirname}-deps.tar.gz ${dirname}-deps.tar.bz2
+# if found we use openssl for generating the checksums
+# and convert the results into machine-readable format.
if test -x "${openssl}"; then
- ${openssl} sha1 ${dirname}.tar.gz > ${dirname}.tar.gz.sha1
- ${openssl} sha1 ${dirname}.tar.bz2 > ${dirname}.tar.bz2.sha1
- if test -f "${dirname}-deps.tar.gz"; then
- ${openssl} sha1 ${dirname}-deps.tar.gz > ${dirname}-deps.tar.gz.sha1
- fi
- if test -f "${dirname}-deps.tar.bz2"; then
- ${openssl} sha1 ${dirname}-deps.tar.bz2 > ${dirname}-deps.tar.bz2.sha1
+ for file; do
+ if test -f "${file}"; then
+ echo "openssl: creating md5 checksum file for ${file} ..."
+ ${openssl} md5 ${file} |\
+ sed -e 's#^MD5(\(.*\))= \([0-9a-f]*\)$#\2 *\1#' > ${file}.md5
+ echo "openssl: creating sha1 checksum file for ${file} ..."
+ ${openssl} sha1 ${file} |\
+ sed -e 's#^SHA1(\(.*\))= \([0-9a-f]*\)$#\2 *\1#' > ${file}.sha1
+ fi
+ done
+# no openssl found - check if we have gpg
+elif test -x "${gpg}"; then
+ for file; do
+ if test -f "${file}"; then
+ echo "gpg: creating md5 checksum file for ${file} ..."
+ ${gpg} --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} ..."
+ ${gpg} --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
+else
+ # no openssl or gpg found - check for md5sum
+ if test -x "${md5sum}"; then
+ for file; do
+ if test -f "${file}"; then
+ echo "md5sum: creating md5 checksum file for ${file} ..."
+ ${md5sum} -b ${file} > ${file}.md5
+ fi
+ done
+ # no openssl or gpg found - check for md5
+ elif test -x "${md5}"; then
+ for file; do
+ if test -f "${file}"; then
+ echo "md5: creating md5 checksum file for ${file} ..."
+ ${md5} -r ${file} | sed -e 's# # *#' > ${file}.md5
+ fi
+ done
+ fi
+ # no openssl or gpg found - check for sha1sum
+ if test -x "${sha1sum}"; then
+ for file; do
+ if test -f "${file}"; then
+ echo "sha1sum: creating sha1 checksum file for ${file} ..."
+ ${sha1sum} -b ${file} > ${file}.sha1
+ fi
+ done
+ # no openssl or gpg found - check for sha1
+ elif test -x "${sha1}"; then
+ for file; do
+ if test -f "${file}"; then
+ echo "sha1: creating sha1 checksum file for ${file} ..."
+ ${sha1} -r ${file} | sed -e 's# # *#' > ${file}.sha1
+ fi
+ done
fi
fi

+echo $split
+echo ""
+echo "Cleaning up and signing the files ..."
+echo ""
+
if test -x "`which pgp 2> /dev/null`"; then
if test -n "${user}"; then
args="-u ${user}"

Apache cvs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.