summaryrefslogtreecommitdiff
path: root/src/abslibre-tools
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-05-03 01:27:05 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-05-03 01:44:07 -0400
commit5b337b9c78da680bdf0557a4b5b68efe14508dad (patch)
tree48f18af613e7c3d17b591ae9ca3d3ed7dd359ca9 /src/abslibre-tools
parentfdc8e7c5e958da2a01e6284b9eb3846d18c8830f (diff)
libredbdiff: messages
Diffstat (limited to 'src/abslibre-tools')
-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"