-
-
Notifications
You must be signed in to change notification settings - Fork 34
/
redis.pre-install
43 lines (34 loc) · 1.02 KB
/
redis.pre-install
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
#!/usr/bin/env bash
# Check Docksal running
if [[ "$DOCKER_RUNNING" != "true" ]]; then
echo "[PRE-INSTALL] ERROR: Docksal and project should be running"
exit 1
fi
# Check Docksal running
if [[ "$ADDON_GLOBAL" == "true" ]]; then
echo -e "[PRE-INSTALL] ERROR: Redis addon should not be installed globally"
exit 1
fi
# Check project running
if ! (fin ps | grep "_cli_" | grep "Up" >/dev/null); then
echo "[PRE-INSTALL] ERROR: Start the project with fin start first"
exit 1
fi
# Get fin config
fin_config=$(fin config)
if [[ $? != 0 ]]; then
echo "[PRE-INSTALL] ERROR: 'fin config' command was not successful. Check your fin config"
exit 1
fi
# Check there is no redis already
if (echo "$fin_config" | grep "image: docksal\/redis"); then
echo "[PRE-INSTALL] ERROR: Redis seems to be already enabled for this project"
exit 1
fi
# Check there is no redis already
if (echo "$fin_config" | grep " redis:"); then
echo "[PRE-INSTALL] ERROR: Container named 'redis' already exists. Remove it to continue."
exit 1
fi
# All good
exit 0