Update 'save-passwddb script'

Update `save-passwddb` script to use Proton drive instead of Google
drive. Also fixes an issue with too many files being included.
master
Hektor Misplon 2024-06-02 14:06:52 +02:00
parent 58478b9b15
commit a6a85d1ea5
1 changed files with 8 additions and 5 deletions

View File

@ -8,14 +8,17 @@
# `systemctl --user enable save-passwddb.service` # `systemctl --user enable save-passwddb.service`
# `systemctl --user enable save-passwddb.timer` # `systemctl --user enable save-passwddb.timer`
# https://unix.stackexchange.com/questions/100871/in-a-bash-if-condition-how-to-check-whether-any-files-matching-a-simple-wildcard RCLONE_REMOTE="proton-drive"
# Reference: <https://unix.stackexchange.com/questions/100871/in-a-bash-if-condition-how-to-check-whether-any-files-matching-a-simple-wildcard>
if [ 0 -lt "$(ls $HOME/doc/*.kdbx 2>/dev/null | wc -w)" ]; then if [ 0 -lt "$(ls $HOME/doc/*.kdbx 2>/dev/null | wc -w)" ]; then
rclone copy "$HOME/doc" google-drive:doc --include "*.kdbx" echo "Saving KeePassXC databases and database keys"
rclone copy "$HOME/doc" google-drive:doc --include "*.kdbx.key" rclone copyto \
"$HOME/doc/" proton-drive:doc/ \
--include "/*.{kdbx,kdbx.key}"
else else
echo "No password database found, use the following commands to restore" echo "No password database found, use the following commands to restore"
echo "" echo ""
echo "rclone copy google-drive:doc \"$HOME/doc\" --include \"*.kdbx\"" echo "rclone copy $RCLONE_REMOTE:doc \"$HOME/doc\" --include \"*.{kdbx,kdbx.key}\""
echo "rclone copy google-drive:doc \"$HOME/doc\" --include \"*.kdbx.key\""
exit 1 exit 1
fi fi