Allow SQLite to create its rollback snapshot journal

This commit is contained in:
jhartworks committed 2026-11-24 13:50:46 +01:00
1 parent 4e35a3a557
commit 73ccb1bb75
1 file changed
+9 -5
+9 -5
View File
@@ -66,7 +66,7 @@ finish() {
if ((services_stopped)); then
if systemctl stop "${gateway_units[@]}"; then
if ((snapshot_ready)); then
runuser -u seiugw -- sqlite3 -bail "$database" ".restore '$work/gateway.db'" || restored=0
runuser -u seiugw -- sqlite3 -bail "$database" ".restore '$work/database/gateway.db'" || restored=0
fi
else
restored=0
@@ -94,7 +94,11 @@ finish() {
status failed "Fehler bei $step. Die installierte Version läuft weiter." || true
fi
fi
rm -f -- "$work/result" "$work/gateway.db" "$work/gateway.db-wal" "$work/gateway.db-shm" "$work/status.json"
if [[ -d $work/database ]]; then
rm -f -- "$work/database/"{gateway.db,gateway.db-wal,gateway.db-shm,gateway.db-journal}
rmdir -- "$work/database"
fi
rm -f -- "$work/result" "$work/status.json"
rmdir -- "$work"
exit "$code"
}
@@ -140,9 +144,9 @@ systemctl stop "${gateway_units[@]}"
[[ -f $database ]]
chgrp seiugw "$work"
chmod 0710 "$work"
install -o seiugw -g seiugw -m 0600 /dev/null "$work/gateway.db"
runuser -u seiugw -- sqlite3 -bail "$database" ".backup '$work/gateway.db'"
[[ $(sqlite3 -bail "$work/gateway.db" 'PRAGMA quick_check') == ok ]]
install -d -o seiugw -g seiugw -m 0700 "$work/database"
runuser -u seiugw -- sqlite3 -bail "$database" ".backup '$work/database/gateway.db'"
[[ $(runuser -u seiugw -- sqlite3 -readonly -bail "$work/database/gateway.db" 'PRAGMA quick_check') == ok ]]
snapshot_ready=1
step="Aktivierung"