summaryrefslogtreecommitdiff
path: root/auto/uncron-script.sh
blob: a8df0810a35b01c1157e0b6580a855aacd95fe2e (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
#!/usr/bin/env bash
set -e

# Ensure we are jenkins user
if [ "$EUID" -ne 1006 ]; then
  >&2 echo "Please run as jenkins"
  exit 1
fi

if [ -d uncron ]; then
  echo "Updating Uncron git repository..."
  cd uncron
  git pull > /dev/null 2>&1
else
  echo "Cloning Uncron git repository..."
  git clone https://github.com/vyos/uncron.git > /dev/null 2>&1
  cd uncron
fi

if [ -d ~/.opam ]; then
  echo "OPAM has already been initialized."
else
  echo "Initializing OPAM..."
  opam init -n > /dev/null 2>&1
fi

eval $(opam env --switch=default)

echo "Ensuring packages have been installed..."
opam install lwt lwt_ppx logs containers -y > /dev/null 2>&1

eval $(opam env)

echo "Building Uncron..."
dune build