TestScript

Revision 4 as of 2017-09-01 23:28:37

Clear message

The following script can be used to assist with SRU verification of the Certbot family of packages:

#!/bin/bash

set -e

if test "$(id -u)" -ne "0"; then
    echo "Must run as root to install packages and use Docker." >&2
    exit 1
fi

apt update
apt install docker.io git lsb-release net-tools wget -y

wget https://github.com/docker/compose/releases/download/1.15.0-rc1/docker-compose-Linux-x86_64 -O /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose

codename=$(lsb_release -a 2>/dev/null | grep Codename | cut -f2)
echo "deb http://archive.ubuntu.com/ubuntu/ $codename-proposed restricted main multiverse universe" > /etc/apt/sources.list.d/proposed.list
echo "Package: *" > /etc/apt/preferences.d/proposed-updates
echo "Pin: release a=$codename-proposed" >> /etc/apt/preferences.d/proposed-updates
echo "Pin-Priority: 400" >> /etc/apt/preferences.d/proposed-updates

apt update
apt install python-acme/$codename-proposed certbot/$codename-proposed python-certbot-apache/$codename-proposed -y
service apache2 stop
apt install python-certbot-nginx/$codename-proposed -y
service nginx stop
certbot_version=$(certbot --version 2>&1 | grep "^certbot" | cut -d " " -f 2)

cd ~
git clone https://github.com/certbot/certbot --branch v$certbot_version --depth 1
cd certbot
tests/boulder-fetch.sh
until curl http://localhost:4000/directory 2>/dev/null; do
  echo waiting for boulder
  sleep 1
done
tests/boulder-integration.sh
echo "Success!"
echo "Package versions tested:"
dpkg-query -W python-acme python-certbot python-certbot-apache python-certbot-nginx