diff options
Diffstat (limited to 'trunk/lib')
-rw-r--r-- | trunk/lib/common.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/trunk/lib/common.sh b/trunk/lib/common.sh index d516448..53fc0f2 100644 --- a/trunk/lib/common.sh +++ b/trunk/lib/common.sh @@ -1089,6 +1089,35 @@ function gen_meta { } +function repo_gpg_key { + + # usage: repo_gpg_key <folder> + + local folder="$1" + + if [ $SIGN_PACKAGES -eq $on ]; then + if [ -f "$folder/GPG-KEY" ]; then + if ! gpg --with-colons < $folder/GPG-KEY | cut -d : -f 5 | grep -q -e "$SIGN_KEYID$"; then + echo "Adding OpenPGP key id $SIGN_KEYID to $folder/GPG-KEY file..." + if [ ! -z "$SIGN_PACKAGES_USER" ]; then + su $SIGN_PACKAGES_USER -c "gpg --export --armor $SIGN_KEY_ID" >> $folder/GPG-KEY + else + gpg --export --armor $SIGN_KEY_ID >> $folder/GPG-KEY + fi + fi + else + echo "Adding OpenPGP key id $SIGN_KEYID to $folder/GPG-KEY file..." + if [ ! -z "$SIGN_PACKAGES_USER" ]; then + su $SIGN_PACKAGES_USER -c "gpg --export --armor $SIGN_KEY_ID" > $folder/GPG-KEY + else + gpg --export --armor $SIGN_KEY_ID > $folder/GPG-KEY + fi + fi + svn_add $folder/GPG-KEY + fi + +} + # ----------------------------------------------- # Error functions # ----------------------------------------------- @@ -1332,3 +1361,25 @@ function is_the_same { fi } + +function check_gnupg { + + # check if there's a keyring + # usage: check_gnupg [username] + + local user="$1" home + + if [ ! -z "$user" ]; then + echo "Setting up gnupg..." + home="`grep "^$user:" /etc/passwd | cut -d : -f 6`" + if [ ! -d "$home/.gnupg" ]; then + su $user -c "gpg --list-keys" + fi + else + if [ ! -d "$HOME/.gnupg" ]; then + echo "Setting up gnupg..." + gpg --list-keys + fi + fi + +} |