fuel plugin: Initial version
[ovsnfv.git] / fuel-plugin-ovsnfv / deployment_scripts / puppet / modules / ovsdpdk / files / clean.sh
1 #!/usr/bin/env bash
2
3 # Short script for uninstallation of OVS with DPDK
4
5 # enable debugging:
6 #set -o xtrace
7
8 # Stopping service if needed
9 echo "[debug] stopping ovs-dpdk (if needed)"
10 sudo service ovs-dpdk status 2>&1 1>/dev/null
11 res=$?
12
13 if [ $res -eq 2 ]; then
14     echo "[warning] service ovs-dpdk is already stopped"
15 else
16     echo "[debug] stopping ovs-dpdk service"
17     sudo service ovs-dpdk stop 2>&1 1>/dev/null
18 fi
19
20 # Remove  ovs-dpdk service
21 echo "[debug] removing ovs-dpdk service"
22 sudo rm -f /etc/default/ovs-dpdk
23 sudo rm -f /etc/init.d/ovs-dpdk
24
25 # kvm wrapper
26 echo "[debug] replacing kvm wrapper"
27 if [ -e /usr/bin/kvm ]; then
28     KVM_CMD="/usr/bin/kvm"
29 elif [ -e /usr/bin/qemu-kvm ]; then
30     KVM_CMD="/usr/bin/qemu-kvm"
31 elif [ -e /usr/libexec/qemu-kvm ]; then
32     KVM_CMD="/usr/libexec/qemu-kvm"
33 else
34     echo "[warning] package qemu-kvm probably not installed"
35 fi
36
37 cat << 'EOF' | sudo tee  $KVM_CMD
38 #!/bin/sh
39
40 exec /usr/bin/qemu-system-x86_64  "${args[@]}"
41 EOF
42
43
44 # remove git repos
45 echo "[warning] git repos were not automatically removed, you can remove it once you're finished with them"