diff options
author | Elan Ruusamäe | 2021-09-28 15:18:53 (GMT) |
---|---|---|
committer | Elan Ruusamäe | 2021-09-28 15:19:13 (GMT) |
commit | 0d37247d5bdf546fa81cebcbdf9dc7479cddd2d1 (patch) | |
tree | 14c00b669864354db8a3e55f3412c1f57be750d8 | |
parent | c31e256fba7700a7c2ca844e69fac0e728560b10 (diff) | |
download | cleanbuild-0d37247d5bdf546fa81cebcbdf9dc7479cddd2d1.zip cleanbuild-0d37247d5bdf546fa81cebcbdf9dc7479cddd2d1.tar.gz |
Add --exec option to enter container
-rwxr-xr-x | bin/cleanbuild-docker.sh | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/bin/cleanbuild-docker.sh b/bin/cleanbuild-docker.sh index 30bba1e..5288f30 100755 --- a/bin/cleanbuild-docker.sh +++ b/bin/cleanbuild-docker.sh @@ -11,6 +11,7 @@ PROGRAM=${0##*/} : ${WITHOUT=} : ${KEEP_CONTAINER=true} : ${TMPFS="4G"} +: ${EXEC=false} dir=$(pwd) image=registry.gitlab.com/pld-linux/cleanbuild @@ -93,6 +94,11 @@ create_container() { fi } +enter_container() { + notice "Entering container for $PACKAGE_NAME" + docker exec --user=root -it $name bash +} + package_prepare() { notice "Fetch sources and install dependencies" if [ -d $topdir/packages/$PACKAGE_NAME ]; then @@ -169,7 +175,7 @@ package_build() { parse_options() { local t - t=$(getopt -o 'x' --long 'network,no-tmpfs,notmpfs,tmpfs:,keep-container:,with:,without:' -n "$PROGRAM" -- "$@") + t=$(getopt -o 'x' --long 'network,exec,no-tmpfs,notmpfs,tmpfs:,keep-container:,with:,without:' -n "$PROGRAM" -- "$@") [ $? != 0 ] && exit $? eval set -- "$t" @@ -181,6 +187,9 @@ parse_options() { --network) NETWORKING=true ;; + --exec) + EXEC=true + ;; --no-tmpfs|--notmpfs) TMPFS=false ;; @@ -222,6 +231,10 @@ main() { $TRACING && set -x local name="cleanbuild-$PACKAGE_NAME" create_container + if $EXEC; then + enter_container + return + fi package_prepare package_build } |