summaryrefslogtreecommitdiff
path: root/templates/reprepro-export-key.sh.erb
blob: eee173164ae447ef6cbfc43703d99b53f9f11edf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/bash

KEY="`gpg --homedir <%= @basedir %>/.gnupg --with-colon --list-secret-keys | cut -d : -f 5 | head -n 1`"

if [ ! -z "$KEY" ]; then
  tempfile=$(mktemp)
  destfile=<%= @basedir %>/key.asc
  gpg --homedir <%= @basedir %>/.gnupg --export --armor $KEY > "$tempfile"
  mv    "$tempfile"       "$destfile"
  chown reprepro:reprepro "$destfile"
  chmod 0664              "$destfile"
fi