From 824a5b9e0a4651669762d5150e58ac53eeee85ab Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 9 Mar 2017 23:14:56 -0300 Subject: Implements simple provisioning --- kvmx | 13 +++++++++++-- kvmxfile | 8 ++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/kvmx b/kvmx index 16ff3eb..9cec362 100755 --- a/kvmx +++ b/kvmx @@ -342,8 +342,17 @@ function kvmx_purge { # Provision a machine function kvmx_provision { - echo "TODO: provision" - exit 1 + if ! kvmx_running; then + echo "$BASENAME: guest $VM is not running" + exit 1 + fi + + if [ -z "$provision_script" ]; then + echo "$BASENAME: error: parameter provision_script is not configured for $VM." + exit 1 + fi + + echo "sudo $provision_script" | kvmx_ssh } # Print guest image file name diff --git a/kvmxfile b/kvmxfile index 32d2600..d8394c8 100644 --- a/kvmxfile +++ b/kvmxfile @@ -5,12 +5,12 @@ # Which base box you should use. Leave unconfigured to use kvmx-create instead. #basebox="stretch" -# Absolute or relative path for a provision script. -#provision_script="default" - # Set this is you want to be able to share folders between host and guest. shared_folder="." -shared_folder_mountpoint="/media/shared" +shared_folder_mountpoint="/home/user/$VM" + +# Absolute path for a provision script located inside the guest. +#provision_script="/home/user/$VM/provision" # Set this if you want to automatically attach an spice client when the machine # boots. -- cgit v1.2.3