pacman-key: allow overriding KEYRING_IMPORT_DIR with --populate-from
Signed-off-by: InsanePrawn <insane.prawny@gmail.com> Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
717e5e9157
commit
36d70a93e2
1 changed files with 6 additions and 2 deletions
|
@ -84,6 +84,8 @@ usage() {
|
||||||
'%s')")\n" "@sysconfdir@/pacman.conf"
|
'%s')")\n" "@sysconfdir@/pacman.conf"
|
||||||
printf -- "$(gettext " --gpgdir <dir> Set an alternate directory for GnuPG (instead\n\
|
printf -- "$(gettext " --gpgdir <dir> Set an alternate directory for GnuPG (instead\n\
|
||||||
of '%s')")\n" "@sysconfdir@/pacman.d/gnupg"
|
of '%s')")\n" "@sysconfdir@/pacman.d/gnupg"
|
||||||
|
printf -- "$(gettext " --populate-from <dir> Set an alternate directory for --populate (instead\n\
|
||||||
|
of '%s')")\n" "@keyringdir@"
|
||||||
printf -- "$(gettext " --keyserver <server-url> Specify a keyserver to use if necessary")\n"
|
printf -- "$(gettext " --keyserver <server-url> Specify a keyserver to use if necessary")\n"
|
||||||
echo
|
echo
|
||||||
printf -- "$(gettext " -h, --help Show this help message and exit")\n"
|
printf -- "$(gettext " -h, --help Show this help message and exit")\n"
|
||||||
|
@ -283,7 +285,6 @@ check_keyring() {
|
||||||
}
|
}
|
||||||
|
|
||||||
populate_keyring() {
|
populate_keyring() {
|
||||||
local KEYRING_IMPORT_DIR='@keyringdir@'
|
|
||||||
|
|
||||||
local keyring KEYRINGIDS=("$@")
|
local keyring KEYRINGIDS=("$@")
|
||||||
local ret=0
|
local ret=0
|
||||||
|
@ -625,7 +626,7 @@ fi
|
||||||
OPT_SHORT="adefhlruvV"
|
OPT_SHORT="adefhlruvV"
|
||||||
OPT_LONG=('add' 'config:' 'delete' 'edit-key' 'export' 'finger' 'gpgdir:'
|
OPT_LONG=('add' 'config:' 'delete' 'edit-key' 'export' 'finger' 'gpgdir:'
|
||||||
'help' 'import' 'import-trustdb' 'init' 'keyserver:' 'list-keys' 'list-sigs'
|
'help' 'import' 'import-trustdb' 'init' 'keyserver:' 'list-keys' 'list-sigs'
|
||||||
'lsign-key' 'nocolor' 'populate' 'recv-keys' 'refresh-keys' 'updatedb'
|
'lsign-key' 'nocolor' 'populate' 'populate-from:' 'recv-keys' 'refresh-keys' 'updatedb'
|
||||||
'verbose' 'verify' 'version')
|
'verbose' 'verify' 'version')
|
||||||
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
|
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
|
||||||
exit 1 # E_INVALID_OPTION
|
exit 1 # E_INVALID_OPTION
|
||||||
|
@ -647,6 +648,7 @@ while (( $# )); do
|
||||||
-e|--export) EXPORT=1 ;;
|
-e|--export) EXPORT=1 ;;
|
||||||
-f|--finger) FINGER=1 ;;
|
-f|--finger) FINGER=1 ;;
|
||||||
--gpgdir) shift; PACMAN_KEYRING_DIR=$1 ;;
|
--gpgdir) shift; PACMAN_KEYRING_DIR=$1 ;;
|
||||||
|
--populate-from) shift; KEYRING_IMPORT_DIR=$1 ;;
|
||||||
--import) IMPORT=1 UPDATEDB=1 ;;
|
--import) IMPORT=1 UPDATEDB=1 ;;
|
||||||
--import-trustdb) IMPORT_TRUSTDB=1 UPDATEDB=1 ;;
|
--import-trustdb) IMPORT_TRUSTDB=1 UPDATEDB=1 ;;
|
||||||
--init) INIT=1 ;;
|
--init) INIT=1 ;;
|
||||||
|
@ -693,6 +695,8 @@ if [[ ! -r "${CONFIG}" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
KEYRING_IMPORT_DIR=${KEYRING_IMPORT_DIR:-"@keyringdir@"}
|
||||||
|
|
||||||
# if PACMAN_KEYRING_DIR isn't assigned, try to get it from the config
|
# if PACMAN_KEYRING_DIR isn't assigned, try to get it from the config
|
||||||
# file, falling back on a hard default
|
# file, falling back on a hard default
|
||||||
PACMAN_KEYRING_DIR=${PACMAN_KEYRING_DIR:-$(pacman-conf --config="$CONFIG" gpgdir)}
|
PACMAN_KEYRING_DIR=${PACMAN_KEYRING_DIR:-$(pacman-conf --config="$CONFIG" gpgdir)}
|
||||||
|
|
Loading…
Add table
Reference in a new issue