This commit is contained in:
Ray Elliott 2026-10-27 12:49:13 +00:00
commit b236b68486
22 changed files with 288 additions and 36 deletions

34
user/backup-pass.sh Normal file
View file

@ -0,0 +1,34 @@
#!/bin/sh
set -eu
umask 077
mountpoint_dir='/mnt/wasabi-data-crypt'
destination_dir="$mountpoint_dir/pass"
timestamp=$(date +%s)
copied=0
if ! mountpoint -q "$mountpoint_dir"; then
echo "Password backup aborted: $mountpoint_dir is not mounted" >&2
exit 1
fi
if ! [ -d "$destination_dir" ]; then
echo "Password backup aborted: $destination_dir does not exist" >&2
exit 1
fi
for source_file in ./*.kdbx; do
[ -e "$source_file" ] || continue
filename=${source_file#./}
cp -- "$source_file" "$destination_dir/$timestamp-$filename"
printf 'Backed up %s\n' "$filename"
copied=$((copied + 1))
done
if [ "$copied" -eq 0 ]; then
echo 'Password backup aborted: no .kdbx files found' >&2
exit 1
fi
printf 'Password backup complete: %s file(s) copied to %s\n' "$copied" "$destination_dir"