diff options
author | shravani <shravani.p@tcs.com> | 2016-12-20 15:09:34 +0530 |
---|---|---|
committer | Shravani Paladugula <shravani.p@tcs.com> | 2017-02-09 04:34:34 +0000 |
commit | 843dfef73c86a8ad71afe36e2db9e711dddc199a (patch) | |
tree | 52c15baf57c751cf91bf35b3dbc027adacfa7a1d /ci/build.sh | |
parent | 881aa3fcf152088440444d6f4296eaac3783801c (diff) |
Combine the common code for kernel building on deb/rpm
This patch removes the duplication of code in rpm/debian build
scripts.
Change-Id: I88edc93df488bd01a43cd98e4f69f35e09f8f61c
Signed-off-by: Shravani <shravani.p@tcs.com>
Diffstat (limited to 'ci/build.sh')
-rwxr-xr-x | ci/build.sh | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/ci/build.sh b/ci/build.sh index 064c48a8b..918e3cab7 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -2,6 +2,7 @@ # # Common parameter parsing for kvmfornfv scripts # + function usage() { echo "" echo "Usage --> $0 [-p package_type] [-o output_dir] [-h]" @@ -14,29 +15,35 @@ function usage() { output_dir="" type="" +function run() { + case $1 in + centos) + cd $WORKSPACE/ci/build_rpm + sudo docker build -t kvm_rpm . + sudo docker run --privileged=true -v $WORKSPACE:/opt/kvmfornfv -t kvm_rpm \ + /opt/kvmfornfv/ci/build_interface.sh $1 + ;; + ubuntu) + cd $WORKSPACE/ci/build_deb + sudo docker build -t kvm_deb . + sudo docker run -v $WORKSPACE:/opt/kvmfornfv -t kvm_deb \ + /opt/kvmfornfv/ci/build_interface.sh $1 + ;; + *) echo "Not supported system"; exit 1;; + esac +} + function build_package() { choice=$1 - case "$choice" in - "centos") - echo "Build $choice Rpms" - cd ci/build_rpm - ./build_rpms.sh - cd $WORKSPACE - ;; - "ubuntu") - echo "Build $choice Debians" - cd ci/build_deb - ./build_debs.sh - cd $WORKSPACE + "centos"|"ubuntu") + echo "Build $choice Rpms/Debians" + run $choice ;; "both") echo "Build $choice Debians and Rpms" - cd ci/build_deb - ./build_debs.sh - cd ../build_rpm - ./build_rpms.sh - cd $WORKSPACE + run "centos" + run "ubuntu" ;; *) echo "Invalid package option" |