source: main/trunk/package-kits/linux/repos/gpg@ 29690

Last change on this file since 29690 was 29690, checked in by Jeremy Symon, 9 years ago

Created repos folder. This folder contains scripts for managing package repositories for different package managers

  • Property svn:executable set to *
File size: 1.4 KB
Line 
1#!/bin/sh
2
3. $(dirname $0)/conf.sh
4
5mkdir -p $repos || exit 1
6
7test -f "$repos/gpg.key" || {
8 tmpfile="/tmp/greenstone-gpg-$(date +%s)"
9 if y "GPG key missing. Generate new GPG key"; then
10 echo
11 y "Show suggested (more secure) GPG config" && echo "Append the following to ~/.gnupg/gpg.conf:
12
13 # Prioritize stronger algorithms for new keys.
14 default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 BZIP2 ZLIB ZIP Uncompressed
15 # Use a stronger digest than the default SHA1 for certifications.
16 cert-digest-algo SHA512
17 "
18 echo
19 # hack to get the output in order to get the keyid
20 gpg --gen-key | tee $tmpfile
21 keyid=$(tail -2 $tmpfile | head -1 | awk -F'[/ ]' '{print $5}')
22 rm -f $tmpfile
23 else
24 echo
25 if test -f $base/gpg.key.id && y "Existing Key-id file found. Use that"; then
26 keyid=$(cat $base/gpg.key.id)
27 else
28 gpg --list-keys
29 echo "Enter the keyid of the GPG key to use:"
30 while test -z $keyid; do
31 echo -n "> "
32 read keyid
33 done
34 fi
35 fi
36 echo "Adding gpg public key"
37 tmpfile="/tmp/greenstone-gpg-$(date +%s)"
38 gpg --armor --output $tmpfile --export $keyid || exit 1
39 cp $tmpfile $repos/gpg.key
40 rm -f $tmpfile
41 echo $keyid > $base/gpg.key.id
42}
43
Note: See TracBrowser for help on using the repository browser.