Regularly back up Documents/ and some configuration files

This commit is contained in:
Ohad Livne 2025-06-04 22:44:52 +03:00
parent 4f268ea778
commit 75591ce5af
Signed by: libohad-dev
GPG key ID: 34FDC68B51191A4D
3 changed files with 75 additions and 0 deletions

22
.local/bin/make-backup Executable file
View file

@ -0,0 +1,22 @@
#! /usr/bin/sh
export BORG_REPO="/media/backup/"
export BORG_PASSCOMMAND="cat ${HOME}/.keys/borg-passphrase.txt"
TS_DIR="${HOME}/.local/state/backup"
mkdir -p "${TS_DIR}"
backup () {
target=$1
directory=$2
if "${HOME}/.local/bin/dirtree-changed" --directory "${directory}" --check-file "${TS_DIR}/${target}"
then
borg create --compression auto,lzma ::"${target}"-{now} "${directory}"
touch "${TS_DIR}/${target}"
fi
}
backup circuits "${HOME}/.config/circuits"
backup documents "${HOME}/Documents"