diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2017-11-19 11:19:08 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2017-11-19 11:19:08 -0200 |
commit | 8e588ca54f7254ec049f0bbe7d6ff654f53e3653 (patch) | |
tree | 7549987f79c9b4b17920372604a5c3cbcda87f59 | |
parent | e3696e22cb6d450919c9e9dbff34fa9a040869db (diff) | |
download | kvmx-8e588ca54f7254ec049f0bbe7d6ff654f53e3653.tar.gz kvmx-8e588ca54f7254ec049f0bbe7d6ff654f53e3653.tar.bz2 |
Support for multiple path pairs at provision_rsync
-rwxr-xr-x | kvmx | 33 | ||||
-rw-r--r-- | kvmxfile | 2 |
2 files changed, 22 insertions, 13 deletions
@@ -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..." @@ -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/" |