summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsrc/abslibre-tools/libredbdiff30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/abslibre-tools/libredbdiff b/src/abslibre-tools/libredbdiff
index 64cf8eb..5ec3547 100755
--- a/src/abslibre-tools/libredbdiff
+++ b/src/abslibre-tools/libredbdiff
@@ -240,10 +240,9 @@ main() {
main_update() {
if [[ $EUID != 0 ]]; then
- die "To initialize %s or update %s pacman databases, %s must be run as root (without arguments). Nothing done." \
- "$name" \
- "$name" \
- "$cmd"
+ error "Must run as root to initialize or update %s databases." "$cmd"
+ usage >&2
+ exit 1
fi
check_vars libredbdiff statedir mirror_prbl mirror_arch || exit 1
@@ -299,20 +298,15 @@ main_update() {
main_compare() {
check_vars libredbdiff statedir repos || exit 1
- 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
+ if ! [[ -f "$conffile_prbl" && \
+ -f "$conffile_arch" && \
+ -f "$dbpath_prbl/sync/libre.db" && \
+ -f "$dbpath_arch/sync/core.db" ]]
+ then
+ error "You must run %q with out arguments as root to initialize." "$cmd"
+ usage >&2
+ exit 1
+ fi
local tmpdir
tmpdir="$(mktemp --tmpdir -d "$cmd.XXXXXXXXXX")" || die "Could not create temporary working directory"