From: Stefano Stabellini Date: Tue, 7 Apr 2015 14:13:42 +0000 (+0000) Subject: Introduce build, install and configure commands to raise.sh X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=416b32dd3788250fde7a8a6cafd851225b808bbd;p=raisin.git Introduce build, install and configure commands to raise.sh Allow a more fine grained command execution by separating installation and system configuration. Use command line arguments to select the actions to take: build, install or configure. Signed-off-by: Stefano Stabellini --- diff --git a/README b/README index f18db4c..03f854c 100644 --- a/README +++ b/README @@ -15,11 +15,12 @@ on how to build and configure the system. Set your configuration parameters in the "config" file, then run -./raise.sh +./raise.sh build -Go and grab a coffee. When the script completes, you'll have a full -Xen system installation under DESTDIR and a deb or rpm package -(depending on your distro) containing all the necessary binaries. +Reply to questions and go and grab a coffee. When the script completes, you'll +have a full Xen system installation under DESTDIR and a deb or rpm package +(depending on your distro) containing all the necessary binaries in the raisin +directory. raise.sh takes care of: @@ -29,10 +30,11 @@ raise.sh takes care of: - installing them under DESTDIR (the "dist" sub-directory by default) - creating a deb or rpm package with all the content -raise.sh can optionally perform the installation under / and fully +raise.sh can also perform the installation under / and fully configure the system for you. If you want this behaviour run -./raise.sh -i +./raise.sh install +./raise.sh configure raise.sh performs the installation by installing the deb or rpm package, hence it can be easily uninstalled by unraise.sh or manually by the diff --git a/raise.sh b/raise.sh index 1ce3383..5c4016d 100755 --- a/raise.sh +++ b/raise.sh @@ -5,100 +5,104 @@ set -e source config source common-functions.sh -help() { - echo "Usage: ./build.sh " +_help() { + echo "Usage: ./build.sh " echo "where options are:" echo " -n | --no-deps Do no install build-time dependencies" echo " -v | --verbose Verbose" echo " -y | --yes Do not ask questions and continue" - echo " -i | --install Install under / and configure the system (needs sudo)" + echo "where commands are:" + echo " build Build the components enabled in config" + echo " install Install binaries under / (requires sudo)" + echo " configure Configure the system (requires sudo)" } +_build() { + if [[ $YES != "y" ]] + then + echo "Do you want Raisin to automatically install build time dependencies for you? (y/n)" + while read answer + do + if [[ "$answer" = "n" ]] + then + NO_DEPS=1 + break + elif [[ "$answer" = "y" ]] + then + break + fi + done + fi + + mkdir -p "$INST_DIR" &>/dev/null + install_dependencies git + if [[ $DISTRO = "Fedora" ]] + then + install_dependencies rpm-build + fi + # build and install under $DESTDIR + for_each_component clean + for_each_component build + + build_package xen-system +} + +_install() { + install_package xen-system +} + +_configure() { + if [[ $YES != "y" ]] + then + echo "Proceeding we'll make changes to the running system," + echo "are you sure that you want to continue? (y/n)" + while read answer + do + if [[ "$answer" = "n" ]] + then + exit 0 + elif [[ "$answer" = "y" ]] + then + break + fi + done + fi + + for_each_component configure +} # start execution common_init # parameters check -INST=0 -export NO_DEPS=0 export VERBOSE=0 export YES="n" -while [[ $# -ge 1 ]] +export NO_DEPS=0 +while [[ $# -gt 1 ]] do - if [[ "$1" = "-n" || "$1" = "--no-deps" ]] - then - NO_DEPS=1 - shift 1 - elif [[ "$1" = "-v" || "$1" = "--verbose" ]] + if [[ "$1" = "-v" || "$1" = "--verbose" ]] then VERBOSE=1 shift 1 - elif [[ "$1" = "-i" || "$1" = "--install" ]] - then - INST=1 - shift 1 elif [[ "$1" = "-y" || "$1" = "--yes" ]] then YES="y" shift 1 else - help + _help exit 1 fi done -if [[ $YES != "y" && $NO_DEPS -eq 0 ]] -then - echo "Do you want Raisin to automatically install build time dependencies for you? (y/n)" - while read answer - do - if [[ "$answer" = "n" ]] - then - NO_DEPS=1 - break - elif [[ "$answer" = "y" ]] - then - break - fi - done -fi - - -mkdir -p "$INST_DIR" &>/dev/null -install_dependencies git -if [[ $DISTRO = "Fedora" ]] -then - install_dependencies rpm-build -fi - -# build and install under $DESTDIR -for_each_component clean -for_each_component build - -build_package xen-system - -if [[ -z "$INST" || "$INST" -eq 0 ]] -then - exit 0 -elif [[ -z "$YES" || "$YES" != "y" ]] -then - echo "Proceeding we'll make changes to the running system," - echo "Installing the components we built and configuring the system" - echo "(requires sudo)." - echo "Are you sure that you want to continue? (y/n)" - while read answer - do - if [[ "$answer" = "n" ]] - then - exit 0 - elif [[ "$answer" = "y" ]] - then - break - fi - done -fi +case "$1" in + "build" | "install" | "configure" ) + COMMAND=$1 + ;; + *) + _help + exit 1 + ;; +esac -install_package xen-system +_$COMMAND -# configure -for_each_component configure