Refactor SEBA install.sh
[iec.git] / src / use_cases / seba_on_arm / test / ponsim / install.sh
1 #!/bin/bash
2 # shellcheck disable=SC2016
3
4 set -ex
5
6 HELM_CHARTS_REV_IEC="cord-7.0-arm64"
7 HELM_CHARTS_REV_REC="cord-7.0-arm64-rec"
8 UPSTREAM_PROJECT="${UPSTREAM_PROJECT:-iec}"
9
10 if [ "$#" -gt 0 ]; then UPSTREAM_PROJECT="$1"; fi
11
12 case "${UPSTREAM_PROJECT}" in
13   "iec")
14     HELM_CHARTS_REV="${HELM_CHARTS_REV_IEC}"
15     SEBAVALUES="configs/seba-ponsim-iec-arm64.yaml"
16     ;;
17   "rec")
18     HELM_CHARTS_REV="${HELM_CHARTS_REV_REC}"
19     SEBAVALUES="configs/seba-ponsim-rec-arm64.yaml"
20     ;;
21   *)
22     echo "Invalid upstream project ${UPSTREAM_PROJECT}"
23     echo "  Specify either iec or rec"
24     exit 1
25     ;;
26 esac
27
28 export M="/tmp/milestones"
29 export WORKSPACE="${HOME}"
30 export SEBAVALUES
31
32 # Using opencord automation-tools from the cord-6.1 maintenance branch
33 AUTO_TOOLS="${WORKSPACE}/automation-tools"
34 AUTO_TOOLS_REPO="https://github.com/iecedge/automation-tools.git"
35 AUTO_TOOLS_REV="${AUTO_TOOLS_VER:-cord-7.0-arm64}"
36
37 rm -rf "${M}"
38 mkdir -p "${M}" "${WORKSPACE}/cord/test"
39
40 if ! [ -d "${AUTO_TOOLS}" ] && ! [ -L "${AUTO_TOOLS}" ]
41 then
42   git clone "${AUTO_TOOLS_REPO}" "${AUTO_TOOLS}"
43   (cd "${AUTO_TOOLS}"; git checkout "${AUTO_TOOLS_REV}")
44 fi
45
46 # Use our own helm-charts clone if not already there
47 CHARTS="${WORKSPACE}/cord/helm-charts"
48 HELM_CHARTS_REPO="https://github.com/iecedge/helm-charts.git"
49 if ! [ -d "${CHARTS}" ] && ! [ -L "${CHARTS}" ]
50 then
51   git clone "${HELM_CHARTS_REPO}" "${CHARTS}"
52   (cd "${CHARTS}"; git checkout "${HELM_CHARTS_REV}")
53 fi
54
55 cd "${AUTO_TOOLS}/seba-in-a-box"
56 # shellcheck source=/dev/null
57 . env.sh
58
59 # Now calling make, to install SiaB and PONSim
60 make stable