mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-03-12 08:30:01 +00:00
clean up update function
This commit is contained in:
parent
691c9209dd
commit
17b23ba04b
@ -33,33 +33,19 @@ function update_script() {
|
||||
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/ZoneMinder/zoneminder/releases/latest | grep -Po '"tag_name": "\K.*?(?=")')
|
||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt 2>/dev/null || echo 'none')" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
||||
msg_info "Updating $APP"
|
||||
msg_info "Updating to v${RELEASE}"
|
||||
|
||||
msg_info "Stopping $APP"
|
||||
systemctl stop zoneminder
|
||||
msg_ok "Stopped $APP"
|
||||
|
||||
msg_info "Creating Backup"
|
||||
tar -czf "/opt/${APP}_backup_$(date +%F).tar.gz" /etc/zm /usr/share/zoneminder /var/cache/zoneminder
|
||||
msg_ok "Backup Created"
|
||||
|
||||
msg_info "Updating $APP to v${RELEASE}"
|
||||
apt-get update && apt-get install --only-upgrade zoneminder -y
|
||||
msg_ok "Updated $APP to v${RELEASE}"
|
||||
|
||||
msg_info "Starting $APP"
|
||||
systemctl start zoneminder
|
||||
sleep 2
|
||||
msg_ok "Started $APP"
|
||||
|
||||
msg_info "Cleaning Up"
|
||||
rm -rf /tmp/zoneminder-update
|
||||
msg_ok "Cleanup Completed"
|
||||
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Update Successful"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||
msg_ok "${APP} is already v${RELEASE}"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user