[CalendarServer-changes] [10045] CalendarServer/trunk/support/build.sh
source_changes at macosforge.org
source_changes at macosforge.org
Fri Nov 16 13:45:19 PST 2012
Revision: 10045
http://trac.calendarserver.org//changeset/10045
Author: wsanchez at apple.com
Date: 2012-11-16 13:45:19 -0800 (Fri, 16 Nov 2012)
Log Message:
-----------
Add sha1 option for download checksums.
Modified Paths:
--------------
CalendarServer/trunk/support/build.sh
Modified: CalendarServer/trunk/support/build.sh
===================================================================
--- CalendarServer/trunk/support/build.sh 2012-11-16 20:29:07 UTC (rev 10044)
+++ CalendarServer/trunk/support/build.sh 2012-11-16 21:45:19 UTC (rev 10045)
@@ -190,12 +190,14 @@
www_get () {
if ! "${do_get}"; then return 0; fi;
- local md5="";
+ local md5="";
+ local sha1="";
OPTIND=1;
- while getopts "m:" option; do
+ while getopts "m:s:" option; do
case "${option}" in
- 'm') md5="${OPTARG}"; ;;
+ 'm') md5="${OPTARG}"; ;;
+ 's') sha1="${OPTARG}"; ;;
esac;
done;
shift $((${OPTIND} - 1));
@@ -228,18 +230,27 @@
check_hash () {
local file="$1"; shift;
- if [ "${hash}" == "md5" ]; then
- local sum="$(hash "${file}" | perl -pe 's|^.*([0-9a-f]{32}).*$|\1|')";
- if [ -n "${md5}" ]; then
- echo "Checking MD5 sum for ${name}...";
- if [ "${md5}" != "${sum}" ]; then
- echo "ERROR: MD5 sum for downloaded file is wrong: ${sum} != ${md5}";
- return 1;
- fi;
- else
- echo "MD5 sum for ${name} is ${sum}";
+ local sum="$(md5 "${file}" | perl -pe 's|^.*([0-9a-f]{32}).*$|\1|')";
+ if [ -n "${md5}" ]; then
+ echo "Checking MD5 sum for ${name}...";
+ if [ "${md5}" != "${sum}" ]; then
+ echo "ERROR: MD5 sum for downloaded file is wrong: ${sum} != ${md5}";
+ return 1;
fi;
+ else
+ echo "MD5 sum for ${name} is ${sum}";
fi;
+
+ local sum="$(md5 "${file}" | perl -pe 's|^.*([0-9a-f]{32}).*$|\1|')";
+ if [ -n "${sha1}" ]; then
+ echo "Checking SHA1 sum for ${name}...";
+ if [ "${sha1}" != "${sum}" ]; then
+ echo "ERROR: SHA1 sum for downloaded file is wrong: ${sum} != ${sha1}";
+ return 1;
+ fi;
+ else
+ echo "SHA1 sum for ${name} is ${sum}";
+ fi;
}
if [ ! -f "${cache_file}" ]; then
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20121116/485e2f58/attachment-0001.html>
More information about the calendarserver-changes
mailing list