-
-
Save jclulow/3b8d5552980e155d76acf860d943b7c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ -z $SYNAPSE_VERSION ]]; then | |
SYNAPSE_VERSION=1.12.0 | |
fi | |
function fatalf { | |
local fmt="ERROR: $1\n" | |
shift | |
printf "$fmt" "$@" >&2 | |
exit 1 | |
} | |
function infof { | |
local fmt='\e[1;7m * '"$1"'\e[0m\n' | |
shift | |
printf "$fmt" "$@" >&2 | |
} | |
name=$1 | |
if [[ -z $name ]]; then | |
fatalf 'provide environment name' | |
fi | |
dir="$HOME/env-$name" | |
if [[ -d $dir ]]; then | |
fatalf 'directory "%s" exists already' "$dir" | |
fi | |
set -o errexit | |
set -o pipefail | |
infof 'CREATE ENVIRONMENT "%s"' "$dir" | |
virtualenv -p python3 "$dir" | |
infof 'ACTIVATE ENVIRONMENT "%s"' "$dir" | |
. "$dir/bin/activate" | |
infof 'INSTALL pip' | |
pip install --upgrade pip | |
infof 'INSTALL setuptools' | |
pip install --upgrade setuptools | |
infof 'INSTALL matrix' | |
LDFLAGS='-L/opt/local/lib -R/opt/local/lib' | |
LDFLAGS+=' /opt/local/lib/libssl.so' | |
LDFLAGS+=' /opt/local/lib/libcrypto.so' | |
export LDFLAGS | |
CFLAGS='-I/opt/local/include' | |
export CFLAGS | |
export CRYPTOGRAPHY_SUPPRESS_LINK_FLAGS=yes | |
pip install --upgrade "matrix-synapse[postgres]==$SYNAPSE_VERSION" | |
infof 'COMPLETED ENVIRONMENT "%s" @ "%s"' "$name" "$dir" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment