From 4ac04c6f514c73b6779e2772a2d22e23aabd907d Mon Sep 17 00:00:00 2001 From: Jerome Sagnole Date: Sun, 3 Sep 2017 15:20:49 +0200 Subject: [PATCH] adding autodetect on build command --- .../builder/debian/jessie/i686/build.sh | 22 ++++++++++--------- .../builder/debian/jessie/x86_64/build.sh | 22 ++++++++++--------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/dist/docker/builder/debian/jessie/i686/build.sh b/dist/docker/builder/debian/jessie/i686/build.sh index e5414a9e2..9d42b693e 100755 --- a/dist/docker/builder/debian/jessie/i686/build.sh +++ b/dist/docker/builder/debian/jessie/i686/build.sh @@ -8,7 +8,7 @@ # Created by : AleaJactaEst declare -i REMOVE=0 -declare -i IMAGE=1 +declare -i IMAGE=0 declare -i BUILD=1 declare -i DEBUG=0 declare JOBS="" @@ -16,6 +16,7 @@ declare CMAKEOPTS="" declare DOCKEROPTS="" declare DIRBUILD="" declare CLEANDOCKER=0 +declare -i AUTODETEC=1 declare IMAGEDOCKER="builder_khanat_debian_jessie_i686" declare LOCALBUILDDIR="build/$IMAGEDOCKER" @@ -38,8 +39,7 @@ options: -h, --help : Show this help -d, --debug : Show debug message -r, --remove : Remove old build repository - -i, --image-only : Just create image (no build) - -b, --build-only : Just build (no create new image) + -f, --force-create-image : force to create docker image (use to build khanat) - default autodetec. -j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg. -a OPTS, --add-opts-cmake=OPTS : Adding options on cmake command (before build) -c, --clean-container : remove all container in state Exited @@ -97,16 +97,10 @@ do REMOVE=1 shift ;; - -i|--image-only) - BUILD=0 + -f|--force-create-image) IMAGE=1 shift ;; - -b|--build-only) - BUILD=1 - IMAGE=0 - shift - ;; -j) shift # search next argument is value or new argument @@ -170,6 +164,14 @@ then exit 2 fi +if [[ $AUTODETEC -ne 0 ]] +then + if [[ $(docker images -f "reference=$IMAGEDOCKER" | wc -l) -lt 2 ]] + then + IMAGE=1 + fi +fi + DIRBUILD="${rootdir}/code/${LOCALBUILDDIR}" msg_debug "calldir: $calldir" diff --git a/dist/docker/builder/debian/jessie/x86_64/build.sh b/dist/docker/builder/debian/jessie/x86_64/build.sh index 83b77a7c7..c3c436ff4 100755 --- a/dist/docker/builder/debian/jessie/x86_64/build.sh +++ b/dist/docker/builder/debian/jessie/x86_64/build.sh @@ -8,7 +8,7 @@ # Created by : AleaJactaEst declare -i REMOVE=0 -declare -i IMAGE=1 +declare -i IMAGE=0 declare -i BUILD=1 declare -i DEBUG=0 declare JOBS="" @@ -16,6 +16,7 @@ declare CMAKEOPTS="" declare DOCKEROPTS="" declare DIRBUILD="" declare CLEANDOCKER=0 +declare -i AUTODETEC=1 declare IMAGEDOCKER="builder_khanat_debian_jessie_x86_64" declare LOCALBUILDDIR="build/$IMAGEDOCKER" @@ -38,8 +39,7 @@ options: -h, --help : Show this help -d, --debug : Show debug message -r, --remove : Remove old build repository - -i, --image-only : Just create image (no build) - -b, --build-only : Just build (no create new image) + -f, --force-create-image : force to create docker image (use to build khanat) - default autodetec. -j [N], --jobs[=N] Allow N jobs at once; infinite jobs with no arg. -a OPTS, --add-opts-cmake=OPTS : Adding options on cmake command (before build) -c, --clean-container : remove all container in state Exited @@ -99,16 +99,10 @@ do REMOVE=1 shift ;; - -i|--image-only) - BUILD=0 + -f|--force-create-image) IMAGE=1 shift ;; - -b|--build-only) - BUILD=1 - IMAGE=0 - shift - ;; -j) shift # search next argument is value or new argument @@ -176,6 +170,14 @@ then exit 2 fi +if [[ $AUTODETEC -ne 0 ]] +then + if [[ $(docker images -f "reference=$IMAGEDOCKER" | wc -l) -lt 2 ]] + then + IMAGE=1 + fi +fi + DIRBUILD="${rootdir}/code/${LOCALBUILDDIR}" msg_debug "calldir: $calldir"