[pacman-dev] [PATCH 3/6] repo-add: check for valid key when signing is requested

Allan McRae allan at archlinux.org
Sun Apr 24 07:26:23 EDT 2011


Follow the example of makepkg

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 scripts/repo-add.sh.in |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 4f8ba2b..fade1e6 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -554,7 +554,17 @@ while [[ $# > 0 ]]; do
 		-q|--quiet) QUIET=1;;
 		-d|--delta) DELTA=1;;
 		-f|--files) WITHFILES=1;;
-		-s|--sign) SIGN=1;;
+		-s|--sign)
+			SIGN=1
+			if ! gpg --list-key ${GPGKEY} &>/dev/null; then
+				if [[ ! -z $GPGKEY ]]; then
+					error "$(gettext "The key ${GPGKEY} does not exist in your keyring.")"
+				else
+					error "$(gettext "There is no key in your keyring.")"
+				fi
+				exit 1
+			fi
+			;;
 		-k|--key)
 			shift
 			GPGKEY="$1"
-- 
1.7.4.4



More information about the pacman-dev mailing list