aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2017-04-02 14:22:13 -0300
committerSilvio Rhatto <rhatto@riseup.net>2017-04-02 14:22:13 -0300
commit5dd8a464728885ecbb6f894aed111372aacd4606 (patch)
tree5e19e1dd0732d462f0b6e8928217a53410fc8dfb
parent3d7d4ab5e36c7b89bf6941b9eaf03c17f45d74a8 (diff)
downloadkvmx-5dd8a464728885ecbb6f894aed111372aacd4606.tar.gz
kvmx-5dd8a464728885ecbb6f894aed111372aacd4606.tar.bz2
Check for ssh_support before doing some admin tasks
-rwxr-xr-xkvmx12
1 files changed, 6 insertions, 6 deletions
diff --git a/kvmx b/kvmx
index dc74365..cdd0d39 100755
--- 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 #######