aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-11-19 11:19:08 -0200
committerSilvio Rhatto <rhatto@riseup.net>2017-11-19 11:19:08 -0200
commit8e588ca54f7254ec049f0bbe7d6ff654f53e3653 (patch)
tree7549987f79c9b4b17920372604a5c3cbcda87f59
parente3696e22cb6d450919c9e9dbff34fa9a040869db (diff)
downloadkvmx-8e588ca54f7254ec049f0bbe7d6ff654f53e3653.tar.gz
kvmx-8e588ca54f7254ec049f0bbe7d6ff654f53e3653.tar.bz2
Support for multiple path pairs at provision_rsync
-rwxr-xr-xkvmx33
-rw-r--r--kvmxfile2
2 files changed, 22 insertions, 13 deletions
diff --git a/kvmx b/kvmx
index f050219..4ead26a 100755
--- a/kvmx
+++ b/kvmx
@@ -988,18 +988,27 @@ function kvmx_provision {
rsync -av --delete -e "$SSH_COMMAND -o Port=$SSH" $provision_rsync_opts --rsync-path "sudo rsync" $ORIG/ 127.0.0.1:$DEST/
if [ ! -z "$provision_rsync" ]; then
- ORIG="`echo $provision_rsync | cut -d ' ' -f 1`"
- DEST="`echo $provision_rsync | cut -d ' ' -f 2`"
-
- # Sync custom provisioners
- if [ "$ORIG" != "$KVMX_BASE/share/provision/" ] && [ "$DEST" != "/usr/local/share/kvmx/provision/" ]; then
- (
- # Go inside the project folder so a relative $ORIG works
- cd `dirname $KVMXFILE` &> /dev/null
- echo "sudo mkdir -p `dirname $DEST`" | kvmx_ssh
- rsync -av -e "$SSH_COMMAND -o Port=$SSH" $provision_rsync_opts --rsync-path "sudo rsync" $ORIG/ 127.0.0.1:$DEST/
- )
- fi
+ local old_ifs="$IFS"
+ IFS=","
+
+ for provision_item in $provision_rsync; do
+ IFS="$old_ifs"
+ ORIG="`echo $provision_item | cut -d ' ' -f 1`"
+ DEST="`echo $provision_item | cut -d ' ' -f 2`"
+
+ # Sync custom provisioners
+ if [ "$ORIG" != "$KVMX_BASE/share/provision/" ] && [ "$DEST" != "/usr/local/share/kvmx/provision/" ]; then
+ (
+ # Go inside the project folder so a relative $ORIG works
+ cd `dirname $KVMXFILE` &> /dev/null
+ echo "sudo mkdir -p `dirname $DEST`" | kvmx_ssh
+ rsync -av -e "$SSH_COMMAND -o Port=$SSH" $provision_rsync_opts --rsync-path "sudo rsync" $ORIG/ 127.0.0.1:$DEST/
+ )
+ fi
+ IFS=","
+ done
+
+ IFS="$old_ifs"
fi
echo "Running provision command inside the guest..."
diff --git a/kvmxfile b/kvmxfile
index 74cb4a5..1ffc352 100644
--- a/kvmxfile
+++ b/kvmxfile
@@ -22,7 +22,7 @@ shared_folder_mountpoint="/home/$user/code/$VM"
# Format: <id1>:<host-folder1>:<guest-mountpoint1>,<id2>:<host-folder2>:<guest-mountpoint2>[,...]
#shared_folders="shared1:.:/home/$user/code/$VM,shared2:$HOME/.local/share/app:/home/$user/.local/share/app"
-# Folder to sync during provisioning in the format "/host/folder /guest/folder".
+# Folder to sync during provisioning in the format "/host/folder1 /guest/folder1,/host/folder2 /guest/folder2[,...]".
#provision_rsync="$KVMX_BASE/share/provision/ /usr/local/share/kvmx/provision/"
#provision_rsync="puppet/ /etc/puppet/"