2019-04-23 19:27:59 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2021-07-01 09:14:51 +00:00
|
|
|
# Based on: https://github.com/dani-garcia/vaultwarden/wiki/Backing-up-your-vault
|
2023-10-08 21:22:58 +00:00
|
|
|
if [ ! -d "$BACKUP_FOLDER" ]; then
|
|
|
|
echo "Backup folder '$BACKUP_FOLDER' does not exist" >&2
|
2019-04-23 19:27:59 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -f "$DATA_FOLDER"/db.sqlite3 ]]; then
|
|
|
|
echo "Could not find SQLite database file '$DATA_FOLDER/db.sqlite3'" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
sqlite3 "$DATA_FOLDER"/db.sqlite3 ".backup '$BACKUP_FOLDER/db.sqlite3'"
|
|
|
|
cp "$DATA_FOLDER"/rsa_key.{der,pem,pub.der} "$BACKUP_FOLDER"
|
|
|
|
cp -r "$DATA_FOLDER"/attachments "$BACKUP_FOLDER"
|
|
|
|
cp -r "$DATA_FOLDER"/icon_cache "$BACKUP_FOLDER"
|