summaryrefslogtreecommitdiff
path: root/src/abslibre-tools
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-05-03 01:07:07 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-05-03 01:39:16 -0400
commitc326914167f1be1d4e1ccdd79a78cd92b96c15a1 (patch)
tree52a6185df9986b6d6e23e50eb97fc2dfe1eacfd4 /src/abslibre-tools
parent04f392eda74ccafeec512c28ebadb8932e320830 (diff)
libredbdiff: inline the filenotfound function
Diffstat (limited to 'src/abslibre-tools')
-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"