ipv6 btrbk
authorIan Kelling <ian@iankelling.org>
Fri, 21 Aug 2020 13:49:18 +0000 (09:49 -0400)
committerIan Kelling <ian@iankelling.org>
Fri, 21 Aug 2020 13:49:18 +0000 (09:49 -0400)
btrbk-run
distro-begin
mount-latest-remote

index a83e21df8993cd4e6018f104b86d1697697ba86c..00052da389f1fb0c9c7c1759d45a8bf39abf8b96 100644 (file)
--- a/btrbk-run
+++ b/btrbk-run
@@ -99,7 +99,14 @@ while true; do
     --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 ;;
@@ -384,7 +391,7 @@ for m in ${mountpoints[@]}; do
   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
@@ -394,6 +401,10 @@ volume $vol
 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
index 0c0dac03da41a6d115c49bc220998fb15b4ebb71..63f01f76cac4b3512eb88ce341b6cfeb957849fb 100755 (executable)
@@ -406,7 +406,8 @@ fi
 ##### 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
index 2d17f1efa7217f8bad7c550dec4f1cb758a1ebb7..3e3600992c8aa4fc49ef430efc71ada94f98df15 100755 (executable)
@@ -27,7 +27,11 @@ $script_dir/install-my-scripts
 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}