summaryrefslogtreecommitdiff
path: root/src/abslibre-tools/libredbdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/abslibre-tools/libredbdiff')
-rwxr-xr-xsrc/abslibre-tools/libredbdiff27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/abslibre-tools/libredbdiff b/src/abslibre-tools/libredbdiff
index 4d7fca2..dc479d4 100755
--- a/src/abslibre-tools/libredbdiff
+++ b/src/abslibre-tools/libredbdiff
@@ -89,15 +89,6 @@ setmirror() {
fi
}
-filenotfound() {
- local file=$1
- if [[ ! -r "$1" ]]; then
- error "Could not read %q." "$file"
- die "Nothing done. It may be necessary to run %q without \
-arguments as root to initialize %s." "$cmd" "$name"
- fi
-}
-
initialize() {
createdir "$statedir"
@@ -348,10 +339,20 @@ main_compare() {
if true; then
check_vars libredbdiff statedir repos || exit 1
- filenotfound "$dbpath_prbl/sync/libre.db"
- filenotfound "$dbpath_arch/sync/core.db"
- filenotfound "$conffile_prbl"
- filenotfound "$conffile_arch"
+ local conffiles=(
+ "$dbpath_prbl/sync/libre.db"
+ "$dbpath_arch/sync/core.db"
+ "$conffile_prbl"
+ "$conffile_arch"
+ )
+ local file
+ for file in "${conffiles[@]}"; do
+ if ! [[ -f "$file" && -r "$file" ]]; then
+ error "Could not read %q." "$file"
+ die "Nothing done. It may be necessary to run %q without \
+arguments as root to initialize %s." "$cmd" "$name"
+ fi
+ done
local tmpdir
tmpdir="$(mktemp --tmpdir -d "$cmd.XXXXXXXXXX")" || die "Could not create temporary working directory"