Fix p4vm script to export ova and tutorial script

- Modify missing command in tutorial-bootstrap.sh
- Modify command order in ova-cleanup.sh
- Modify the way to execute ovs-cleanup.sh in vm

Change-Id: Ib010d07b31d9b06f3c4b04d34b2036c0058ca300
(cherry picked from commit f1a04004363d2c59108ad3ca9277c09ec1a2167a)
diff --git a/tools/dev/p4vm/export-ova.sh b/tools/dev/p4vm/export-ova.sh
index d7d8447..96500f2 100755
--- a/tools/dev/p4vm/export-ova.sh
+++ b/tools/dev/p4vm/export-ova.sh
@@ -70,9 +70,7 @@
 fi
 
 # Cleanup
-sshpass -p 'rocks' \
-    ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no \
-    -p ${SSH_PORT} sdn@127.0.0.1 "bash /vagrant/ova-cleanup.sh"
+vagrant ssh -c 'bash /vagrant/ova-cleanup.sh' ${VM_TYPE}
 sleep 5
 vboxmanage controlvm ${VB_UUID} acpipowerbutton
 wait_vm_shutdown ${VB_UUID}
diff --git a/tools/dev/p4vm/ova-cleanup.sh b/tools/dev/p4vm/ova-cleanup.sh
index bcde882..95fa468 100755
--- a/tools/dev/p4vm/ova-cleanup.sh
+++ b/tools/dev/p4vm/ova-cleanup.sh
@@ -2,9 +2,6 @@
 
 set -xe
 
-# Delete vagrant user
-sudo userdel -r -f vagrant
-
 # Free space on disk
 sudo rm -rf ~/p4tools
 sudo rm -rf ~/quagga
@@ -25,3 +22,7 @@
 
 history -c
 rm -f ~/.bash_history
+
+# Delete vagrant user
+sudo userdel -r -f vagrant
+
diff --git a/tools/dev/p4vm/tutorial-bootstrap.sh b/tools/dev/p4vm/tutorial-bootstrap.sh
index eb38786..1c7b566 100755
--- a/tools/dev/p4vm/tutorial-bootstrap.sh
+++ b/tools/dev/p4vm/tutorial-bootstrap.sh
@@ -9,10 +9,10 @@
 echo "lightdm shared/default-x-display-manager select lightdm" | debconf-set-selections
 
 # Install ubuntu desktop from tasksel
-apt-get -y --no-install-recommends tasksel
-tasksel ubuntu-desktop
+apt-get install -y --no-install-recommends tasksel
+DEBIAN_FRONTEND=noninteractive tasksel install ubuntu-desktop
 # Remove gnome, install unity
-apt-get remove gdm3 ubuntu-desktop
+apt-get remove -y gdm3 ubuntu-desktop
 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
     ubuntu-unity-desktop lightdm \
     gnome-panel \
@@ -27,4 +27,4 @@
 
 DEBIAN_FRONTEND=noninteractive apt-get -y install wireshark
 echo "wireshark-common wireshark-common/install-setuid boolean true" | debconf-set-selections
-DEBIAN_FRONTEND=noninteractive dpkg-reconfigure wireshark-common
\ No newline at end of file
+DEBIAN_FRONTEND=noninteractive dpkg-reconfigure wireshark-common