Skip to content

Commit

Permalink
Merge pull request #2 from YOCKOW/development
Browse files Browse the repository at this point in the history
Fix a bug related to `--pgp` parameter.
  • Loading branch information
YOCKOW authored Nov 22, 2021
2 parents 611fc94 + 8c198a3 commit 66dbf14
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
12 changes: 10 additions & 2 deletions bin/dlx
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ if [[ -n "${parsed_arguments[(i)--pgp]}" ]]; then
fatal_error "PGP tool not found"
fi

local -r pgp_signature_url="${parsed_arguments[--pgp]}"
local -r pgp_signature_url="${parsed_arguments[--pgp]#=}"
verbose_print "PGP Signature URL: $pgp_signature_url"
verifiers[$pgp_verifier_key]="$pgp_signature_url"
fi
Expand Down Expand Up @@ -670,10 +670,18 @@ function () {
else
pgp_signature_ext="asc"
fi

local -r pgp_signature_filename="${last_path_component}.${pgp_signature_ext}"
local -r pgp_signature_file_path="$(dirname "$local_file_path")/$pgp_signature_filename"
local -r pgp_signature_file_path="$(mktemp -d)/$pgp_signature_filename"

set +e
curl -s -L "$pgp_signature_url" -o "$pgp_signature_file_path"
if [[ $? -eq 0 && -f "$pgp_signature_file_path" ]]; then
verbose_print "PGP Signature was downloaded at \"$pgp_signature_file_path\""
else
fatal_error "Cannot fetch PGP Signature from \"$pgp_signature_url\""
fi
set -e

if pgp_verify "$local_file_path" "$pgp_signature_file_path"; then
quiet_print "PGP: ✅ OK" 1>&2
Expand Down
11 changes: 6 additions & 5 deletions utils/run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ local has_public_key=true
if ! gpg --list-keys $public_key_id 1>/dev/null 2>&1; then
echo "Import YOCKOW's Public Key (Temporarily)"
has_public_key=false

pub_key_file=$(mktemp)
curl -s -L "https://GitHub.com/YOCKOW.gpg" -o "$pub_key_file"
gpg --import "$pub_key_file"
gpg --fetch-keys "https://GitHub.com/YOCKOW.gpg"
fi

local test_result=-1
SSTest "${repo_dir}/tests"
test_result=$?

if [[ "$has_public_key" != "true" && ! -v GITHUB_ACTIONS ]]; then
gpg --yes --delete-keys $public_key_id
fi
fi

return $test_result

0 comments on commit 66dbf14

Please sign in to comment.