summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2015-01-23 15:28:47 +1000
committerAllan McRae <allan@archlinux.org>2015-02-12 13:35:31 +1000
commit660bd1caa1a0e39dd23f66cc853de963d20058d8 (patch)
tree5f67ea81fafced9337d1548b8b51496fb3f209a9
parent3c464203673060e762102414290d857c5fc37944 (diff)
downloadpacman-660bd1caa1a0e39dd23f66cc853de963d20058d8.tar.xz
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 <allan@archlinux.org>
-rw-r--r--scripts/repo-add.sh.in13
1 files changed, 7 insertions, 6 deletions
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