[pacman-dev] [PATCH] repo-add: backup old database signature too

Allan McRae allan at archlinux.org
Tue Jul 5 00:05:51 EDT 2011


If you are keeping a copy of the old database, you probably want
to keep a copy of its signature too.  Also, delete the previously
backed-up database signature if no new one is being copied.

Signed-off-by: Allan McRae <allan at archlinux.org>
---
 scripts/repo-add.sh.in |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 415ad41..1d04d3b 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -642,7 +642,8 @@ if (( success )); then
 	create_signature "$tmpdir/$filename"
 
 	[[ -f $REPO_DB_FILE ]] && mv -f "$REPO_DB_FILE" "${REPO_DB_FILE}.old"
-	[[ -f $REPO_DB_FILE.sig ]] && rm -f "$REPO_DB_FILE.sig"
+	[[ -f $REPO_DB_FILE.sig ]] && mv -f "$REPO_DB_FILE.sig" "$REPO_DB_FILE.old.sig" || \
+		rm -f "$REPO_DB_FILE.old.sig"
 	[[ -f $tmpdir/$filename ]] && mv "$tmpdir/$filename" "$REPO_DB_FILE"
 	[[ -f $tmpdir/$filename.sig ]] && mv "$tmpdir/$filename.sig" "$REPO_DB_FILE.sig"
 	dblink="${REPO_DB_FILE%.tar*}"
-- 
1.7.6



More information about the pacman-dev mailing list