mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-23 06:22:24 +01:00
28 lines
485 B
Bash
28 lines
485 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
# Restores backup
|
||
|
|
||
|
set -e
|
||
|
|
||
|
if [ -z "$1" ]; then
|
||
|
echo "Usage: ./utils/restore_bk.sh path/to/backup.sql"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
BKFILE=$1
|
||
|
|
||
|
if [[ ! -f "$BKFILE" ]]; then
|
||
|
echo "No such file: $BKFILE"
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
if [[ "$BKFILE" == *.gpg ]]; then
|
||
|
IN=$BKFILE
|
||
|
BKFILE=/tmp/$(basename "$BKFILE" .gpg)
|
||
|
echo "Decrypting backup at $IN to $BKFILE"
|
||
|
gpg --decrypt "$IN" > "$BKFILE"
|
||
|
fi
|
||
|
|
||
|
echo "Importing backup from $BKFILE"
|
||
|
cat $BKFILE | docker exec -i contentdb_db_1 psql contentdb contentdb
|