summaryrefslogtreecommitdiffstats
path: root/fuel-plugin/pre_build_hook
blob: 259862f8f28d81f00d5384c418ec28375e3a064d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

set -eux

BUILD_FOR=${BUILD_FOR:-ubuntu}
DIR="$(dirname `readlink -f $0`)"
MODULES="${DIR}/deployment_scripts/puppet/modules"

REBOOT_VER='1.2.1'
REBOOT_URL="https://github.com/puppetlabs/puppetlabs-reboot/archive/${REBOOT_VER}.tar.gz"

function build_pkg {
  case $1 in
    ubuntu)
      rm -rf repositories/ubuntu; mkdir -p repositories/ubuntu
      sudo docker build -t kvm .

      # run /kvmfornfv/fuel-plugin/build_kvm.sh in docker
      sudo docker run -v ${DIR}/..:/kvmfornfv -t  kvm /kvmfornfv/fuel-plugin/build_kvm.sh
      # debug in console by the following command
      # sudo docker run -v /kvmfornfv:/kvmfornfv -ti  kvm  /bin/bash
      cp ${DIR}/../*.deb repositories/ubuntu
    ;;
    *) echo "Not supported system"; exit 1;;
  esac
}

for system in $BUILD_FOR
do
  build_pkg $system
done

rm -rf ${MODULES}/reboot
mkdir -p ${MODULES}/reboot
wget -qO- ${REBOOT_URL} |  tar -C ${MODULES}/reboot --strip-components=1 -zxvf -