From 9bdbd82aa16d3ff0b4cd2828adde49a73c3f1c9b Mon Sep 17 00:00:00 2001 From: rhatto Date: Thu, 22 Jan 2009 01:55:26 +0000 Subject: more changes towards #41 completion git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@766 04377dda-e619-0410-9926-eae83683ac58 --- trunk/lib/common.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'trunk/lib') diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh index cc63bc6..c3b09d6 100644 --- a/trunk/lib/common.sh +++ b/trunk/lib/common.sh @@ -1686,6 +1686,42 @@ function get_sign_user { } +function update_keyring { + + # update keyring using GPG-KEY from a repository + # usage: update_keyring + + local keyring keys key + + keyring="$1" + + if [ ! -e "$keyring" ]; then + repo_gpg_key $MKBUILDS_DIR + return + fi + + keys="`gpg --with-colons $keyring | cut -d : -f 5 | sed -e '/^$/d'`" + + for key in $keys; do + if [ ! -z "$SIGN_USER" ] && [ "`whoami`" != "$SIGN_USER" ]; then + su $SIGN_USER -c "gpg --list-keys $key &> /dev/null" + if [ "$?" != "0" ]; then + echo "Updating keyring using $keyring..." + su $SIGN_USER -c "gpg --import $keyring" + break + fi + else + gpg --list-keys $key &> /dev/null + if [ "$?" != "0" ]; then + echo "Updating keyring using $keyring..." + gpg --import $keyring + break + fi + fi + done + +} + function rmd160sum { # computes RIPEMD-160 message digest -- cgit v1.2.3