From 1011ac117733c182175c588bc238cf20b3c7b72e Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Wed, 25 Mar 2015 22:36:17 +0000 Subject: [PATCH] Execute modules dynamically Signed-off-by: Stefano Stabellini --- common-functions.sh | 11 ++++++++ components/{grub.sh => grub} | 0 components/{libvirt.sh => libvirt} | 0 components/series | 3 +++ components/{xen.sh => xen} | 0 raise.sh | 40 ++++++------------------------ unraise.sh | 14 +++++------ 7 files changed, 29 insertions(+), 39 deletions(-) rename components/{grub.sh => grub} (100%) rename components/{libvirt.sh => libvirt} (100%) create mode 100644 components/series rename components/{xen.sh => xen} (100%) diff --git a/common-functions.sh b/common-functions.sh index cf877e6..c68a373 100644 --- a/common-functions.sh +++ b/common-functions.sh @@ -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.sh b/components/grub similarity index 100% rename from components/grub.sh rename to components/grub diff --git a/components/libvirt.sh b/components/libvirt similarity index 100% rename from components/libvirt.sh rename to components/libvirt diff --git a/components/series b/components/series new file mode 100644 index 0000000..3c3124d --- /dev/null +++ b/components/series @@ -0,0 +1,3 @@ +xen +grub +libvirt diff --git a/components/xen.sh b/components/xen similarity index 100% rename from components/xen.sh rename to components/xen diff --git a/raise.sh b/raise.sh index 28e178e..b96e0df 100755 --- 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 " 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" diff --git a/unraise.sh b/unraise.sh index 0e981d7..b302e17 100644 --- a/unraise.sh +++ b/unraise.sh @@ -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 -- 2.39.5