Fix setup.sh sudo permissions 88/78788/1
authorVictor Morales <victor.morales@intel.com>
Tue, 19 Feb 2019 23:31:40 +0000 (15:31 -0800)
committerVictor Morales <victor.morales@intel.com>
Tue, 19 Feb 2019 23:31:51 +0000 (15:31 -0800)
There are some instructions in the setup.sh script file which require
the addition of sudo instruction. This change fixes them.

Change-Id: If680d9d9aac2a4b22d665b58ab31a4693c71588e
Signed-off-by: Victor Morales <victor.morales@intel.com>
Issue-ID: MULTICLOUD-301

vagrant/setup.sh

index a135ea9..0fb1b0d 100755 (executable)
@@ -159,20 +159,20 @@ if [[ $vendor_id == *GenuineIntel* ]]; then
     kvm_ok=$(cat /sys/module/kvm_intel/parameters/nested)
     if [[ $kvm_ok == 'N' ]]; then
         echo "Enable Intel Nested-Virtualization"
-        rmmod kvm-intel
-        echo 'options kvm-intel nested=y' >> /etc/modprobe.d/dist.conf
-        modprobe kvm-intel
+        sudo rmmod kvm-intel
+        echo 'options kvm-intel nested=y' | sudo tee --append /etc/modprobe.d/dist.conf
+        sudo modprobe kvm-intel
     fi
 else
     kvm_ok=$(cat /sys/module/kvm_amd/parameters/nested)
     if [[ $kvm_ok == '0' ]]; then
         echo "Enable AMD Nested-Virtualization"
-        rmmod kvm-amd
-        sh -c "echo 'options kvm-amd nested=1' >> /etc/modprobe.d/dist.conf"
-        modprobe kvm-amd
+        sudo rmmod kvm-amd
+        echo 'options kvm-amd nested=1' | sudo tee --append /etc/modprobe.d/dist.conf
+        sudo modprobe kvm-amd
     fi
 fi
-modprobe vhost_net
+sudo modprobe vhost_net
 
 ${INSTALLER_CMD} ${packages[@]}
 if ! which pip; then
@@ -193,5 +193,9 @@ if [ $VAGRANT_DEFAULT_PROVIDER == libvirt ]; then
     sudo systemctl enable rpc-statd
     sudo systemctl start rpc-statd
 
-    kvm-ok
+    case ${ID,,} in
+        ubuntu|debian)
+        kvm-ok
+        ;;
+    esac
 fi