fix missing changes
All checks were successful
continuous-integration/drone/tag Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
Paolo Asperti 2019-04-25 11:54:04 +02:00
commit 00ecd91844
Signed by: paspo
GPG Key ID: 06D46905D19D5182

21
run.sh
View File

@ -22,19 +22,20 @@ echo "${PLUGIN_GPG_KEY}" > /key.asc
eval $(gpg-agent --daemon --allow-preset-passphrase)
# retrieving key ID and GRIP
ID=$(gpg --with-colons /key.asc 2>/dev/null | grep "^sec" | head -n 1 | cut -d\: -f 5 )
GRIP=$(gpg --with-colons --import-options show-only --import /key.asc 2>/dev/null | grep '^grp' | head -n 1 | cut -d\: -f 10 )
ID=$(gpg2 --with-colons /key.asc 2>/dev/null | grep "^pub" | head -n 1 | cut -d\: -f 5 )
GRIP=$(gpg2 --with-colons --import-options show-only --import /key.asc 2>/dev/null | grep '^grp' | head -n 1 | cut -d\: -f 10 )
echo Using GPG key with ID: ${ID} GRIP: ${GRIP}
# inject the passphrase
echo "${PLUGIN_PASSPHRASE}" | /usr/libexec/gpg-preset-passphrase --preset ${GRIP}
# import the key
gpg2 --batch --yes --import /key.asc
rpm --import /key.asc
gpg2 --batch --yes --import /key.asc
gpg2 --armor --export ${ID} >/key.pub.asc
rpm --import /key.pub.asc
# get key CN
NAME=$(gpg --with-colons /key.asc 2>/dev/null | grep "^uid" | head -n 1 | cut -d\: -f 10)
NAME=$(gpg2 --with-colons /key.asc 2>/dev/null | grep "^uid" | head -n 1 | cut -d\: -f 10)
# and output it to rpmmacros
cat <<EOF >~/.rpmmacros
@ -42,12 +43,6 @@ cat <<EOF >~/.rpmmacros
EOF
# parse required files
for f in ${PLUGIN_FILES} ; do
echo -n "Checking: $f - "
S=$(rpm -K $f | grep '\:.*signatures.*OK$')
if [ "a$S" = "a" ] ; then
rpmsign --addsign $f 2>&1 >/dev/null && echo "SIGNED SUCCESSFULLY" || echo "SIGNING FAILED"
else
echo "ALREADY SIGNED"
fi
for f in ${PLUGIN_FILES} ; do
rpm -K $f | grep "\:.*signatures.*OK$" || rpmsign -v --addsign $f || exit 1
done