pacman-optimize: ensure database directory contains local/

And also default dbpath to the one we may find in pacman.conf.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2010-12-12 21:40:24 -06:00
parent d98bacd4ec
commit 13a2847aa1

View file

@ -25,7 +25,9 @@ export TEXTDOMAIN='pacman'
export TEXTDOMAINDIR='@localedir@' export TEXTDOMAINDIR='@localedir@'
myver='@PACKAGE_VERSION@' myver='@PACKAGE_VERSION@'
dbroot='@localstatedir@/lib/pacman/'
eval $(awk '/DBPath/ {print $1$2$3}' @sysconfdir@/pacman.conf)
dbroot="${DBPath:-@localstatedir@/lib/pacman/}"
msg() { msg() {
local mesg=$1; shift local mesg=$1; shift
@ -99,7 +101,7 @@ if ! type diff >/dev/null 2>&1; then
die "$(gettext "diff tool was not found, please install diffutils.")" die "$(gettext "diff tool was not found, please install diffutils.")"
fi fi
if [[ ! -d $dbroot ]]; then if [[ ! -d $dbroot || ! -d $dbroot/local ]]; then
die "$(gettext "%s does not exist or is not a directory.")" "$dbroot" die "$(gettext "%s does not exist or is not a directory.")" "$dbroot"
fi fi