aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-04-02 13:54:48 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-04-02 13:54:48 -0300
commit3d7d4ab5e36c7b89bf6941b9eaf03c17f45d74a8 (patch)
tree0063470da84247509dec716b5775fbf9fa313342
parent4c2e1386844796f83750ae2b86052b92a3ca1515 (diff)
downloadkvmx-3d7d4ab5e36c7b89bf6941b9eaf03c17f45d74a8.tar.gz
kvmx-3d7d4ab5e36c7b89bf6941b9eaf03c17f45d74a8.tar.bz2
Check for ssh_support at kvmx_up
-rwxr-xr-xkvmx56
1 files changed, 29 insertions, 27 deletions
diff --git a/kvmx b/kvmx
index 9fe1288..dc74365 100755
--- a/kvmx
+++ b/kvmx
@@ -297,37 +297,39 @@ function kvmx_up {
kvmx_spice
fi
- let ssh_attempts="0"
- echo -n "Waiting for machine to boot..."
- while true; do
- echo true | $SSH_COMMAND -o ConnectTimeout=2 -o NumberOfPasswordPrompts=0 -p $SSH $SSH_LOGIN@127.0.0.1 &> /dev/null && break
- echo -n "."
- let ssh_attempts++
-
- if [ "$ssh_attempts" == "20" ]; then
- echo "$BASENAME: timeout or access denied when trying to SSH into $VM."
- echo "$BASENAME: please check if the image is in a good state and if it accepts passwordless ssh connections"
- kvmx_stop
- exit 1
- fi
+ if [ "$ssh_support" == "y" ]; then
+ let ssh_attempts="0"
+ echo -n "Waiting for machine to boot..."
+ while true; do
+ echo true | $SSH_COMMAND -o ConnectTimeout=2 -o NumberOfPasswordPrompts=0 -p $SSH $SSH_LOGIN@127.0.0.1 &> /dev/null && break
+ echo -n "."
+ let ssh_attempts++
+
+ if [ "$ssh_attempts" == "20" ]; then
+ echo "$BASENAME: timeout or access denied when trying to SSH into $VM."
+ echo "$BASENAME: please check if the image is in a good state and if it accepts passwordless ssh connections"
+ kvmx_stop
+ exit 1
+ fi
- sleep 2
- done
- echo " done."
- #sleep 5
- #echo ""
+ sleep 2
+ done
+ echo " done."
+ #sleep 5
+ #echo ""
- # Somehow it is starting before DBUS and then crashing, so we try to start again
- echo "Ensure spice-vdagent is running..."
- echo "sudo /usr/sbin/service spice-vdagent start" | kvmx_ssh
+ # Somehow it is starting before DBUS and then crashing, so we try to start again
+ echo "Ensure spice-vdagent is running..."
+ echo "sudo /usr/sbin/service spice-vdagent start" | kvmx_ssh
- kvmx_hostname
+ kvmx_hostname
- if [ ! -z "$shared_folder" ] && [ ! -z "$shared_folder_mountpoint" ]; then
- echo "Mounting $shared_folder on $shared_folder_mountpoint on guest..."
- echo "sudo mkdir -p $shared_folder_mountpoint" | kvmx_ssh
- echo "sudo mount -t 9p -o trans=virtio shared $shared_folder_mountpoint -oversion=9p2000.L,posixacl,cache=loose" | kvmx_ssh
- #echo "sudo mount //10.0.2.4/qemu $shared_folder_mountpint" | kvmx_ssh
+ if [ ! -z "$shared_folder" ] && [ ! -z "$shared_folder_mountpoint" ]; then
+ echo "Mounting $shared_folder on $shared_folder_mountpoint on guest..."
+ echo "sudo mkdir -p $shared_folder_mountpoint" | kvmx_ssh
+ echo "sudo mount -t 9p -o trans=virtio shared $shared_folder_mountpoint -oversion=9p2000.L,posixacl,cache=loose" | kvmx_ssh
+ #echo "sudo mount //10.0.2.4/qemu $shared_folder_mountpint" | kvmx_ssh
+ fi
fi
kvmx_status