From 0be9e4a4cd2c6a5d5c5246c8dc269931e883c1fe Mon Sep 17 00:00:00 2001
From: Dave Reisner <dreisner@archlinux.org>
Date: Sat, 9 Jul 2011 12:48:41 +1000
Subject: pacman-key: tidy up logic for finding pacman keyring directory

Signed-off-by: Allan McRae <allan@archlinux.org>
---
 scripts/pacman-key.sh.in | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

(limited to 'scripts')

diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index 0ce0ea24..79bf41a8 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -300,11 +300,9 @@ if [[ ! -r "${CONFIG}" ]]; then
 	exit 1
 fi
 
-# Get GPGDIR from pacman.conf iff not specified on command line
-if [[ -z PACMAN_KEYRING_DIR && GPGDIR="$(get_from "$CONFIG" "GPGDir")" == 0 ]]; then
-	PACMAN_KEYRING_DIR="${GPGDIR}"
-fi
-PACMAN_KEYRING_DIR=${PACMAN_KEYRING_DIR:-@sysconfdir@/pacman.d/gnupg}
+# if PACMAN_KEYRING_DIR isn't assigned, try to get it from the config
+# file, falling back on a hard default
+PACMAN_KEYRING_DIR=${PACMAN_KEYRING_DIR:-$(get_from "$CONFIG" "GPGDir" || echo "@sysconfdir@/pacman.d/gnupg")}
 
 # Try to create $PACMAN_KEYRING_DIR if non-existent
 # Check for simple existence rather than for a directory as someone may want
-- 
cgit v1.2.3-70-g09d2