From 8d14b22260026ec3d567d6367f83b9ab580b6556 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Thu, 20 Jun 2024 13:21:16 +1000 Subject: [PATCH] repo-add: unconditionally create the database if it is missing In f91fa546 (repo-add: do not recreate the database if nothing was changed), repo-add was made to skip database write-out if there were no changes to the database. However, this breaks the usage of repo-add to create a new empty database: `repo-add /path/to/mydb/mydb.db.tar.xz`. Bring back support for this use-case by always writing the database if it is missing. Original-patch-by: Ivan Shapovalov Signed-off-by: Allan McRae --- scripts/repo-add.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index faa42fc1..61080848 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -705,7 +705,7 @@ if (( fail )); then exit 1 fi -if (( DB_MODIFIED )); then +if (( DB_MODIFIED )) || [[ ! -f $REPO_DB_FILE ]]; then msg "$(gettext "Creating updated database file '%s'")" "$REPO_DB_FILE" create_db rotate_db