]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Fix: additional checks at startup_rsync_to_guest and poweroff_rsync_from_guest
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 19 Oct 2020 15:47:36 +0000 (12:47 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 19 Oct 2020 15:47:36 +0000 (12:47 -0300)
kvmx

diff --git a/kvmx b/kvmx
index 4f47403663f70e86849627a5ae347eff86e04b85..3759502efa42cbbc54100882284f095cc12adfc0 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -748,10 +748,18 @@ function kvmx_up {
     local item
     IFS=","
     for item in $startup_rsync_to_guest; do
+      if [ -z "$item" ]; then
+        continue
+      fi
+
       local id="`echo $item | cut -d ':' -f 1`"
       local startup_rsync_to_guest_orig="`echo $item | cut -d ':' -f 2`"
       local startup_rsync_to_guest_dest="`echo $item | cut -d ':' -f 3`"
 
+      if [ -z "$id" ] || [ -z "$poweroff_rsync_to_guest_orig" ] || [ -z "$poweroff_rsync_to_guest_dest" ]; then
+        continue
+      fi
+
       echo "Rsyncing to guest: $startup_rsync_to_guest ($id)..."
       kvmx_rsync_to $startup_rsync_to_guest_orig $startup_rsync_to_guest_dest
 
@@ -1038,10 +1046,18 @@ function kvmx_poweroff {
     local item
     IFS=","
     for item in $poweroff_rsync_from_guest; do
+      if [ -z "$item" ]; then
+        continue
+      fi
+
       local id="`echo $item | cut -d ':' -f 1`"
       local poweroff_rsync_from_guest_orig="`echo $item | cut -d ':' -f 2`"
       local poweroff_rsync_from_guest_dest="`echo $item | cut -d ':' -f 3`"
 
+      if [ -z "$id" ] || [ -z "$poweroff_rsync_from_guest_orig" ] || [ -z "$poweroff_rsync_from_guest_dest" ]; then
+        continue
+      fi
+
       echo "Rsyncing from guest: $poweroff_rsync_from_guest ($id)..."
       kvmx_rsync_from $poweroff_rsync_from_guest_orig $poweroff_rsync_from_guest_dest