generated from Start9Labs/hello-world-startos
-
Notifications
You must be signed in to change notification settings - Fork 5
/
check-ui.sh
executable file
·34 lines (33 loc) · 986 Bytes
/
check-ui.sh
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
#!/bin/sh
FEDERATION=$(yq e '.federation' /data/start9/config.yaml)
if [ "$FEDERATION" = 'false' ]; then
CHCK='curl -skf https://synapse.embassy/_matrix/client/versions >/dev/null 2>&1'
eval "$CHCK"
exit_code=$?
if [ "$exit_code" -ne 0 ]; then
echo "Initializing Homeserver ..." >&2
exit 61
sleep 25
eval "$CHCK"
exit_code=$?
if [ "$exit_code" -ne 0 ]; then
echo "Homeserver is unreachable" >&2
exit 1
fi
fi
else
while true; do
if [ ! -f /data/start9/stats.yaml ]; then
echo "Waiting for Synapse to finish initialization ..." >&2
exit 61
else
chkstats=$(yq e '.data["Admin Username"].value' /data/start9/stats.yaml)
if [ "$chkstats" = "admin" ]; then
exit 0
else
echo "Failed to retrieve admin credentials." >&2
exit 1
fi
fi
done
fi