Build collectd in ubuntu 16.04 docker
[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       cd ${DIR}
17       rm -rf ${DIR}/repositories/ubuntu; mkdir -p ${DIR}/repositories/ubuntu
18       rm -rf collectd-ceilometer-plugin
19       git clone https://github.com/openstack/collectd-ceilometer-plugin
20       cd  collectd-ceilometer-plugin
21       git checkout 73372f2eb86c81f12bc10b392f75050a401107db
22       tar cfvz ${DIR}/repositories/ubuntu/collectd-ceilometer.tgz . --exclude=collectd-ceilometer.tgz
23       cd ..; rm -rf collectd-ceilometer-plugin
24
25       # build collectd
26       cd ${DIR}
27       sudo docker  build -t collectd_build .
28       sudo docker run -v${DIR}/repositories/ubuntu:/build -t collectd_build /build-collectd.sh
29       ;;
30     *) echo "Not supported system"; exit 1;;
31   esac
32 }
33
34 for system in $BUILD_FOR
35 do
36   build_pkg $system
37 done