From: Stefano Stabellini Date: Wed, 25 Mar 2015 00:12:15 +0000 (+0000) Subject: Introduce unconfigure functions X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=c78da2299f6407d404ed4895a50b67b06a1be8f1;p=people%2Fsstabellini%2Fraisin.git Introduce unconfigure functions Signed-off-by: Stefano Stabellini --- diff --git a/common-functions.sh b/common-functions.sh index 937e2ae..cf877e6 100644 --- a/common-functions.sh +++ b/common-functions.sh @@ -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 1eba4b0..0a5884a 100644 --- 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" +} diff --git a/libvirt.sh b/libvirt.sh index 6141b22..b12a0ef 100644 --- a/libvirt.sh +++ b/libvirt.sh @@ -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 +} diff --git a/unraise.sh b/unraise.sh index c749914..0e981d7 100644 --- a/unraise.sh +++ b/unraise.sh @@ -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 6a23bfe..d827b2e 100644 --- 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 +}