summaryrefslogtreecommitdiff
path: root/files
diff options
context:
space:
mode:
authorAntoine Beaupré <anarcat@koumbit.org>2013-01-07 17:57:39 -0500
committerAntoine Beaupré <anarcat@koumbit.org>2013-01-07 17:57:39 -0500
commite97486db5fae20a5a1c601e86b7a7f3763e1c1c5 (patch)
treeb85fe854a88df265dbfdca33a2afd7b02e5c33e1 /files
parentf0d3b2209e3b629c5442bd25d28a5bc855229723 (diff)
make the key script support multiple repositories
Diffstat (limited to 'files')
-rw-r--r--files/reprepro-export-key.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/files/reprepro-export-key.sh b/files/reprepro-export-key.sh
new file mode 100644
index 0000000..6e0b278
--- /dev/null
+++ b/files/reprepro-export-key.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# This file is managed by Puppet. Do not edit, any changes will be overwritten!
+#
+
+set -e
+
+BASEDIR="$1"
+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