mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-06-03 06:09:36 +02:00
Compare commits
1 Commits
node_updat
...
fix/filefl
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
765ed94b3a |
@@ -31,28 +31,39 @@ function update_script() {
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
update_available=$(curl -fsSL -X 'GET' "http://localhost:19200/api/status/update-available" -H 'accept: application/json' | jq .UpdateAvailable)
|
if systemctl list-unit-files 'fileflows.service' --no-legend 2>/dev/null | grep -q '^fileflows\.service'; then
|
||||||
if [[ "${update_available}" == "true" ]]; then
|
tmp=$(mktemp)
|
||||||
msg_info "Stopping Service"
|
http_code=$(curl -sSL -X 'GET' "http://localhost:19200/api/status/update-available" -H 'accept: application/json' -o "$tmp" -w '%{http_code}' 2>/dev/null) || http_code="000"
|
||||||
systemctl --all stop 'fileflows*'
|
if [[ "$http_code" == "401" ]]; then
|
||||||
msg_info "Stopped Service"
|
rm -f "$tmp"
|
||||||
|
msg_error "Could not check for updates: API returned 401. Disable security in FileFlows."
|
||||||
msg_info "Creating Backup"
|
exit
|
||||||
ls /opt/*.tar.gz &>/dev/null && rm -f /opt/*.tar.gz
|
fi
|
||||||
backup_filename="/opt/${APP}_backup_$(date +%F).tar.gz"
|
update_available=$(jq -r '.UpdateAvailable // false' "$tmp" 2>/dev/null)
|
||||||
tar -czf "$backup_filename" -C /opt/fileflows Data
|
rm -f "$tmp"
|
||||||
msg_ok "Backup Created"
|
if [[ "${update_available}" != "true" ]]; then
|
||||||
|
msg_ok "No update required. ${APP} is already at latest version"
|
||||||
fetch_and_deploy_from_url "https://fileflows.com/downloads/zip" "/opt/fileflows"
|
exit
|
||||||
|
fi
|
||||||
msg_info "Starting Service"
|
|
||||||
systemctl --all start 'fileflows*'
|
|
||||||
msg_ok "Started Service"
|
|
||||||
msg_ok "Updated successfully!"
|
|
||||||
else
|
|
||||||
msg_ok "No update required. ${APP} is already at latest version"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
msg_info "Stopping Service"
|
||||||
|
systemctl --all stop 'fileflows*'
|
||||||
|
msg_ok "Stopped Service"
|
||||||
|
|
||||||
|
msg_info "Creating Backup"
|
||||||
|
ls /opt/*.tar.gz &>/dev/null && rm -f /opt/*.tar.gz
|
||||||
|
backup_filename="/opt/${APP}_backup_$(date +%F).tar.gz"
|
||||||
|
tar -czf "$backup_filename" -C /opt/fileflows Data
|
||||||
|
msg_ok "Backup Created"
|
||||||
|
|
||||||
|
fetch_and_deploy_from_url "https://fileflows.com/downloads/zip" "/opt/fileflows"
|
||||||
|
|
||||||
|
msg_info "Starting Service"
|
||||||
|
systemctl --all start 'fileflows*'
|
||||||
|
msg_ok "Started Service"
|
||||||
|
msg_ok "Updated successfully!"
|
||||||
|
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user