From: Emil Velikov <[email protected]> To allow users with multiple keys to select the appropriate one.
v2: - Change GPGKEY to include -u if valid key is provided (Julien). - Keep the help screen sorted alphabetically. Signed-off-by: Emil Velikov <[email protected]> --- release.sh | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/release.sh b/release.sh index 74a94d4..0c1647b 100755 --- a/release.sh +++ b/release.sh @@ -68,6 +68,29 @@ check_option_args() { } #------------------------------------------------------------------------------ +# Function: check_gpgkey +#------------------------------------------------------------------------------ +# +# check if the gpg key provided is known/available +# arguments: +# $1 - the gpg key +# returns: +# if it returns, everything is good +# otherwise it exit's +check_gpgkey() { + arg=$1 + + $GPG --list-keys "$arg" &>/dev/null + if [ $? -ne 0 ]; then + echo "" + echo "Error: the argument '$arg' is not a known gpg key." + echo "" + usage + exit 1 + fi +} + +#------------------------------------------------------------------------------ # Function: check_modules_specification #------------------------------------------------------------------------------ # @@ -272,7 +295,7 @@ sign_or_fail() { if [ -n "$1" ]; then sig=$1.sig rm -f $sig - $GPG -b $1 1>&2 + $GPG -b $GPGKEY $1 1>&2 if [ $? -ne 0 ]; then echo "Error: failed to sign $1." >&2 return 1 @@ -469,7 +492,7 @@ process_module() { else # Tag the top commit with the tar name if [ x"$DRY_RUN" = x ]; then - git tag -s -m $tag_name $tag_name + git tag $GPGKEY -s -m $tag_name $tag_name if [ $? -ne 0 ]; then echo "Error: unable to tag module with \"$tag_name\"." cd $top_src @@ -714,6 +737,7 @@ Options: --distcheck Default, ignored for compatibility --dry-run Does everything except tagging and uploading tarballs --force Force overwriting an existing release + --gpgkey <key> Specify the key used to sign the git tag/release tarballs --help Display this help and exit successfully --modfile <file> Release the git modules specified in <file> --moduleset <file> The jhbuild moduleset full pathname to be updated @@ -779,6 +803,13 @@ do --force) FORCE=yes ;; + # Allow user specified GPG key + --gpgkey) + check_option_args $1 $2 + shift + check_gpgkey $1 + GPGKEY="-u $1" + ;; # Display this help and exit successfully --help) usage -- 2.9.0 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
