From 660bd1caa1a0e39dd23f66cc853de963d20058d8 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Fri, 23 Jan 2015 15:28:47 +1000 Subject: repo-add: only backup database signature if database was backed up Ensures the backed update database and its signature are always consistent. Signed-off-by: Allan McRae --- scripts/repo-add.sh.in | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'scripts/repo-add.sh.in') diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 183fa41f..0da34b82 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -715,12 +715,13 @@ if (( success )); then if [[ -f $REPO_DB_FILE ]]; then ln -f "$REPO_DB_FILE" "$REPO_DB_FILE.old" 2>/dev/null || \ mv -f "$REPO_DB_FILE" "$REPO_DB_FILE.old" - fi - if [[ -f $REPO_DB_FILE.sig ]]; then - ln -f "$REPO_DB_FILE.sig" "$REPO_DB_FILE.old.sig" 2>/dev/null || \ - mv -f "$REPO_DB_FILE.sig" "$REPO_DB_FILE.old.sig" - else - rm -f "$REPO_DB_FILE.old.sig" + + if [[ -f $REPO_DB_FILE.sig ]]; then + ln -f "$REPO_DB_FILE.sig" "$REPO_DB_FILE.old.sig" 2>/dev/null || \ + mv -f "$REPO_DB_FILE.sig" "$REPO_DB_FILE.old.sig" + else + rm -f "$REPO_DB_FILE.old.sig" + fi fi # rotate the newly-created database and signature into place -- cgit v1.2.3-54-g00ecf