]> xenbits.xensource.com Git - people/sstabellini/raisin.git/commitdiff
Introduce unconfigure functions
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 25 Mar 2015 00:12:15 +0000 (00:12 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 25 Mar 2015 00:23:16 +0000 (00:23 +0000)
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
common-functions.sh
grub.sh
libvirt.sh
unraise.sh
xen.sh

index 937e2ae2fb5b1710d041e350c1b4c8271cd44749..cf877e6017fb1e9b6c1cd24d8d4d27b851183a65 100644 (file)
@@ -128,3 +128,26 @@ function start_initscripts() {
     done
 }
 
+function stop_initscripts() {
+    while test $# -ge 1
+    do
+        if test ! -f $1
+        then
+            shift 1
+            continue
+        fi
+        case $DISTRO in
+            "Debian" )
+            $SUDO update-rc.d $1 remove || echo "Couldn't remove $1 from init"
+            ;;
+            "Fedora" )
+            $SUDO chkconfig --del $1 || echo "Couldn't remove $1 from init"
+            ;;
+            * )
+            echo "I don't know how to start initscripts on $DISTRO"
+            return 1
+            ;;
+        esac
+        shift 1
+    done
+}
diff --git a/grub.sh b/grub.sh
index 1eba4b072a3ead864398ab2112699688da442272..0a5884a335acb95403cd5ea67c16d932a9d022a2 100644 (file)
--- a/grub.sh
+++ b/grub.sh
@@ -68,3 +68,7 @@ function grub_clean() {
 function grub_configure() {
     echo "Grub: nothing to configure"
 }
+
+function grub_unconfigure() {
+    echo "Grub: nothing to unconfigure"
+}
index 6141b222fe9f2986fbf458e609a086ae75f54b29..b12a0ef0a71f267dba279b4d58a49e2ca809345e 100644 (file)
@@ -70,3 +70,7 @@ function libvirt_clean() {
 function libvirt_configure() {
     start_initscripts libvirtd libvirt-guests virtlockd
 }
+
+function libvirt_unconfigure() {
+    stop_initscripts libvirtd libvirt-guests virtlockd
+}
index c74991426bcf635d721ebe83eb38a3684921caae..0e981d7f0ff47225f7b25f367cbfb0cdd4e4447c 100644 (file)
@@ -3,6 +3,7 @@
 set -e
 
 source config
+source common-functions.sh
 
 export PWD=`pwd`
 export GIT=${GIT-git}
@@ -17,9 +18,14 @@ xen_clean
 grub_clean
 libvirt_clean
 
-for i in `cat /var/log/raisin.log`
+xen_unconfigure
+grub_unconfigure
+libvirt_unconfigure
+
+for i in `cat /var/log/raisin.log 2>/dev/null`
 do
     rm -rf /"$i"
 done
 rm -rf /var/log/raisin.log
 rm -rf "$INST_DIR"
+
diff --git a/xen.sh b/xen.sh
index 6a23bfea1c0a74d8fff61b8a89c4c519637a9da1..d827b2e18e859748278056db3bc2b6653ff2c1e0 100644 (file)
--- a/xen.sh
+++ b/xen.sh
@@ -120,3 +120,12 @@ function xen_configure() {
     start_initscripts xencommons xendomains xen-watchdog
     xen_update_bootloader_$DISTRO
 }
+
+function xen_unconfigure() {
+    # leave the bridge in place
+    stop_initscripts xencommons xendomains xen-watchdog
+    if test "`grep -rIi xen /boot/grub* | head -1`"
+    then
+        xen_update_bootloader_$DISTRO
+    fi
+}