Initialize clean CSR inventory repository

This commit is contained in:
DenisToxic
2026-09-29 08:43:05 +02:00
commit 059f386c60
107 changed files with 9639 additions and 0 deletions

17
scripts/restore.sh Normal file
View File

@@ -0,0 +1,17 @@
#!/bin/sh
set -eu
umask 077
if [ "$#" -ne 1 ] || [ ! -f "$1" ]; then
echo "Aufruf: scripts/restore.sh backups/backup_YYYY-MM-DD_HHMM.sql.gz" >&2
exit 1
fi
WORK=$(mktemp -d)
trap 'rm -rf "$WORK"' EXIT
trap 'exit 1' HUP INT TERM
# Decompress completely before touching the target database. SQL errors roll
# back the entire restore rather than leaving a partially restored database.
gzip -dc "$1" > "$WORK/dump.sql"
test -s "$WORK/dump.sql"
docker compose exec -T db sh -c 'exec psql --single-transaction -v ON_ERROR_STOP=1 -U "$POSTGRES_USER" -d "$POSTGRES_DB"' < "$WORK/dump.sql"
echo "Wiederherstellung abgeschlossen."