]> gitweb.fluxo.info Git - kvmx.git/commitdiff
Check for ssh_support before doing some admin tasks
authorSilvio Rhatto <rhatto@riseup.net>
Sun, 2 Apr 2017 17:22:13 +0000 (14:22 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sun, 2 Apr 2017 17:22:13 +0000 (14:22 -0300)
kvmx

diff --git a/kvmx b/kvmx
index dc74365cb5a6f4d23a29a2189f2d2b8ae50b9546..cdd0d390ad28a6313e7cac3b36a605e6dbfcc893 100755 (executable)
--- a/kvmx
+++ b/kvmx
@@ -318,12 +318,12 @@ function kvmx_up {
     #sleep 5
     #echo ""
 
+    kvmx_hostname
+
     # 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
-
     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
@@ -349,16 +349,16 @@ function kvmx_hostname {
 
   # Set hosts entry
   if ! grep -q "^127.0.0.1 $hostname.$domain $hostname$" /etc/hosts; then
-    echo "127.0.0.1 $hostname.$domain $hostname" | sudo tee -a /etc/hosts > /dev/null
+    echo "127.0.0.1 $hostname.$domain $hostname" | sudo tee -a /etc/hosts &> /dev/null
   fi
 
-  echo "$hostname.$domain" | sudo tee /etc/hostname > /dev/null
-  sudo hostname $hostname.$domain
+  echo "$hostname.$domain" | sudo tee /etc/hostname &> /dev/null
+  sudo hostname $hostname.$domain 2> /dev/null
 
   # Remove old hostname from hosts file
   if [ "\$OLD_HOST" != "$hostname.$domain" ]; then
     if grep -q \$OLD_HOST /etc/hosts; then
-      sudo sed -i -e "/\$OLD_HOST/d" /etc/hosts
+      sudo sed -i -e "/\$OLD_HOST/d" /etc/hosts 2> /dev/null
     fi
   fi
   ##### END REMOTE SCRIPT #######