fuel: rebase against stable/mitaka
[barometer.git] / src / fuel-plugin / pre_build_hook
1 #!/bin/bash
2
3 # Add here any the actions which are required before plugin build
4 # like packages building, packages downloading from mirrors and so on.
5 # The script should return 0 if there were no errors.
6 #!/bin/bash
7
8 set -eux
9
10 BUILD_FOR=${BUILD_FOR:-ubuntu}
11 DIR="$(dirname `readlink -f $0`)"
12
13 function build_pkg {
14   case $1 in
15     ubuntu)
16       rm -rf ${DIR}/repositories/ubuntu; mkdir -p ${DIR}/repositories/ubuntu
17       rm -rf ${DIR}/build; mkdir -p ${DIR}/build; cd ${DIR}/build;
18       git clone https://github.com/openstack/collectd-ceilometer-plugin
19       cd  collectd-ceilometer-plugin
20       git checkout 6c7cb6adf86fcaa6028ca42867ddcb0582111ab1
21       cat << EOF > collectd_ceilometer/__init__.py
22 """Collectd Ceilometer plugin implementation"""
23 EOF
24       tar cfvz ${DIR}/repositories/ubuntu/collectd-ceilometer.tgz . --exclude=collectd-ceilometer.tgz
25
26       cd ${DIR}/build; ../build-collectd.sh
27       cp *.deb ${DIR}/repositories/ubuntu
28
29       rm -rf ${DIR}/build
30       ;;
31     *) echo "Not supported system"; exit 1;;
32   esac
33 }
34
35 for system in $BUILD_FOR
36 do
37   build_pkg $system
38 done