verify_digest(){ # $0 method file string case "$1" in *) DIGEST=`echo "$1" | tr a-z A-Z` [ "$DIGEST($2)= $3" = "`openssl $1 $2`" ] ;; esac } verify_signature(){ # $0 url|id ... sig while [ "$1" != "" ]; do case "$1" in 0x*) gpg --keyserver pgp.nic.ad.jp --recv-keys "$1" || return $? ;; http:*|ftp:*) curl "$1" | gpg --import || return $? ;; *) gpg --verify "$1" return $? esac shift done } error_out(){ # $0 message ... echo "$@" 1>&2 exit 1 } curl -RO -C - http://kernel.org/pub/software/scm/git/git-1.6.4.2.tar.bz2 curl -RO -C - http://kernel.org/pub/software/scm/git/git-1.6.4.2.tar.bz2.sign verify_signature 0x517D0F0E git-1.6.4.2.tar.bz2.sign || error_out "$0: stopped at line $LINENO" tar xvjf git-1.6.4.2.tar.bz2 (cd git-1.6.4.2 && patch -p0 -b -z.org < ../git-1.6.4.2-sakuya.patch )