summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/pacman-key.sh.in6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index cf63be87..212d0fe1 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -95,7 +95,8 @@ There is NO WARRANTY, to the extent permitted by law.\n")"
# read the config file "$1" which has key=value pairs, and return the key which
# matches "$2". the equals sign between pairs may be surrounded by any amount
-# of whitespace.
+# of whitespace. Optionally, "$3" can be specified which is the default value
+# when no key is found.
get_from() {
while IFS='=' read -r key value; do
[[ -z $key || ${key:0:1} = '#' ]] && continue
@@ -105,6 +106,7 @@ get_from() {
return 0
fi
done < "$1"
+ printf '%s\n' "$3"
return 1
}
@@ -437,7 +439,7 @@ fi
# 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")}
+PACMAN_KEYRING_DIR=${PACMAN_KEYRING_DIR:-$(get_from "$CONFIG" "GPGDir" "@sysconfdir@/pacman.d/gnupg")}
GPG_PACMAN=(gpg --homedir ${PACMAN_KEYRING_DIR} --no-permission-warning)
if [[ -n ${KEYSERVER} ]]; then