]> git.pld-linux.org Git - projects/cleanbuild.git/commitdiff
Add --exec option to enter container
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 28 Sep 2021 15:18:53 +0000 (18:18 +0300)
committerElan Ruusamäe <glen@pld-linux.org>
Tue, 28 Sep 2021 15:19:13 +0000 (18:19 +0300)
bin/cleanbuild-docker.sh

index 30bba1e89253dea6c871e21a07ccddba4621afe1..5288f307dbfefac14face4d153b0c29ce061cb2f 100755 (executable)
@@ -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
 }
This page took 0.176663 seconds and 4 git commands to generate.