--pull-reexec) pull_reexec=true; shift ;;
-q) verbose=false; verbose_arg=; progress_arg=; shift ;;
# source host to receive a backup from
- -s) source=$2; shift 2 ;;
+ -s)
+ source=$2
+ bbksource=$source
+ if [[ $source == *:* ]]; then
+ bbksource="[$source]"
+ fi
+ shift 2
+ ;;
# target hosts to send to. empty is valid for just doing local
# snapshot. we have default hosts we will populate.
-t) IFS=, targets=($2); unset IFS; shift 2 ;;
sub=${m#/}
if [[ $source ]]; then
cat >>/etc/btrbk.conf <<EOF
-volume ssh://$source$vol
+volume ssh://$bbksource$vol
subvolume $sub
target send-receive $vol/btrbk
EOF
subvolume $sub
EOF
for tg in ${targets[@]}; do
+ # handle ipv6
+ if [[ $tg == *:* ]]; then
+ tg="[$tg]"
+ fi
cat >>/etc/btrbk.conf <<EOF
target send-receive ssh://$tg$vol/btrbk
EOF
##### make extra dirs
dirs=(/mnt/{1,2,3,4,5,6,7,8,9} /nocow/t)
sudo mkdir -p "${dirs[@]}"
-sudo chown $USER:$USER "${dirs[@]}"
+# allow to fail because they could have read-only mounts on them
+sudo chown $USER:$USER "${dirs[@]}" ||:
###### setup /i
if home_network; then
cd /usr/local
for tg; do
- rsync -RtO bin/{mount-latest-subvol,check-subvol-stale} lib/err root@$tg:/usr/local
+ rsynctg=$tg
+ if [[ $tg == *:* ]]; then
+ rsynctg="[$tg]"
+ fi
+ rsync -RtO bin/{mount-latest-subvol,check-subvol-stale} lib/err "root@$rsynctg:/usr/local"
ssh root@$tg bash <<'EOF'
set -e
chmod +x /usr/local/bin/{mount-latest-subvol,check-subvol-stale}