Update matterbridge.sh

refactor update
pull/3580/head
tteckster 4 months ago committed by GitHub
parent 08debd9442
commit 41b63495db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -55,36 +55,7 @@ function default_settings() {
function update_script() { function update_script() {
header_info header_info
if [[ ! -d /opt/matterbridge ]]; then msg_error "No ${APP} Installation Found!"; exit; fi if [[ ! -d /opt/matterbridge ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_error "Update via the Matterbridge UI"
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
exit exit
} }

Loading…
Cancel
Save

Powered by BW's shoe-string budget.