From c326914167f1be1d4e1ccdd79a78cd92b96c15a1 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Wed, 3 May 2017 01:07:07 -0400 Subject: libredbdiff: inline the filenotfound function --- src/abslibre-tools/libredbdiff | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src') 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" -- cgit v1.2.3-54-g00ecf