mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-25 23:23:07 +00:00
72406a54e7
The official documentation mentions rsa_key* as what should be backed up (https://github.com/dani-garcia/vaultwarden/wiki/Backing-up-your-vault#the-rsa_key-files). My particular install has rsa_key.pem and rsa_key.pub.pem so the existing command fails when trying to copy rsa_key.der. This change better aligns with the official documentation.
22 lines
620 B
Bash
22 lines
620 B
Bash
#!/usr/bin/env bash
|
|
|
|
# Allow use of !() when copying to not copy certain files
|
|
shopt -s extglob
|
|
|
|
# Based on: https://github.com/dani-garcia/vaultwarden/wiki/Backing-up-your-vault
|
|
if [ ! -d "$BACKUP_FOLDER" ]; then
|
|
echo "Backup folder '$BACKUP_FOLDER' does not exist" >&2
|
|
exit 1
|
|
fi
|
|
|
|
if [[ -f "$DATA_FOLDER"/db.sqlite3 ]]; then
|
|
sqlite3 "$DATA_FOLDER"/db.sqlite3 ".backup '$BACKUP_FOLDER/db.sqlite3'"
|
|
fi
|
|
|
|
if [ ! -d "$DATA_FOLDER" ]; then
|
|
echo "No data folder (yet). This will happen on first launch if backup is triggered before vaultwarden has started."
|
|
exit 0
|
|
fi
|
|
|
|
cp -r "$DATA_FOLDER"/!(db.*) "$BACKUP_FOLDER"/
|