aboutsummaryrefslogtreecommitdiffstats
path: root/modules/gnupg/templates
diff options
context:
space:
mode:
authorNicolas Vigier <boklm@mageia.org>2011-02-02 18:11:34 +0000
committerNicolas Vigier <boklm@mageia.org>2011-02-02 18:11:34 +0000
commit1cd967ce52c5c175d5b7246f728fea50be006e6c (patch)
tree6ae4b1064b5b73e05650487cec78ce895b80ddde /modules/gnupg/templates
parent83f2baffcc037c1ba32301c5157b5957ce0c9da7 (diff)
downloadpuppet-1cd967ce52c5c175d5b7246f728fea50be006e6c.tar
puppet-1cd967ce52c5c175d5b7246f728fea50be006e6c.tar.gz
puppet-1cd967ce52c5c175d5b7246f728fea50be006e6c.tar.bz2
puppet-1cd967ce52c5c175d5b7246f728fea50be006e6c.tar.xz
puppet-1cd967ce52c5c175d5b7246f728fea50be006e6c.zip
- allow selecting keyring directory and user
- make it possible to generate multiple keys in the same keyring
Diffstat (limited to 'modules/gnupg/templates')
-rw-r--r--modules/gnupg/templates/create_gnupg_keys.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/modules/gnupg/templates/create_gnupg_keys.sh b/modules/gnupg/templates/create_gnupg_keys.sh
index fbb41277..a2caba2d 100644
--- a/modules/gnupg/templates/create_gnupg_keys.sh
+++ b/modules/gnupg/templates/create_gnupg_keys.sh
@@ -1,11 +1,24 @@
#!/bin/bash
-NAME=$1
+BATCHFILE="$1"
+HOMEDIR="$2"
+LOCK="$3"
+
+test $# -eq 3 || exit 1
+
+if [ -e "$LOCK" ]
+then
+ echo "Lock file already exist." 1>&2
+ echo "Remove $LOCK if you want to regenerate key." 1>&2
+ exit 2
+fi
+
+touch "$LOCK"
/sbin/rngd -f -r /dev/urandom &
RAND=$!
-cd /etc/gnupg/keys/
-gpg --homedir /etc/gnupg/keys/ --batch --gen-key /etc/gnupg/batches/$NAME.batch
+cd $HOMEDIR
+gpg --homedir $HOMEDIR --batch --gen-key $BATCHFILE
EXIT=$?
kill $RAND