1
0
Fork 0

Update borg.sh backup script with passphrase and excludes.

This commit is contained in:
Casper V. Kristensen 2019-03-22 02:56:19 +01:00
parent 93a64d4107
commit c54843746a
Signed by: caspervk
GPG key ID: 289CA03790535054

32
borg.sh
View file

@ -1,9 +1,29 @@
#!/data/data/com.termux/files/usr/bin/bash #!/data/data/com.termux/files/usr/bin/bash
t=`date +%d_%m_%Y`
export BORG_UNKNOWN_UNENCRYPTED_REPO_ACCESS_IS_OK=yes
export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes
host=angler
dirs="/ /system /vendor /cache /persist /firmware /storage /data"
export BORG_RSH=borg_ssh_wrapper export BORG_RSH=borg_ssh_wrapper
source /data/data/com.termux/files/home/borgbackup_on_android/borg-env/bin/activate source /data/data/com.termux/files/home/borgbackup_on_android/borg-env/bin/activate
borg create -C lz4 -p -v --stats --one-file-system backup:/backup/borg/$host::$t $dirs # 2> ~/borg_backup_${t}.err
# Avoid UnicodeError
export LANG=en_US.UTF-8
# Ask an external program to supply the repository passphrase:
export BORG_PASSCOMMAND="cat /data/data/com.termux/files/home/borgbackup_on_android/borg-passphrase"
# Set repository location
export BORG_REPO=ssh://borg@<server>:<port>/./auto
# Initialize remote repository (doesn't matter if it already is).
borg init --encryption=repokey-blake2
borg create \
--filter AME \
--compression lz4 \
--remote-ratelimit 0 \
\
--exclude-caches \
--exclude '/data/data/*/cache' \
--exclude '/data/data/*/code_cache' \
--exclude '/data/data/*/no_backup' \
--exclude '**/TWRP/BACKUPS' \
::'{hostname}-{utcnow}' \
/system /data /storage