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>
This commit is contained in:
Allan McRae 2015-01-23 15:28:47 +10:00
parent 3c46420367
commit 660bd1caa1

View file

@ -715,12 +715,13 @@ if (( success )); then
if [[ -f $REPO_DB_FILE ]]; then if [[ -f $REPO_DB_FILE ]]; then
ln -f "$REPO_DB_FILE" "$REPO_DB_FILE.old" 2>/dev/null || \ ln -f "$REPO_DB_FILE" "$REPO_DB_FILE.old" 2>/dev/null || \
mv -f "$REPO_DB_FILE" "$REPO_DB_FILE.old" mv -f "$REPO_DB_FILE" "$REPO_DB_FILE.old"
fi
if [[ -f $REPO_DB_FILE.sig ]]; then if [[ -f $REPO_DB_FILE.sig ]]; then
ln -f "$REPO_DB_FILE.sig" "$REPO_DB_FILE.old.sig" 2>/dev/null || \ 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" mv -f "$REPO_DB_FILE.sig" "$REPO_DB_FILE.old.sig"
else else
rm -f "$REPO_DB_FILE.old.sig" rm -f "$REPO_DB_FILE.old.sig"
fi
fi fi
# rotate the newly-created database and signature into place # rotate the newly-created database and signature into place