[pacman-dev] [PATCH 4/6] repo-add: only backup database signature if database was backed up
Allan McRae
allan at archlinux.org
Fri Jan 23 07:36:22 UTC 2015
Ensures the backed update database and its signature are always consistent.
Signed-off-by: Allan McRae <allan at archlinux.org>
---
scripts/repo-add.sh.in | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 183fa41..0da34b8 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
--
2.2.2
More information about the pacman-dev
mailing list