summaryrefslogtreecommitdiff
path: root/gen-new-key
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-04-09 10:57:52 +0200
committerErich Eckner <git@eckner.net>2018-04-09 10:57:52 +0200
commit539cf905df8ba4b16afd3e01584401fbec2186cc (patch)
tree57014451fdeeb97892757ba189e0300d260b6c1d /gen-new-key
parent0e0036310c65bffcbc67b6533d517e66cbdfa546 (diff)
downloadarchlinuxewe-539cf905df8ba4b16afd3e01584401fbec2186cc.tar.xz
gen-new-key neu zum Erzeugen der gpg-Schlüssel
Diffstat (limited to 'gen-new-key')
-rwxr-xr-xgen-new-key49
1 files changed, 49 insertions, 0 deletions
diff --git a/gen-new-key b/gen-new-key
new file mode 100755
index 000000000..f1268814c
--- /dev/null
+++ b/gen-new-key
@@ -0,0 +1,49 @@
+#!/bin/bash
+
+verwendung() {
+ printf 'Verwendung:\n'
+ printf ' gen-new-key packager\n'
+ printf ' generiere neuen Packager-Schlüssel\n'
+ printf ' gen-new-key repo\n'
+ printf ' generiere neuen Repository-Schlüssel\n'
+ exit 1
+}
+
+if [ $# -ne 1 ]; then
+ verwendung
+fi
+
+if [ "$1" = 'packager' ]; then
+ comment='just to sign arch packages'
+elif [ "$1" = 'repo' ]; then
+ comment='just to sign arch repos'
+else
+ verwendung
+fi
+
+if ! gpg --list-secret-keys "${comment}" >/dev/null 2>&1; then
+ printf 'There is no secret key yet with comment "%s" - I guess, you are running this on the wrong box.\n' "${comment}"
+ exit 1
+fi
+
+{
+ printf '%s\n' \
+ '%echo Generating a basic OpenPGP key' \
+ 'Key-Type: RSA' \
+ 'Key-Length: 4096' \
+ 'Key-Usage: sign' \
+ 'Subkey-Type: RSA' \
+ 'Subkey-Length: 4096' \
+ 'Subkey-Usage: sign' \
+ 'Name-Real: Erich Eckner'
+ printf 'Name-Comment: %s\n' \
+ "${comment}"
+ printf '%s\n' \
+ 'Name-Email: arch@eckner.net' \
+ 'Expire-Date: 2y' \
+ '%no-protection' \
+ '%no-ask-passphrase' \
+ '%commit' \
+ '%echo done'
+} | \
+ gpg --gen-key --batch