Skip to content
This repository was archived by the owner on Dec 11, 2019. It is now read-only.

Commit 7e6af22

Browse files
committed
Merge pull request #10193 from brave/presign_rpm
Add option to presign rpm before upload_to_rpm_repo script
1 parent 2ca81b8 commit 7e6af22

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

tools/upload_to_rpm_repo

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
set -exu
33

44
BUCKET=${1:-brave-rpm-nightly}
5-
GPG_KEY=${2:-4A1B4360}
5+
GPG_KEY_ID=${2:-4A1B4360}
6+
GPG_KEY_SHORT_ID=${GPG_KEY_ID:(-8)}
67
KEY_NAME=keys.asc
78
KEY_FILE=/tmp/${KEY_NAME}
89
TMP_REPO=/tmp/rpm_repo
@@ -14,7 +15,14 @@ echo "%_signature gpg
1415

1516
rm -rf $TMP_REPO
1617
mkdir -pv $TMP_REPO/x86_64
17-
env GPG_PASS=$PASSPHRASE ./tools/auto_rpm_sign
18+
if !rpm --checksig dist/*.rpm | grep pgp; then
19+
env GPG_PASS=$PASSPHRASE ./tools/auto_rpm_sign
20+
rpm --checksig dist/*.rpm | grep pgp
21+
fi
22+
# Ensure the rpm has the correct signature before continuing
23+
# NOTE: rpm displays the short key id, all lower case
24+
rpm -v -K dist/*.rpm | grep "key ID ${GPG_KEY_SHORT_ID,,}: OK"
25+
1826
cp dist/*.rpm $TMP_REPO/x86_64/
1927

2028
for arch in $TMP_REPO/x86_64 ; do
@@ -24,8 +32,7 @@ for arch in $TMP_REPO/x86_64 ; do
2432
createrepo -v --update --deltas $arch/
2533
done
2634

27-
gpg --export --armor ${GPG_KEY} > ${KEY_FILE}
35+
gpg --export --armor ${GPG_KEY_ID} > ${KEY_FILE}
2836
aws s3 cp ${KEY_FILE} s3://${BUCKET}/keys.asc
2937
aws s3api put-object-acl --acl public-read --bucket ${BUCKET} --key ${KEY_NAME}
3038
aws s3 sync --acl public-read $TMP_REPO/ s3://$BUCKET/
31-
rpm --checksig ./dist/*.rpm

0 commit comments

Comments
 (0)