refactor(ct): migrate manual update backups to create_backup (batch 1)

Replace ad-hoc mv/cp .bak patterns with create_backup/restore_backup across
58 update scripts so failed updates can roll back via the shared ERR trap.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
MickLesk
2026-06-19 23:35:15 +02:00
parent 578089b69e
commit a1f4bc3240
58 changed files with 124 additions and 520 deletions
+2 -10
View File
@@ -34,12 +34,10 @@ function update_script() {
systemctl stop flatnotes
msg_ok "Stopped Service"
msg_info "Backing up Configuration and Data"
cp /opt/flatnotes/.env /opt/flatnotes.env
cp -r /opt/flatnotes/data /opt/flatnotes_data_backup
msg_ok "Backed up Configuration and Data"
create_backup /opt/flatnotes/data
fetch_and_deploy_gh_release "flatnotes" "dullage/flatnotes" "tarball"
restore_backup
msg_info "Updating Flatnotes"
cd /opt/flatnotes/client
@@ -52,12 +50,6 @@ function update_script() {
$STD /usr/local/bin/uv sync
msg_ok "Updated Flatnotes"
msg_info "Restoring Configuration and Data"
cp /opt/flatnotes.env /opt/flatnotes/.env
cp -r /opt/flatnotes_data_backup/. /opt/flatnotes/data
rm -f /opt/flatnotes.env
rm -r /opt/flatnotes_data_backup
msg_ok "Restored Configuration and Data"
msg_info "Starting Service"
systemctl start flatnotes