summaryrefslogtreecommitdiff
path: root/scripts/pacman-optimize.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/pacman-optimize.sh.in')
-rw-r--r--scripts/pacman-optimize.sh.in12
1 files changed, 7 insertions, 5 deletions
diff --git a/scripts/pacman-optimize.sh.in b/scripts/pacman-optimize.sh.in
index 78b2345b..4e2a328a 100644
--- a/scripts/pacman-optimize.sh.in
+++ b/scripts/pacman-optimize.sh.in
@@ -1,9 +1,9 @@
-#!/bin/bash
+#!@BASH_SHELL@
#
# pacman-optimize
# @configure_input@
#
-# Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>
+# Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>
# Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
#
# This program is free software; you can redistribute it and/or modify
@@ -25,7 +25,9 @@ export TEXTDOMAIN='pacman'
export TEXTDOMAINDIR='@localedir@'
myver='@PACKAGE_VERSION@'
-dbroot='@localstatedir@/lib/pacman/'
+
+eval $(awk '/DBPath/ {print $1$2$3}' @sysconfdir@/pacman.conf)
+dbroot="${DBPath:-@localstatedir@/lib/pacman/}"
msg() {
local mesg=$1; shift
@@ -55,7 +57,7 @@ does not have to move around the disk as much.\n")"
version() {
printf "pacman-optimize (pacman) %s\n" "$myver"
printf "$(gettext "\
-Copyright (c) 2006-2010 Pacman Development Team <pacman-dev@archlinux.org>.\n\
+Copyright (c) 2006-2011 Pacman Development Team <pacman-dev@archlinux.org>.\n\
Copyright (C) 2002-2006 Judd Vinet <jvinet@zeroflux.org>.\n\n\
This is free software; see the source for copying conditions.\n\
There is NO WARRANTY, to the extent permitted by law.\n")"
@@ -99,7 +101,7 @@ if ! type diff >/dev/null 2>&1; then
die "$(gettext "diff tool was not found, please install diffutils.")"
fi
-if [[ ! -d $dbroot ]]; then
+if [[ ! -d $dbroot || ! -d $dbroot/local ]]; then
die "$(gettext "%s does not exist or is not a directory.")" "$dbroot"
fi