adding autodetect on build command

This commit is contained in:
Jerome Sagnole 2017-09-03 15:20:49 +02:00
parent f2e70b182e
commit 4ac04c6f51
2 changed files with 24 additions and 20 deletions

View file

@ -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"

View file

@ -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"