Skip to content

Instantly share code, notes, and snippets.

@cloewen8
Forked from C-Pro/pg-pgtap-install.sh
Last active May 2, 2018 10:07
Show Gist options
  • Select an option

  • Save cloewen8/257253a1a4d23111315bed613681aca3 to your computer and use it in GitHub Desktop.

Select an option

Save cloewen8/257253a1a4d23111315bed613681aca3 to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eux
sudo apt-get update
packages="postgresql-$PGVERSION postgresql-server-dev-$PGVERSION postgresql-common"
# bug: http://www.postgresql.org/message-id/20130508192711.GA9243@msgid.df7cb.de
sudo update-alternatives --remove-all postmaster.1.gz
# stop all existing instances (because of https://github.com/travis-ci/travis-cookbooks/pull/221)
sudo service postgresql stop
# and make sure they don't come back
echo 'exit 0' | sudo tee /etc/init.d/postgresql
sudo chmod a+x /etc/init.d/postgresql
sudo apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" install $packages
status=0
sudo pg_createcluster --start $PGVERSION test -p 55435 -- -A trust
wget http://api.pgxn.org/dist/pgtap/0.94.0/pgtap-0.94.0.zip
unzip pgtap-0.94.0.zip
cd pgtap-0.94.0
make all PG_CONFIG=/usr/lib/postgresql/$PGVERSION/bin/pg_config
sudo make install PG_CONFIG=/usr/lib/postgresql/$PGVERSION/bin/pg_config
cd ..
if test -f regression.diffs; then cat regression.diffs; fi
exit $status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment