1
0
mirror of https://github.com/tteck/Proxmox.git synced 2024-12-23 02:04:42 +02:00

Update matterbridge.sh

refactor update
This commit is contained in:
tteckster 2024-08-11 08:49:29 -04:00 committed by GitHub
parent 08debd9442
commit 41b63495db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -55,36 +55,7 @@ function default_settings() {
function update_script() {
header_info
if [[ ! -d /opt/matterbridge ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
RELEASE=$(curl -s https://api.github.com/repos/Luligu/matterbridge/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3)}')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping ${APP} Service"
systemctl stop matterbridge
msg_ok "Stopped ${APP} Service"
msg_info "Updating ${APP} to ${RELEASE}"
cd /opt/matterbridge
wget -q "https://github.com/Luligu/matterbridge/archive/refs/tags/${RELEASE}.zip"
unzip -q ${RELEASE}.zip
mv matterbridge-${RELEASE} /opt/matterbridge
cd /opt/matterbridge
npm ci >/dev/null 2>&1
npm run build >/dev/null 2>&1
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP} to ${RELEASE}"
msg_info "Cleaning up"
rm /opt/${RELEASE}.zip
msg_ok "Cleaned"
msg_info "Starting ${APP} Service"
systemctl start matterbridge
sleep 1
msg_ok "Started ${APP} Service"
msg_ok "Updated Successfully!\n"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
msg_error "Update via the Matterbridge UI"
exit
}