forked from charmed-hpc/slurmrestd-operator
-
Notifications
You must be signed in to change notification settings - Fork 2
/
dispatch
executable file
·43 lines (39 loc) · 1.13 KB
/
dispatch
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
36
37
38
39
40
41
42
43
#!/bin/bash
# This hook installs the centos dependencies needed to run the charm,
# creates the dispatch executable, regenerates the symlinks for start and
# upgrade-charm, and kicks off the operator framework.
set -e
# Source the os-release information into the env.
. /etc/os-release
if ! [[ -f '.installed' ]]
then
# Determine if we are running in centos or ubuntu, if centos
# provision the needed prereqs.
if [[ $ID == 'ubuntu' ]]
then
echo "Running Ubuntu."
echo "Nothing to do."
elif [[ $ID == 'centos' ]]
then
# Determine the centos version and install prereqs accordingly
major=$(cat /etc/centos-release | tr -dc '0-9.'|cut -d \. -f1)
echo "Running CentOS$major, installing prereqs."
if [[ $major == "7" ]]
then
yum -y install epel-release
yum -y install yum-priorities python3
elif [[ $major == "8" ]]
then
dnf -y install epel-release
dnf -y install yum-priorities python3
else
echo "Running unsuppored version of centos: $major"
exit -1
fi
else
echo "Running unsuppored os: $ID"
exit -1
fi
touch .installed
fi
JUJU_DISPATCH_PATH="${JUJU_DISPATCH_PATH:-$0}" PYTHONPATH=lib:venv ./src/charm.py