diff options
-rwxr-xr-x | start-container-docker.sh | 9 | ||||
-rwxr-xr-x | start-container-none.sh | 5 | ||||
-rwxr-xr-x | start-container-schroot.sh | 8 |
3 files changed, 14 insertions, 8 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh index d5bac59d..a8f5bbea 100755 --- a/start-container-docker.sh +++ b/start-container-docker.sh @@ -12,10 +12,12 @@ set -e # - definition of ${session_host} and ${session_port}, can be used for # a remote connexion to the container -if [ $# -ne 2 ]; then - echo Usage: $0 arch flavour +if [ $# -ne 2 -a $# -ne 3 ]; then + echo Usage: $0 arch flavour [host] echo " arch: architecture (eg: amd64, i386, arm64, armhf)" echo " flavour: distribution (eg: trusty)" + echo " host: hostname where the container will run, defaults to localhost" + echo " useful if the name resolution does not work correctly" exit 1 fi @@ -35,6 +37,8 @@ fi container_arch=$1 distro=$2 +session_host=$3 +[ x"$session_host" = x ] && session_host=localhost task="build" # Save stdout/stderr file descriptors @@ -52,7 +56,6 @@ case "${distro}:${task}" in ;; esac -session_host="$(hostname)" DOCKER="docker -H $session_host:2375" $DOCKER pull $image session_name=$(echo $BUILD_NUMBER-$JOB_NAME | sed -e "s#[/=,]#-#g") diff --git a/start-container-none.sh b/start-container-none.sh index e8f4a0e1..7ebc2365 100755 --- a/start-container-none.sh +++ b/start-container-none.sh @@ -14,10 +14,11 @@ set -e # - definition of ${session_host} and ${session_port}, can be used for # a remote connexion to the container -if [ $# -ne 2 ]; then - echo Usage: $0 arch flavour +if [ $# -ne 2 -a $# -ne 3 ]; then + echo Usage: $0 arch flavour [host] echo " arch: architecture (eg: amd64, i386, arm64, armhf)" echo " flavour: distribution (eg: trusty)" + echo " host: hostname where the container will run, defaults to localhost" exit 1 fi diff --git a/start-container-schroot.sh b/start-container-schroot.sh index b569e8fd..5501547a 100755 --- a/start-container-schroot.sh +++ b/start-container-schroot.sh @@ -11,17 +11,19 @@ set -e # to run inside the container. # - definition of ${session_host} and ${session_port}, can be used for # a remote connexion to the container -if [ $# -ne 2 ]; then - echo Usage: $0 arch flavour +if [ $# -ne 2 -a $# -ne 3 ]; then + echo Usage: $0 arch flavour [host] echo " arch: architecture (eg: amd64, i386, arm64, armhf)" echo " flavour: distribution (eg: trusty)" + echo " host: hostname where the container will run, defaults to localhost" exit 1 fi container_arch=$1 distro=$2 +session_host=$3 +[ x"$session_host" = x ] && session_host=localhost -session_host="$(hostname).tcwglab" session_port=22 schroot_image="tcwg-build-${container_arch}-${distro}" session_id=$(schroot -b -c chroot:$schroot_image --preserve-environment) |