From 78ce35ce97ffc887f0786289789bec8f9880ca9c Mon Sep 17 00:00:00 2001 From: intrigeri Date: Mon, 2 Jul 2012 18:05:04 +0200 Subject: Use a temporary file + atomic move when exporting the repository public key. --- templates/reprepro-export-key.sh.erb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'templates') diff --git a/templates/reprepro-export-key.sh.erb b/templates/reprepro-export-key.sh.erb index c99f06b..1afcef8 100644 --- a/templates/reprepro-export-key.sh.erb +++ b/templates/reprepro-export-key.sh.erb @@ -3,5 +3,7 @@ KEY="`gpg --homedir <%= basedir %>/.gnupg --with-colon --list-secret-keys | cut -d : -f 5 | head -n 1`" if [ ! -z "$KEY" ]; then - gpg --homedir <%= basedir %>/.gnupg --export --armor $KEY > <%= basedir %>/key.asc + tempfile=$(mktemp) + gpg --homedir <%= basedir %>/.gnupg --export --armor $KEY > "$tempfile" + mv "$tempfile" <%= basedir %>/key.asc fi -- cgit v1.2.3