]> xenbits.xensource.com Git - people/sstabellini/raisin.git/commitdiff
Execute modules dynamically
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>
Wed, 25 Mar 2015 22:36:17 +0000 (22:36 +0000)
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>
Thu, 26 Mar 2015 02:45:47 +0000 (02:45 +0000)
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
common-functions.sh
components/grub [new file with mode: 0644]
components/grub.sh [deleted file]
components/libvirt [new file with mode: 0644]
components/libvirt.sh [deleted file]
components/series [new file with mode: 0644]
components/xen [new file with mode: 0644]
components/xen.sh [deleted file]
raise.sh
unraise.sh

index cf877e6017fb1e9b6c1cd24d8d4d27b851183a65..c68a373c0a5301963cc10c537728d4f93e3e1945 100644 (file)
@@ -151,3 +151,14 @@ function stop_initscripts() {
         shift 1
     done
 }
+
+for_each_component () {
+    for component in `cat "$BASEDIR"/components/series`
+    do
+        capital=`echo $component | tr '[:lower:]' '[:upper:]'`
+        if test "`eval echo \$"$capital"_UPSTREAM_URL`"
+        then
+            "$component"_"$1"
+        fi
+    done
+}
diff --git a/components/grub b/components/grub
new file mode 100644 (file)
index 0000000..14ffca3
--- /dev/null
@@ -0,0 +1,76 @@
+#!/usr/bin/env bash
+
+source "$BASEDIR"/config
+source "$BASEDIR"/common-functions.sh
+
+
+function grub_install_dependencies() {
+    local DEP_Debian_common="build-essential tar autoconf bison flex"
+    local DEP_Debian_x86_32="$DEP_Debian_common"
+    local DEP_Debian_x86_64="$DEP_Debian_common libc6-dev-i386"
+    local DEP_Debian_arm32="$DEP_Debian_common"
+    local DEP_Debian_arm64="$DEP_Debian_common"
+
+    local DEP_Fedora_common="make gcc tar automake autoconf sysconftool bison flex \
+                             glibc-devel"
+    local DEP_Fedora_x86_32="$DEP_Fedora_common"
+    local DEP_Fedora_x86_64="$DEP_Fedora_common glibc-devel.i686"
+
+
+    if test $ARCH != "x86_64" && test $ARCH != "x86_32"
+    then
+        echo grub is only supported on x86_32 and x86_64
+        return
+    fi
+    echo installing Grub dependencies
+    eval install_dependencies \$DEP_"$DISTRO"_"$ARCH"
+}
+
+
+function grub_build() {
+    grub_install_dependencies
+
+    cd "$BASEDIR"
+    rm -f memdisk.tar
+    tar cf memdisk.tar grub.cfg
+    ./git-checkout.sh $GRUB_UPSTREAM_URL $GRUB_UPSTREAM_REVISION grub-dir
+    cd grub-dir
+    ./autogen.sh
+    ## GRUB32
+    ./configure --target=i386 --with-platform=xen
+    $MAKE CPPFLAGS="-I$INST_DIR/$PREFIX/include"
+    ./grub-mkimage -d grub-core -O i386-xen -c ../grub-bootstrap.cfg \
+      -m ../memdisk.tar -o grub-i386-xen grub-core/*mod
+    cp grub-i386-xen "$INST_DIR"/$PREFIX/lib/xen/boot
+    ## GRUB64
+    if test $ARCH = "x86_64"
+    then
+        $MAKE clean
+        ./configure --target=amd64 --with-platform=xen
+        $MAKE CPPFLAGS="-I$INST_DIR/$PREFIX/include"
+        ./grub-mkimage -d grub-core -O x86_64-xen -c ../grub-bootstrap.cfg \
+          -m ../memdisk.tar -o grub-x86_64-xen grub-core/*mod
+        cp grub-x86_64-xen "$INST_DIR"/$PREFIX/lib/xen/boot
+    fi
+    cd "$BASEDIR"
+}
+
+function grub_clean() {
+    cd "$BASEDIR"
+    rm -rf memdisk.tar
+    if test -d grub-dir
+    then
+        cd grub-dir
+        $MAKE distclean
+        cd ..
+        rm -rf grub-dir
+    fi
+}
+
+function grub_configure() {
+    echo "Grub: nothing to configure"
+}
+
+function grub_unconfigure() {
+    echo "Grub: nothing to unconfigure"
+}
diff --git a/components/grub.sh b/components/grub.sh
deleted file mode 100644 (file)
index 14ffca3..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-#!/usr/bin/env bash
-
-source "$BASEDIR"/config
-source "$BASEDIR"/common-functions.sh
-
-
-function grub_install_dependencies() {
-    local DEP_Debian_common="build-essential tar autoconf bison flex"
-    local DEP_Debian_x86_32="$DEP_Debian_common"
-    local DEP_Debian_x86_64="$DEP_Debian_common libc6-dev-i386"
-    local DEP_Debian_arm32="$DEP_Debian_common"
-    local DEP_Debian_arm64="$DEP_Debian_common"
-
-    local DEP_Fedora_common="make gcc tar automake autoconf sysconftool bison flex \
-                             glibc-devel"
-    local DEP_Fedora_x86_32="$DEP_Fedora_common"
-    local DEP_Fedora_x86_64="$DEP_Fedora_common glibc-devel.i686"
-
-
-    if test $ARCH != "x86_64" && test $ARCH != "x86_32"
-    then
-        echo grub is only supported on x86_32 and x86_64
-        return
-    fi
-    echo installing Grub dependencies
-    eval install_dependencies \$DEP_"$DISTRO"_"$ARCH"
-}
-
-
-function grub_build() {
-    grub_install_dependencies
-
-    cd "$BASEDIR"
-    rm -f memdisk.tar
-    tar cf memdisk.tar grub.cfg
-    ./git-checkout.sh $GRUB_UPSTREAM_URL $GRUB_UPSTREAM_REVISION grub-dir
-    cd grub-dir
-    ./autogen.sh
-    ## GRUB32
-    ./configure --target=i386 --with-platform=xen
-    $MAKE CPPFLAGS="-I$INST_DIR/$PREFIX/include"
-    ./grub-mkimage -d grub-core -O i386-xen -c ../grub-bootstrap.cfg \
-      -m ../memdisk.tar -o grub-i386-xen grub-core/*mod
-    cp grub-i386-xen "$INST_DIR"/$PREFIX/lib/xen/boot
-    ## GRUB64
-    if test $ARCH = "x86_64"
-    then
-        $MAKE clean
-        ./configure --target=amd64 --with-platform=xen
-        $MAKE CPPFLAGS="-I$INST_DIR/$PREFIX/include"
-        ./grub-mkimage -d grub-core -O x86_64-xen -c ../grub-bootstrap.cfg \
-          -m ../memdisk.tar -o grub-x86_64-xen grub-core/*mod
-        cp grub-x86_64-xen "$INST_DIR"/$PREFIX/lib/xen/boot
-    fi
-    cd "$BASEDIR"
-}
-
-function grub_clean() {
-    cd "$BASEDIR"
-    rm -rf memdisk.tar
-    if test -d grub-dir
-    then
-        cd grub-dir
-        $MAKE distclean
-        cd ..
-        rm -rf grub-dir
-    fi
-}
-
-function grub_configure() {
-    echo "Grub: nothing to configure"
-}
-
-function grub_unconfigure() {
-    echo "Grub: nothing to unconfigure"
-}
diff --git a/components/libvirt b/components/libvirt
new file mode 100644 (file)
index 0000000..d198bb3
--- /dev/null
@@ -0,0 +1,78 @@
+#!/usr/bin/env bash
+
+source "$BASEDIR"/config
+source "$BASEDIR"/common-functions.sh
+
+
+function libvirt_install_dependencies() {
+    local DEP_Debian_common="build-essential libtool autoconf autopoint \
+                             xsltproc libxml2-utils pkg-config python-dev   \
+                             libxml-xpath-perl libyajl-dev libxml2-dev      \
+                             gettext libdevmapper-dev libnl-3-dev           \
+                             libnl-route-3-dev"
+    local DEP_Debian_x86_32="$DEP_Debian_common"
+    local DEP_Debian_x86_64="$DEP_Debian_common"
+    local DEP_Debian_arm32="$DEP_Debian_common"
+    local DEP_Debian_arm64="$DEP_Debian_common"
+
+    local DEP_Fedora_common="patch make gcc libtool autoconf gettext-devel     \
+                             python-devel libxslt yajl-devel libxml2-devel     \
+                             device-mapper-devel libpciaccess-devel            \
+                             libuuid-devel perl-XML-XPath"
+    local DEP_Fedora_x86_32="$DEP_Fedora_common"
+    local DEP_Fedora_x86_64="$DEP_Fedora_common"
+
+    echo installing Libvirt dependencies
+    eval install_dependencies \$DEP_"$DISTRO"_"$ARCH"
+}
+
+function libvirt_build() {
+    libvirt_install_dependencies
+
+    cd "$BASEDIR"
+    ./git-checkout.sh $LIBVIRT_UPSTREAM_URL $LIBVIRT_UPSTREAM_REVISION libvirt-dir
+    cd libvirt-dir
+    CFLAGS="-I$INST_DIR/$PREFIX/include" \
+    LDFLAGS="-L$INST_DIR/$PREFIX/lib -Wl,-rpath-link=$INST_DIR/$PREFIX/lib" \
+    ./autogen.sh --with-xen --without-qemu --without-uml --without-openvz \
+        --without-vmware --without-phyp --without-xenapi --with-libxl     \
+        --without-vbox --without-lxc --without-esx --without-hyperv       \
+        --without-parallels --without-test --with-libvirtd --without-sasl \
+        --with-yajl --without-macvtap --without-avahi  --prefix=$PREFIX
+    $MAKE
+    $MAKE --ignore-errors install DESTDIR="$INST_DIR" || true
+    if test $DISTRO = "Debian"
+    then
+        mkdir -p "$INST_DIR"/etc/init.d
+        cat ../libvirt.debian.init | sed -e "s,@PREFIX,$PREFIX,g" > "$INST_DIR"/etc/init.d/libvirtd
+        chmod +x "$INST_DIR"/etc/init.d/libvirtd
+    elif test $DISTRO = "Fedora" || test $DISTRO = "CentOS"
+    then
+        $MAKE -C daemon libvirtd.init
+        mkdir -p "$INST_DIR"/etc/rc.d/init.d
+        cp daemon/libvirtd.init "$INST_DIR"/etc/rc.d/init.d/libvirtd
+        chmod +x "$INST_DIR"/etc/rc.d/init.d/libvirtd
+    else
+        echo "I don't know how write an init script for Libvirt on $DISTRO"
+    fi
+    cd ..
+}
+
+function libvirt_clean() {
+    cd "$BASEDIR"
+    if test -d libvirt-dir
+    then
+        cd libvirt-dir
+        $MAKE distclean
+        cd ..
+        rm -rf libvirt-dir
+    fi
+}
+
+function libvirt_configure() {
+    start_initscripts libvirtd libvirt-guests virtlockd
+}
+
+function libvirt_unconfigure() {
+    stop_initscripts libvirtd libvirt-guests virtlockd
+}
diff --git a/components/libvirt.sh b/components/libvirt.sh
deleted file mode 100644 (file)
index d198bb3..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env bash
-
-source "$BASEDIR"/config
-source "$BASEDIR"/common-functions.sh
-
-
-function libvirt_install_dependencies() {
-    local DEP_Debian_common="build-essential libtool autoconf autopoint \
-                             xsltproc libxml2-utils pkg-config python-dev   \
-                             libxml-xpath-perl libyajl-dev libxml2-dev      \
-                             gettext libdevmapper-dev libnl-3-dev           \
-                             libnl-route-3-dev"
-    local DEP_Debian_x86_32="$DEP_Debian_common"
-    local DEP_Debian_x86_64="$DEP_Debian_common"
-    local DEP_Debian_arm32="$DEP_Debian_common"
-    local DEP_Debian_arm64="$DEP_Debian_common"
-
-    local DEP_Fedora_common="patch make gcc libtool autoconf gettext-devel     \
-                             python-devel libxslt yajl-devel libxml2-devel     \
-                             device-mapper-devel libpciaccess-devel            \
-                             libuuid-devel perl-XML-XPath"
-    local DEP_Fedora_x86_32="$DEP_Fedora_common"
-    local DEP_Fedora_x86_64="$DEP_Fedora_common"
-
-    echo installing Libvirt dependencies
-    eval install_dependencies \$DEP_"$DISTRO"_"$ARCH"
-}
-
-function libvirt_build() {
-    libvirt_install_dependencies
-
-    cd "$BASEDIR"
-    ./git-checkout.sh $LIBVIRT_UPSTREAM_URL $LIBVIRT_UPSTREAM_REVISION libvirt-dir
-    cd libvirt-dir
-    CFLAGS="-I$INST_DIR/$PREFIX/include" \
-    LDFLAGS="-L$INST_DIR/$PREFIX/lib -Wl,-rpath-link=$INST_DIR/$PREFIX/lib" \
-    ./autogen.sh --with-xen --without-qemu --without-uml --without-openvz \
-        --without-vmware --without-phyp --without-xenapi --with-libxl     \
-        --without-vbox --without-lxc --without-esx --without-hyperv       \
-        --without-parallels --without-test --with-libvirtd --without-sasl \
-        --with-yajl --without-macvtap --without-avahi  --prefix=$PREFIX
-    $MAKE
-    $MAKE --ignore-errors install DESTDIR="$INST_DIR" || true
-    if test $DISTRO = "Debian"
-    then
-        mkdir -p "$INST_DIR"/etc/init.d
-        cat ../libvirt.debian.init | sed -e "s,@PREFIX,$PREFIX,g" > "$INST_DIR"/etc/init.d/libvirtd
-        chmod +x "$INST_DIR"/etc/init.d/libvirtd
-    elif test $DISTRO = "Fedora" || test $DISTRO = "CentOS"
-    then
-        $MAKE -C daemon libvirtd.init
-        mkdir -p "$INST_DIR"/etc/rc.d/init.d
-        cp daemon/libvirtd.init "$INST_DIR"/etc/rc.d/init.d/libvirtd
-        chmod +x "$INST_DIR"/etc/rc.d/init.d/libvirtd
-    else
-        echo "I don't know how write an init script for Libvirt on $DISTRO"
-    fi
-    cd ..
-}
-
-function libvirt_clean() {
-    cd "$BASEDIR"
-    if test -d libvirt-dir
-    then
-        cd libvirt-dir
-        $MAKE distclean
-        cd ..
-        rm -rf libvirt-dir
-    fi
-}
-
-function libvirt_configure() {
-    start_initscripts libvirtd libvirt-guests virtlockd
-}
-
-function libvirt_unconfigure() {
-    stop_initscripts libvirtd libvirt-guests virtlockd
-}
diff --git a/components/series b/components/series
new file mode 100644 (file)
index 0000000..3c3124d
--- /dev/null
@@ -0,0 +1,3 @@
+xen
+grub
+libvirt
diff --git a/components/xen b/components/xen
new file mode 100644 (file)
index 0000000..14655b7
--- /dev/null
@@ -0,0 +1,133 @@
+#!/usr/bin/env bash
+
+source "$BASEDIR"/config
+source "$BASEDIR"/common-functions.sh
+
+
+function xen_install_dependencies() {
+    local DEP_Debian_common="build-essential python-dev gettext uuid-dev   \
+             libncurses5-dev libyajl-dev libaio-dev pkg-config libglib2.0-dev  \
+             libssl-dev libpixman-1-dev bridge-utils"
+    local DEP_Debian_x86_32="$DEP_Debian_common bcc iasl bin86 texinfo"
+    local DEP_Debian_x86_64="$DEP_Debian_x86_32 libc6-dev-i386"
+    local DEP_Debian_arm32="$DEP_Debian_common libfdt-dev"
+    local DEP_Debian_arm64="$DEP_Debian_arm32"
+
+    local DEP_Fedora_common="make gcc python-devel gettext libuuid-devel   \
+             ncurses-devel glib2-devel libaio-devel openssl-devel yajl-devel   \
+             patch pixman-devel glibc-devel bridge-utils grub2"
+    local DEP_Fedora_x86_32="$DEP_Fedora_common dev86 iasl texinfo"
+    local DEP_Fedora_x86_64="$DEP_Fedora_x86_32 glibc-devel.i686"
+
+    echo installing Xen dependencies
+    eval install_dependencies \$DEP_"$DISTRO"_"$ARCH"
+}
+
+function xen_build() {
+    xen_install_dependencies
+
+    cd "$BASEDIR"
+    ./git-checkout.sh $XEN_UPSTREAM_URL $XEN_UPSTREAM_REVISION xen-dir
+    cd xen-dir
+    ./configure --prefix=$PREFIX
+    $MAKE
+    $MAKE install DESTDIR="$INST_DIR"
+    chmod +x "$INST_DIR"/etc/init.d/xencommons
+    chmod +x "$INST_DIR"/etc/init.d/xendomains
+    chmod +x "$INST_DIR"/etc/init.d/xen-watchdog
+    cd "$BASEDIR"
+}
+
+function xen_clean() {
+    cd "$BASEDIR"
+    if test -d xen-dir
+    then
+        cd xen-dir
+        $MAKE distclean
+        cd "$BASEDIR"
+        rm -rf xen-dir
+    fi
+}
+
+function xen_create_bridge_Debian() {
+    BRIDGE="xenbr0"
+    IFACE=`grep "dhcp" /etc/network/interfaces | head -1 | awk '{print$2}'`
+
+    if test -z "$IFACE"
+    then
+        echo "Please refer to the following page to setup networking:"
+        echo "http://wiki.xenproject.org/wiki/Network_Configuration_Examples_(Xen_4.1%2B)"
+        return 1
+    fi
+    if test "`grep $BRIDGE /etc/network/interfaces`"
+    then
+        echo "a network bridge seems to be already setup"
+        return 0
+    fi
+
+    TMPFILE=`mktemp`
+    cat /etc/network/interfaces | \
+        sed -e "s/iface $IFACE inet dhcp/iface $IFACE inet manual/" \
+            -e "/auto/s/\<$IFACE\>/$BRIDGE/g" \
+            -e "/allow-hotplug/s/\<$IFACE\>/$BRIDGE/g" > $TMPFILE
+    echo "" >> $TMPFILE
+    echo "iface $BRIDGE inet dhcp" >> $TMPFILE
+    echo "    bridge_ports $IFACE" >> $TMPFILE
+    $SUDO mv -f $TMPFILE /etc/network/interfaces
+}
+
+function xen_create_bridge_Fedora() {
+    BRIDGE="xenbr0"
+
+    if test "`grep $BRIDGE /etc/sysconfig/network-scripts/*`"
+    then
+        return 0
+    fi
+
+    IFACE=`grep 'BOOTPROTO="dhcp"' /etc/sysconfig/network-scripts/* | head -1 | cut -d : -f 1`
+    if test -z "$IFACE"
+    then
+        return 1
+    fi
+
+    $SUDO chkconfig NetworkManager off
+    $SUDO chkconfig network on
+    $SUDO service NetworkManager stop
+
+    TMPFILE=`mktemp`
+    cat $IFACE | grep -v dhcp | grep -v DHCLIENT > $TMPFILE
+    echo "BRIDGE=$BRIDGE" >> $TMPFILE
+    $SUDO mv -f $TMPFILE $IFACE
+
+    cat ifcfg-xenbr0 | sed -e "s/@BRIDGE/$BRIDGE/g" > $TMPFILE
+    $SUDO mv -f $TMPFILE /etc/sysconfig/network-scripts
+
+    $SUDO iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
+    $SUDO service iptables save
+    $SUDO service iptables restart
+
+    $SUDO service network start
+}
+
+function xen_update_bootloader_Debian() {
+    $SUDO update-grub
+}
+
+function xen_update_bootloader_Fedora() {
+    $SUDO grub2-mkconfig -o /boot/grub2/grub.cfg
+}
+
+function xen_configure() {
+    xen_create_bridge_$DISTRO
+    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
+}
diff --git a/components/xen.sh b/components/xen.sh
deleted file mode 100644 (file)
index 14655b7..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/usr/bin/env bash
-
-source "$BASEDIR"/config
-source "$BASEDIR"/common-functions.sh
-
-
-function xen_install_dependencies() {
-    local DEP_Debian_common="build-essential python-dev gettext uuid-dev   \
-             libncurses5-dev libyajl-dev libaio-dev pkg-config libglib2.0-dev  \
-             libssl-dev libpixman-1-dev bridge-utils"
-    local DEP_Debian_x86_32="$DEP_Debian_common bcc iasl bin86 texinfo"
-    local DEP_Debian_x86_64="$DEP_Debian_x86_32 libc6-dev-i386"
-    local DEP_Debian_arm32="$DEP_Debian_common libfdt-dev"
-    local DEP_Debian_arm64="$DEP_Debian_arm32"
-
-    local DEP_Fedora_common="make gcc python-devel gettext libuuid-devel   \
-             ncurses-devel glib2-devel libaio-devel openssl-devel yajl-devel   \
-             patch pixman-devel glibc-devel bridge-utils grub2"
-    local DEP_Fedora_x86_32="$DEP_Fedora_common dev86 iasl texinfo"
-    local DEP_Fedora_x86_64="$DEP_Fedora_x86_32 glibc-devel.i686"
-
-    echo installing Xen dependencies
-    eval install_dependencies \$DEP_"$DISTRO"_"$ARCH"
-}
-
-function xen_build() {
-    xen_install_dependencies
-
-    cd "$BASEDIR"
-    ./git-checkout.sh $XEN_UPSTREAM_URL $XEN_UPSTREAM_REVISION xen-dir
-    cd xen-dir
-    ./configure --prefix=$PREFIX
-    $MAKE
-    $MAKE install DESTDIR="$INST_DIR"
-    chmod +x "$INST_DIR"/etc/init.d/xencommons
-    chmod +x "$INST_DIR"/etc/init.d/xendomains
-    chmod +x "$INST_DIR"/etc/init.d/xen-watchdog
-    cd "$BASEDIR"
-}
-
-function xen_clean() {
-    cd "$BASEDIR"
-    if test -d xen-dir
-    then
-        cd xen-dir
-        $MAKE distclean
-        cd "$BASEDIR"
-        rm -rf xen-dir
-    fi
-}
-
-function xen_create_bridge_Debian() {
-    BRIDGE="xenbr0"
-    IFACE=`grep "dhcp" /etc/network/interfaces | head -1 | awk '{print$2}'`
-
-    if test -z "$IFACE"
-    then
-        echo "Please refer to the following page to setup networking:"
-        echo "http://wiki.xenproject.org/wiki/Network_Configuration_Examples_(Xen_4.1%2B)"
-        return 1
-    fi
-    if test "`grep $BRIDGE /etc/network/interfaces`"
-    then
-        echo "a network bridge seems to be already setup"
-        return 0
-    fi
-
-    TMPFILE=`mktemp`
-    cat /etc/network/interfaces | \
-        sed -e "s/iface $IFACE inet dhcp/iface $IFACE inet manual/" \
-            -e "/auto/s/\<$IFACE\>/$BRIDGE/g" \
-            -e "/allow-hotplug/s/\<$IFACE\>/$BRIDGE/g" > $TMPFILE
-    echo "" >> $TMPFILE
-    echo "iface $BRIDGE inet dhcp" >> $TMPFILE
-    echo "    bridge_ports $IFACE" >> $TMPFILE
-    $SUDO mv -f $TMPFILE /etc/network/interfaces
-}
-
-function xen_create_bridge_Fedora() {
-    BRIDGE="xenbr0"
-
-    if test "`grep $BRIDGE /etc/sysconfig/network-scripts/*`"
-    then
-        return 0
-    fi
-
-    IFACE=`grep 'BOOTPROTO="dhcp"' /etc/sysconfig/network-scripts/* | head -1 | cut -d : -f 1`
-    if test -z "$IFACE"
-    then
-        return 1
-    fi
-
-    $SUDO chkconfig NetworkManager off
-    $SUDO chkconfig network on
-    $SUDO service NetworkManager stop
-
-    TMPFILE=`mktemp`
-    cat $IFACE | grep -v dhcp | grep -v DHCLIENT > $TMPFILE
-    echo "BRIDGE=$BRIDGE" >> $TMPFILE
-    $SUDO mv -f $TMPFILE $IFACE
-
-    cat ifcfg-xenbr0 | sed -e "s/@BRIDGE/$BRIDGE/g" > $TMPFILE
-    $SUDO mv -f $TMPFILE /etc/sysconfig/network-scripts
-
-    $SUDO iptables -I FORWARD -m physdev --physdev-is-bridged -j ACCEPT
-    $SUDO service iptables save
-    $SUDO service iptables restart
-
-    $SUDO service network start
-}
-
-function xen_update_bootloader_Debian() {
-    $SUDO update-grub
-}
-
-function xen_update_bootloader_Fedora() {
-    $SUDO grub2-mkconfig -o /boot/grub2/grub.cfg
-}
-
-function xen_configure() {
-    xen_create_bridge_$DISTRO
-    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
-}
index 28e178e9370d678996c94c87e1082838b211249f..b96e0dffacfb313c822f672416c60da3a8d90435 100755 (executable)
--- a/raise.sh
+++ b/raise.sh
@@ -15,10 +15,6 @@ export INST_DIR=${DESTDIR-dist}
 INST_DIR=`readlink -f $INST_DIR`
 mkdir -p "$INST_DIR" &>/dev/null
 
-source components/xen.sh
-source components/grub.sh
-source components/libvirt.sh
-
 help() {
     echo "Usage: ./build.sh <options>"
     echo "where options are:"
@@ -68,23 +64,14 @@ get_arch
 
 install_dependencies git
 
-# build and install under $DESTDIR ($BASEDIR/dist by default)
-if test "$XEN_UPSTREAM_REVISION"
-then
-    xen_clean
-    xen_build
-fi
-if test "$GRUB_UPSTREAM_REVISION"
-then
-    grub_clean
-    grub_build
-fi
-if test "$LIBVIRT_UPSTREAM_REVISION"
-then
-    libvirt_clean
-    libvirt_build
-fi
+for f in `cat "$BASEDIR"/components/series`
+do
+    source "$BASEDIR"/components/"$f"
+done
 
+# build and install under $DESTDIR ($BASEDIR/dist by default)
+for_each_component clean
+for_each_component build
 
 if test -z "$INST" || test "$INST" -eq 0
 then
@@ -98,17 +85,6 @@ $SUDO mv -f $TMPFILE /var/log/raisin.log
 $SUDO cp -ar * / || true
 
 # configure
-if test "$XEN_UPSTREAM_REVISION"
-then
-    xen_configure
-fi
-if test "$GRUB_UPSTREAM_REVISION"
-then
-    grub_configure
-fi
-if test "$LIBVIRT_UPSTREAM_REVISION"
-then
-    libvirt_configure
-fi
+for_each_component configure
 
 rm -rf "$INST_DIR"
index 0e981d7f0ff47225f7b25f367cbfb0cdd4e4447c..b302e17668b5c22a0ea137ee3913fbd681f26d21 100644 (file)
@@ -5,7 +5,7 @@ set -e
 source config
 source common-functions.sh
 
-export PWD=`pwd`
+export BASEDIR=`pwd`
 export GIT=${GIT-git}
 export SUDO=${SUDO-sudo}
 export MAKE=${MAKE-make}
@@ -14,13 +14,13 @@ export INST_DIR=${DESTDIR-dist}
 
 INST_DIR=`readlink -f $INST_DIR`
 
-xen_clean
-grub_clean
-libvirt_clean
+for f in `cat "$BASEDIR"/components/series`
+do
+    source "$BASEDIR"/components/"$f"
+done
 
-xen_unconfigure
-grub_unconfigure
-libvirt_unconfigure
+for_each_component clean
+for_each_component unconfigure
 
 for i in `cat /var/log/raisin.log 2>/dev/null`
 do