Amrith Kumar 357930d459 Update the Signing Key for Percona Debian and Ubuntu Packages
Attempting to build images fails now with an error because of a change
in the signing key for Percona packages.

Quick summary copied from [1]

Percona .deb packages are signed with a key that uses an algorithm now
considered weak. Starting with the next release, Debian and Ubuntu
packages are signed with a new key that uses the much stronger SHA-512
algorithm. All future package release will also contain the new
algorithm.

It’s important that you add the new key before the next release.

[1] https://www.percona.com/blog/2016/10/13/new-signing-key-for-percona-debian-and-ubuntu-packages/

Change-Id: I0420193982ebc5c9922eb388adb85da1423ab3f0
2016-10-24 09:39:23 -04:00

50 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# CONTEXT: GUEST during PRE-CONSTRUCTION as ROOT
# PURPOSE: Setup apt-repo list so that we can connect to Percona's repo
set -e
set -o xtrace
[ -n "${GUEST_USERNAME}" ] || die "GUEST_USERNAME needs to be set to the user for the guest image"
[ -n "${RELEASE}" ] || die "RELEASE must be set to either Precise or Quantal"
#5 add Percona GPG key
if [ ! -e /home/${GUEST_USERNAME}/.gnupg ]; then
mkdir -p /home/${GUEST_USERNAME}/.gnupg
fi
# sometimes the primary key server is unavailable and we should try an
# alternate. see
# https://bugs.launchpad.net/percona-server/+bug/907789. Disable
# shell errexit so we can interrogate the exit code and take action
# based on the exit code. We will reenable it later.
function get_key_robust() {
KEY=$1
set +e
apt-key adv --keyserver hkp://keys.gnupg.net --recv-keys ${KEY}
if [ "$?" -ne "0" ];
then
echo "Trying alternate keyserver hkp://keyserver.ubuntu.com"
set -e
apt-key adv --keyserver hkp://keyserver.ubuntu.com --recv-keys ${KEY}
fi
set -e
}
get_key_robust 1C4CBDCDCD2EFD2A
get_key_robust 9334A25F8507EFA5
# add Percona repo
# creates the percona sources list
cat <<EOL > /etc/apt/sources.list.d/percona.list
deb http://repo.percona.com/apt $RELEASE main
deb-src http://repo.percona.com/apt $RELEASE main
EOL
# force an update
apt-get update