summaryrefslogtreecommitdiffstats
path: root/scripts/pacman-db-upgrade.sh.in
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2018-01-13 17:50:00 +0100
committerAllan McRae <allan@archlinux.org>2018-01-19 03:02:11 +0100
commitd9eda13fc69eb0bfbbab6d7488e99e5c7b033d3a (patch)
tree681851b33b419c35171825f5eb5b5112cb4f8a43 /scripts/pacman-db-upgrade.sh.in
parent170bb80a1f8a020595738c7febdb15c68574ce29 (diff)
downloadpacman-d9eda13fc69eb0bfbbab6d7488e99e5c7b033d3a.tar.gz
pacman-d9eda13fc69eb0bfbbab6d7488e99e5c7b033d3a.tar.xz
use pacman-conf in scripts
Because parsing pacman.conf is so difficult that even we can't do it right. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/pacman-db-upgrade.sh.in')
-rw-r--r--scripts/pacman-db-upgrade.sh.in21
1 files changed, 2 insertions, 19 deletions
diff --git a/scripts/pacman-db-upgrade.sh.in b/scripts/pacman-db-upgrade.sh.in
index a6ff3b25..0629cc1c 100644
--- a/scripts/pacman-db-upgrade.sh.in
+++ b/scripts/pacman-db-upgrade.sh.in
@@ -70,18 +70,6 @@ die_r() {
die "$@"
}
-get_opt_from_config() {
- local keyname="$1" conffile="$2"
- local key value
-
- while IFS=$'= \t' read -r key value _; do
- if [[ $key = $keyname ]]; then
- echo "$value"
- return
- fi
- done <"$conffile"
-}
-
resolve_dir() {
local d="$(cd "$1"; pwd -P)"
[[ $d == */ ]] || d+=/
@@ -121,13 +109,8 @@ while true; do
done
conffile=${conffile:-@sysconfdir@/pacman.conf}
-[[ -z $pacroot ]] && pacroot="$(get_opt_from_config "RootDir" "$conffile")"
-[[ -z $dbroot ]] && dbroot="$(get_opt_from_config "DBPath" "$conffile")"
-
-[[ -z $dbroot && -n $pacroot ]] && dbroot="$pacroot/@localstatedir@/lib/pacman"
-
-[[ -z $pacroot ]] && pacroot="@rootdir@"
-[[ -z $dbroot ]] && dbroot="@localstatedir@/lib/pacman/"
+[[ -z $pacroot ]] && pacroot=$(pacman-conf --config="$conffile" rootdir)
+[[ -z $dbroot ]] && dbroot=$(pacman-conf --config="$conffile" --rootdir="$pacroot" dbpath)
m4_include(library/term_colors.sh)