build in docker with new option --wait
This commit is contained in:
		| @@ -10,6 +10,7 @@ dirs=("-v $(pwd):/workdir") | ||||
| packages=() | ||||
| targets="all check distcheck" | ||||
| commands=() | ||||
| wait=0 | ||||
| if test -e ./build-in-docker.conf; then | ||||
|     # you can preconfigure the variables in file build-in-docker.conf | ||||
|     # if you do so, add the file to EXTRA_DIST in makefile.am | ||||
| @@ -31,6 +32,7 @@ while test $# -gt 0; do | ||||
|             echo "  -d, --dir <dir>       access given directory read only" | ||||
|             echo "  -p, --package <pkg>   install extra debian packages" | ||||
|             echo "  -c, --cmd <command>   execute commands as root in docker" | ||||
|             echo "  -w, --wait            on error keep docker container and wait for enter" | ||||
|             echo | ||||
|             echo "  The options -r -k -e -d -p -c can be repeated several times." | ||||
|             echo | ||||
| @@ -82,6 +84,9 @@ while test $# -gt 0; do | ||||
|         (-c|--cmd) shift; | ||||
|             commands+=("$1") | ||||
|             ;; | ||||
|         (-w|--wait) | ||||
|             wait=1 | ||||
|             ;; | ||||
|         (*) | ||||
|             echo "**** ERROR: unknown option '$1', try --help" 1>&2 | ||||
|             exit 1 | ||||
| @@ -113,6 +118,12 @@ function traperror() { | ||||
|                 fi | ||||
|                 echo | ||||
|             fi | ||||
|             if [ "$wait" -eq 1 ]; then | ||||
|                 echo "  ... now you can access the docker container:" | ||||
|                 echo "      docker exec -u $(id -u) ${DOCKER_ID} -it bash" | ||||
|                 echo -n "  ... press enter to cleanup: " | ||||
|                 read | ||||
|             fi | ||||
|             echo -n "   ... cleanup docker: " | ||||
|             docker rm -f "${DOCKER_ID}" | ||||
|             echo "returning status: $e" | ||||
| @@ -120,6 +131,12 @@ function traperror() { | ||||
|             exit $e | ||||
|         fi | ||||
|     done | ||||
|     if [ "$wait" -eq 1 ]; then | ||||
|         echo "  ... now you can access the docker container:" | ||||
|         echo "      docker exec -u $(id -u) ${DOCKER_ID} -it bash" | ||||
|         echo -n "  ... press enter to cleanup: " | ||||
|         read | ||||
|     fi | ||||
|     echo -n "   SUCCESS ... cleanup docker: " | ||||
|     docker rm -f "${DOCKER_ID}" | ||||
|     exit 0 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user