Skip to content

Commit 2852c5b

Browse files
authored
Check if Synapse-Admin service exists (#4050)
1 parent 2251f6b commit 2852c5b

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

ct/elementsynapse.sh

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,25 @@ function update_script() {
4747
$STD apt-get -y upgrade
4848
msg_ok "Updated $APP LXC"
4949

50-
msg_info "Updating Synapse-Admin"
51-
RELEASE=$(curl -fsSL https://api.github.com/repos/etkecc/synapse-admin/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
52-
if [[ "${RELEASE}" != "$(cat /opt/"${APP}"_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
53-
temp_file=$(mktemp)
54-
systemctl stop synapse-admin
55-
rm -rf /opt/synapse-admin
56-
mkdir -p /opt/synapse-admin
57-
curl -fsSL "https://github.com/etkecc/synapse-admin/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
58-
tar xzf "$temp_file" -C /opt/synapse-admin --strip-components=1
59-
cd /opt/synapse-admin
60-
$STD yarn install --ignore-engines
61-
systemctl start synapse-admin
62-
echo "${RELEASE}" >/opt/"${APP}"_version.txt
63-
rm -f "$temp_file"
64-
msg_ok "Update Successful"
65-
else
66-
msg_ok "No update required. ${APP} is already at v${RELEASE}"
50+
if [[ -f /systemd/system/synapse-admin.service ]]; then
51+
msg_info "Updating Synapse-Admin"
52+
RELEASE=$(curl -fsSL https://api.github.com/repos/etkecc/synapse-admin/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
53+
if [[ "${RELEASE}" != "$(cat /opt/"${APP}"_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
54+
temp_file=$(mktemp)
55+
systemctl stop synapse-admin
56+
rm -rf /opt/synapse-admin
57+
mkdir -p /opt/synapse-admin
58+
curl -fsSL "https://github.com/etkecc/synapse-admin/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
59+
tar xzf "$temp_file" -C /opt/synapse-admin --strip-components=1
60+
cd /opt/synapse-admin
61+
$STD yarn install --ignore-engines
62+
systemctl start synapse-admin
63+
echo "${RELEASE}" >/opt/"${APP}"_version.txt
64+
rm -f "$temp_file"
65+
msg_ok "Update Successful"
66+
else
67+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
68+
fi
6769
fi
6870
exit
6971
}

0 commit comments

Comments
 (0)