-# umount first to ensure we don't have any errors
-# todo: do some kill fuser stuff to make umount more reliable
-# todo: setup sync systemd timer on $primary, once per hour.
-# todo: setup lock so that if this is already running, we exit out, so
-# that manual runs don't interfere with cronjobs.
-if [[ $primary ]] && ! $dry_run; then
- for m in ${mountpoints[@]}; do
- # note, this won't work for /i, due to path being /mnt/iroot
- # todo: include /i for treetowl/frodo
- btrfs property set -ts /mnt/root$m ro true
- ssh root@$primary bash <<EOF
-set -ex
-umount $m
-[[ -e /mnt/root$m ]] || exit 0
-btrfs sub del /mnt/root$m
+##### end command line parsing ########
+
+rsync-dirs() {
+ local host=$1
+ local path=$2
+ m rsync $dry_run_arg -ahi --relative --delete "$path" "root@$host:/"
+}
+
+vol-conf() {
+ cat >>/etc/btrbk.conf <<EOF
+volume $vol