Last active
August 29, 2015 14:15
-
-
Save martinrusev/3d273fb4ec03613d72e0 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
#! /usr/bin/env bash | |
set -xe | |
export DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
export DEBIAN_FRONTEND=noninteractive | |
export ITERATION=`date +%s` | |
export PACKAGE=circus | |
export DESCRIPTION='circus, A Process & Socket Manager built with zmq' | |
export VERSION=0.9.2 | |
export WEB_VERSION=0.4.1 | |
export PACKAGE_NAME="${PACKAGE}_${VERSION}-${ITERATION}-all.deb" | |
source /etc/lsb-release | |
echo "-> Updating deb repository" | |
sudo apt-get update > /dev/null | |
echo "-> Get build dependencies" | |
sudo apt-get install -qq -y --force-yes libreadline-dev libncurses5-dev libpcre3-dev libssl-dev libxml2-dev libxslt1-dev perl git-core > /dev/null | |
echo "-> Installing python build tools" | |
sudo apt-get install -qq -y --force-yes python python-dev > /dev/null | |
echo "-> Installing ${PACKAGE} dependencies" | |
sudo apt-get install -qq -y --force-yes libzmq-dev python-setuptools python-zmq python-iowait python-psutil > /dev/null | |
sudo apt-get install -qq -y --force-yes python-setuptools python-support python-mock python-configobj > /dev/null | |
echo "-> Setting up the virtualenv" | |
sudo pip install virtualenv-tools > /dev/null | |
rm -rf build/usr/share/python/${PACKAGE} | |
mkdir -p build/usr/share/python > /dev/null | |
virtualenv build/usr/share/python/${PACKAGE} > /dev/null | |
echo "-> Installing distribute" | |
build/usr/share/python/${PACKAGE}/bin/pip install -U pip distribute > /dev/null | |
build/usr/share/python/${PACKAGE}/bin/pip uninstall -y distribute > /dev/null | |
echo "-> Installing ${PACKAGE}" | |
build/usr/share/python/${PACKAGE}/bin/pip install ${PACKAGE}==${VERSION} > /dev/null | |
build/usr/share/python/${PACKAGE}/bin/pip install circus-web==${WEB_VERSION} > /dev/null | |
build/usr/share/python/${PACKAGE}/bin/pip install circus-logstash > /dev/null | |
build/usr/share/python/${PACKAGE}/bin/pip install psutil==1.2.1 > /dev/null | |
echo "-> Cleaning ${PACKAGE}" | |
find build ! -perm -a+r -exec chmod a+r {} \; | |
cd build/usr/share/python/${PACKAGE} | |
virtualenv-tools --update-path /usr/share/python/${PACKAGE} > /dev/null | |
cd - | |
echo "-> Removing compiled files" | |
find build -iname *.pyc -exec rm {} \; | |
find build -iname *.pyo -exec rm {} \; | |
echo "-> Copying conf files" | |
test -d conf/etc && cp -a conf/etc build | |
echo "-> Creating ${PACKAGE}" | |
sudo fpm \ | |
-t deb -s dir -C build -n ${PACKAGE} -v ${VERSION} \ | |
--iteration ${ITERATION} \ | |
-a all \ | |
-p ${PACKAGE_NAME} \ | |
--deb-init conf/etc/init/circus.conf \ | |
--config-files /etc/init/circus.conf \ | |
--config-files /etc/circus/circus.ini \ | |
--after-install conf/post-install \ | |
--before-remove conf/pre-remove \ | |
--after-remove conf/post-remove \ | |
--url https://github.com/circus-tent/circus \ | |
--description "${DESCRIPTION}" \ | |
--license 'Apache 2.0' \ | |
. | |
echo "-> Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment