diff options
author | Antoine Beaupré <anarcat@koumbit.org> | 2013-01-07 16:03:01 -0500 |
---|---|---|
committer | Antoine Beaupré <anarcat@koumbit.org> | 2013-01-07 16:03:01 -0500 |
commit | bce5cfbcd446477eb56f365035e86ecacdac6c6c (patch) | |
tree | 661474a38b3b86068a11523ac1a494f3fbe46704 /templates/reprepro-export-key.sh.erb | |
parent | f6bbb8ff44e6c56bba34efd8b053ae47114ee4bc (diff) | |
parent | 2060c2fd7aae1e377a9d0fcb7da02da64e4f8da5 (diff) |
Merge remote branch 'intrigeri/master' into dev
Diffstat (limited to 'templates/reprepro-export-key.sh.erb')
-rw-r--r-- | templates/reprepro-export-key.sh.erb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/templates/reprepro-export-key.sh.erb b/templates/reprepro-export-key.sh.erb index c99f06b..bbc195c 100644 --- a/templates/reprepro-export-key.sh.erb +++ b/templates/reprepro-export-key.sh.erb @@ -1,7 +1,18 @@ -#!/bin/bash +#!/bin/sh +# +# This file is managed by Puppet. Do not edit, any changes will be overwritten! +# -KEY="`gpg --homedir <%= basedir %>/.gnupg --with-colon --list-secret-keys | cut -d : -f 5 | head -n 1`" +set -e -if [ ! -z "$KEY" ]; then - gpg --homedir <%= basedir %>/.gnupg --export --armor $KEY > <%= basedir %>/key.asc +KEY="$(gpg --homedir '<%= @basedir %>/.gnupg' --with-colon --list-secret-keys | cut -d : -f 5 | head -n 1)" + +if [ -n "$KEY" ]; then + TEMPFILE=$(mktemp --tmpdir='<%= @basedir %>') + trap "rm -f '$TEMPFILE'" EXIT + DESTFILE='<%= @basedir %>/key.asc' + gpg --homedir '<%= @basedir %>/.gnupg' --export --armor "$KEY" > "$TEMPFILE" + mv "$TEMPFILE" "$DESTFILE" + chown reprepro:reprepro "$DESTFILE" + chmod 0664 "$DESTFILE" fi |