aboutsummaryrefslogtreecommitdiff
path: root/kvmx
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-04-04 10:41:40 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-04-04 10:41:40 -0300
commit4fee4766a68532bf4d07bd898e3c09ca6f233640 (patch)
tree9e5ba7df4a5cfc70aae5a21c4e84a1cab5dc5a9a /kvmx
parentcff0c11f980dab01439d2ae80ac0bb0856fed64c (diff)
downloadkvmx-4fee4766a68532bf4d07bd898e3c09ca6f233640.tar.gz
kvmx-4fee4766a68532bf4d07bd898e3c09ca6f233640.tar.bz2
Guess image name by hostname first if no image param is found
Diffstat (limited to 'kvmx')
-rwxr-xr-xkvmx12
1 files changed, 11 insertions, 1 deletions
diff --git a/kvmx b/kvmx
index 5982754..44ecdd2 100755
--- a/kvmx
+++ b/kvmx
@@ -128,7 +128,17 @@ function __kvmx_initialize {
image_base="$HOME/.local/share/kvmx"
fi
- image="$image_base/$VM/box.img"
+ # There might be trouble managing the guest when project folder name is different from
+ # hostname and no image param is set (kvmx-create puts image in one
+ # place, kvmx expects in the other). So we try to guess first the image by hostname
+ # and then by guest name. Note that it might be possible to have conflicts if there
+ # are machines with hostnames set to the name os other machines. But here we hope that
+ # the user is not messing that much ;)
+ if [ ! -z "$hostname" ] && [ -e "$image_base/$hostname/box.img" ]; then
+ image="$image_base/$hostname/box.img"
+ else
+ image="$image_base/$VM/box.img"
+ fi
fi
# Box and folder config