From fa8b1d95d85350e76b2a1f07953b5801b9eeadba Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 9 Mar 2017 22:52:49 -0300 Subject: Fine tuning --- README.md | 2 +- kvmx | 36 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index a64544d..2f53583 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Simply clone it and add to your `$PATH`: ## Basic usage kvmx init [project-name] [project-folder] # initialize - kvmx edit [project-name] # customize + kvmx edit [project-name] # optional customization kvmx up [project-name] # bring it up! If no project name is specified, the current folder name is assumed as the project name. diff --git a/kvmx b/kvmx index 38ddfba..0ac2776 100755 --- a/kvmx +++ b/kvmx @@ -12,19 +12,17 @@ GLOBAL_USER_CONFIG_FOLDER="$HOME/.config/kvmx" # Run spice client function kvmx_spice { - if [ "$run_spice_client" == "1" ]; then - # https://lists.freedesktop.org/archives/spice-devel/2013-September/014643.html - SPICE_NOGRAB=1 spicec --host localhost --port $PORT & - #spicy -h localhost -p $PORT - #remote-viewer spice://localhost:$PORT + # https://lists.freedesktop.org/archives/spice-devel/2013-September/014643.html + SPICE_NOGRAB=1 spicec --host localhost --port $PORT & + #spicy -h localhost -p $PORT + #remote-viewer spice://localhost:$PORT - # Give time to boot - sleep 5 + # Give time to boot + sleep 5 - # Fix window titles - if which /usr/bin/xdotool &> /dev/null; then - xdotool search --name "SPICEc:0" set_window --name $VM - fi + # Fix window titles + if which /usr/bin/xdotool &> /dev/null; then + xdotool search --name "SPICEc:0" set_window --name $VM fi } @@ -79,7 +77,9 @@ function kvmx_up { echo $PORT > $PORTFILE echo $SSH > $SSHFILE - kvmx_spice + if [ "$run_spice_client" == "1" ]; then + kvmx_spice + fi } # Display usage @@ -255,6 +255,7 @@ function kvmx_init { # Copy config from template if [ ! -e "$FOLDER/kvmxfile" ]; then cp $DIRNAME/kvmxfile $FOLDER/ + sed -i -e "s|hostname=\"machine\"|hostname=\"$VM\"|g" $FOLDER/kvmxfile fi # Create config entry @@ -298,6 +299,7 @@ function kvmx_clone { # Update config file new_image="$FOLDER/`basename $image`" sed -i -e "s|image=\"$image\"|image=\"$new_image\"|g" $GLOBAL_USER_CONFIG_FOLDER/$DEST + sed -i -e "s|hostname=\"$VM\"|hostname=\"$DEST\"|g" $GLOBAL_USER_CONFIG_FOLDER/$DEST } # Edit guest config @@ -325,19 +327,17 @@ function kvmx_stop { function kvmx_destroy { kvmx_stop - #rm -f $image - rm -f $PIDFILE - rm -f $SSHFILE - rm -f $PORTFILE - rm -f $LOGFILE + rm -f $image + rm -rf $STATE_DIR - echo "$BASENAME: please inspect and remove `dirname $image` manually." + echo "$BASENAME: removed image and state files, but not the whole`dirname $image` folder." } # Purge a guest and all its configuration function kvmx_purge { kvmx_destroy rm -f $GLOBAL_USER_CONFIG_FOLDER/$VM + echo "$BASENAME: removed $GLOBAL_USER_CONFIG_FOLDER/$VM config." } # Provision a machine -- cgit v1.2.3