[pacman-dev] [PATCH v3] pacman-key: Add --import and --import-trustdb

Allan McRae allan at archlinux.org
Tue Jul 19 09:14:04 EDT 2011


On 19/07/11 22:52, Pang Yan Han wrote:
> Currently, pacman-key allows the user to import their keys using the --add
> option. However, no similar functionality exists for importing ownertrust
> values.
>
> The --import-trustdb option takes a list of directories and imports ownertrust
> values if the directories have a trustdb.gpg database.
>
> The --import option takes a list of directories and imports keys from
> pubring.gpg and ownertrust values from trustdb.gpg. Think of it as a combination
> of --add and --import-trustdb
>
> Signed-off-by: Pang Yan Han<pangyanhan at gmail.com>
> ---

Great to have this working now.   Looks almost good to go apart from:

<snip>

> +# Globals
> +TMP_TRUSTDB='tmp_trustdb.gpg'
> +

Yuck!  Lets kill that....

<snip>

>
> +import_trustdb() {
> +	local importdir

local trustdb=$(mktemp)

and then replacing ${TMP_TRUSTDB} with ${trustdb} thoughtout here.

> +	${GPG_PACMAN} --export-ownertrust>  ${TMP_TRUSTDB}
> +
> +	for importdir in "${IMPORT_DIRS[@]}"; do
> +		if [[ -f "${importdir}/trustdb.gpg" ]]; then
> +			gpg --homedir "${importdir}" --export-ownertrust>>  ${TMP_TRUSTDB}
> +		fi
> +	done
> +
> +	${GPG_PACMAN} --import-ownertrust ${TMP_TRUSTDB}
> +	rm -f ${TMP_TRUSTDB}
> +}


I can make that change as I pull this to my working branch later this week.

Allan


More information about the pacman-dev mailing list