renamed check_signatures.sh
Project: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/commit/83cd5adb Tree: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/tree/83cd5adb Diff: http://git-wip-us.apache.org/repos/asf/incubator-marmotta/diff/83cd5adb Branch: refs/heads/develop Commit: 83cd5adb6e2576fa86fa5f8aac9cef721eaa9640 Parents: d21a09d Author: Jakob Frank <[email protected]> Authored: Sat Apr 13 09:47:31 2013 +0200 Committer: Jakob Frank <[email protected]> Committed: Sat Apr 13 09:47:31 2013 +0200 ---------------------------------------------------------------------- build/scripts/check_signatures.sh | 75 ++++++++++++++++++++ build/scripts/check_signatures_and_digests.sh | 75 -------------------- 2 files changed, 75 insertions(+), 75 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/83cd5adb/build/scripts/check_signatures.sh ---------------------------------------------------------------------- diff --git a/build/scripts/check_signatures.sh b/build/scripts/check_signatures.sh new file mode 100755 index 0000000..0aee050 --- /dev/null +++ b/build/scripts/check_signatures.sh @@ -0,0 +1,75 @@ +#!/bin/bash -e +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License +# +############################################################################## +# +# Usage: ./check_signatures.sh <RELEASE_DIR> +# +# Progress printed on STDOUT, result available via exit-code +# +# Exit-Codes: +# 0 - All fine, signatures and digests are valid and correct +# 1 - A Required file (.asc, .md5, .sha1) is missing +# 2 - Invalid pgp/gpg signature found (.asc) +# 3 - Incorrect md5-sum detected (.md5) +# 4 - Incorrect sha1-sum detected (.sha1) +# 255 - Wrong/Missing command parameter +# + +# Check for arguments +[ -z $1 ] && { echo "USAGE: $0 <RELEASE_DIR>" >&2; exit 255; } +[ ! -d $1 ] && { echo "release-dir '$1' not found" >&2; exit 255; } + +BASE="${1}" +#cd "$BASE" + +KR=$(mktemp) +# make sure that the temp-keyring is removed on exit +trap "{ C=$?; rm -f ${KR} ${KR}~ ; exit $C; }" EXIT + +gpg="gpg --primary-keyring $KR" +# If there is a KEYS file, import it into the temp keyring +[ -r "$BASE/KEYS" ] && { echo "Import KEYS into temporary keyring"; $gpg --import "$BASE/KEYS"; echo; } + +# Look for all archives: *.zip, *.tar.gz, *.tgz +find "$BASE" -maxdepth 1 -type f -name "*.zip" -o -name "*.t*gz" | sort | while read f; do + echo "Checking archive $(basename $f)..." + + # Check gpg/pgp signature + if [ -f "${f}.asc" ]; then + $gpg --verify "${f}.asc" &>/dev/null && echo " - Signature: OK" || { echo " - Signature: ERROR"; exit 2; } + else + echo " - Signature: MISSING"; exit 1 + fi + + # Check md5sum + if [ -f "${f}.md5" ]; then + echo "$(cat ${f}.md5) ${f}" | md5sum --check - &>/dev/null && echo " - MD5: OK" || { echo " - MD5: ERROR"; exit 3; } + else + echo " - MD5: MISSING"; exit 1 + fi + + # Check sha1 + if [ -f "${f}.sha1" ]; then + echo "$(cat ${f}.sha1) ${f}" | sha1sum --check - &>/dev/null && echo " - SHA1: OK" || { echo " - SHA1: ERROR"; exit 4; } + else + echo " - SHA1: MISSING"; exit 1 + fi + echo +done +echo "All archives in $BASE have valid signatures and digests." +echo http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/83cd5adb/build/scripts/check_signatures_and_digests.sh ---------------------------------------------------------------------- diff --git a/build/scripts/check_signatures_and_digests.sh b/build/scripts/check_signatures_and_digests.sh deleted file mode 100755 index 0aee050..0000000 --- a/build/scripts/check_signatures_and_digests.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/bash -e -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License -# -############################################################################## -# -# Usage: ./check_signatures.sh <RELEASE_DIR> -# -# Progress printed on STDOUT, result available via exit-code -# -# Exit-Codes: -# 0 - All fine, signatures and digests are valid and correct -# 1 - A Required file (.asc, .md5, .sha1) is missing -# 2 - Invalid pgp/gpg signature found (.asc) -# 3 - Incorrect md5-sum detected (.md5) -# 4 - Incorrect sha1-sum detected (.sha1) -# 255 - Wrong/Missing command parameter -# - -# Check for arguments -[ -z $1 ] && { echo "USAGE: $0 <RELEASE_DIR>" >&2; exit 255; } -[ ! -d $1 ] && { echo "release-dir '$1' not found" >&2; exit 255; } - -BASE="${1}" -#cd "$BASE" - -KR=$(mktemp) -# make sure that the temp-keyring is removed on exit -trap "{ C=$?; rm -f ${KR} ${KR}~ ; exit $C; }" EXIT - -gpg="gpg --primary-keyring $KR" -# If there is a KEYS file, import it into the temp keyring -[ -r "$BASE/KEYS" ] && { echo "Import KEYS into temporary keyring"; $gpg --import "$BASE/KEYS"; echo; } - -# Look for all archives: *.zip, *.tar.gz, *.tgz -find "$BASE" -maxdepth 1 -type f -name "*.zip" -o -name "*.t*gz" | sort | while read f; do - echo "Checking archive $(basename $f)..." - - # Check gpg/pgp signature - if [ -f "${f}.asc" ]; then - $gpg --verify "${f}.asc" &>/dev/null && echo " - Signature: OK" || { echo " - Signature: ERROR"; exit 2; } - else - echo " - Signature: MISSING"; exit 1 - fi - - # Check md5sum - if [ -f "${f}.md5" ]; then - echo "$(cat ${f}.md5) ${f}" | md5sum --check - &>/dev/null && echo " - MD5: OK" || { echo " - MD5: ERROR"; exit 3; } - else - echo " - MD5: MISSING"; exit 1 - fi - - # Check sha1 - if [ -f "${f}.sha1" ]; then - echo "$(cat ${f}.sha1) ${f}" | sha1sum --check - &>/dev/null && echo " - SHA1: OK" || { echo " - SHA1: ERROR"; exit 4; } - else - echo " - SHA1: MISSING"; exit 1 - fi - echo -done -echo "All archives in $BASE have valid signatures and digests." -echo
