mirror of
https://github.com/outbackdingo/labca.git
synced 2026-01-27 18:19:33 +00:00
26 lines
692 B
Bash
Executable File
26 lines
692 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
FILE=/backup/$1
|
|
|
|
[ "$1" != "" ] || (echo "You must provide a backup file name to restore"; exit 1)
|
|
[ -f $FILE ] || (echo "Backup file '$FILE' not found"; exit 1)
|
|
|
|
BASE=$(echo "$FILE" | perl -p0e "s/.*\/(.*).tgz/\1/")
|
|
TMPDIR=/tmp/$BASE
|
|
|
|
cd /tmp
|
|
tar xzf $FILE 2>&1
|
|
|
|
cd /boulder
|
|
[ -f $TMPDIR/boulder_sa_integration.sql ] || (echo "MySQL backup file not found"; exit 1)
|
|
docker-compose exec -T bmysql mysql boulder_sa_integration <$TMPDIR/boulder_sa_integration.sql
|
|
|
|
mv -f $TMPDIR/*key* $TMPDIR/*cert.pem $TMPDIR/*.csr /etc/nginx/ssl/
|
|
|
|
[ -d $TMPDIR/data ] || (echo "Data folder backup not found"; exit 1)
|
|
rm -rf /admin/data && mv $TMPDIR/data /admin/
|
|
|
|
rm -rf $TMPDIR
|