diff options
| author | Patrick Spek <p.spek@tyil.nl> | 2024-08-12 17:01:30 +0200 |
|---|---|---|
| committer | Patrick Spek <p.spek@tyil.nl> | 2024-08-12 17:01:30 +0200 |
| commit | 437fa7cd39aa38449737fb54f663c48abda5c859 (patch) | |
| tree | fac9d4d457108302f1884990532dd078d023f806 /bin/bust-hostfs | |
| parent | dc57528fd776b51e7bcfb7a17afab10fbb48f45e (diff) | |
| download | bust-master.tar.gz bust-master.tar.bz2 | |
Diffstat (limited to 'bin/bust-hostfs')
| -rwxr-xr-x | bin/bust-hostfs | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/bin/bust-hostfs b/bin/bust-hostfs new file mode 100755 index 0000000..4b62e3d --- /dev/null +++ b/bin/bust-hostfs @@ -0,0 +1,40 @@ +#!/usr/bin/env bash + +main() { + while read -r repo proto + do + mkbackup "$repo" "$proto" + done < /etc/bust/repositories +} + +mkbackup() { + local repo="$1" ; shift + local proto="$1" ; shift + + local borg + + export BORG_PASSPHRASE="$(passphrase)" + + borg=( + "borg" "create" + "--one-file-system" + "--remote-path" "$proto" + "$repo/hostfs::$(date -u "+%FT%TZ")" + ) + + while read -r path + do + borg+=("$path") + done < /etc/bust/filesystem.d/paths + + printf "> %s\n" "${borg[*]}" + + if [[ -n $BUST_DRYRUN ]] + then + return 0 + fi + + ${borg[@]} +} + +main "$@" |
