summaryrefslogtreecommitdiff
path: root/start-container-docker.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2017-04-20 10:11:06 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2017-04-20 12:57:36 +0000
commit93a52455f67482f97c0af642d9018c0ecc3c41ff (patch)
tree3bae5da28a26768e1bc7fa31ea1a064bd466289f /start-container-docker.sh
parent61e547acdbba4eab0b95fa023bf18f50f29753fe (diff)
start-container-docker.sh: Add --prefix option and v2 interface
Change-Id: I4d16c5e09d5cf155a45e066c918d5238beec72e3
Diffstat (limited to 'start-container-docker.sh')
-rwxr-xr-xstart-container-docker.sh19
1 files changed, 18 insertions, 1 deletions
diff --git a/start-container-docker.sh b/start-container-docker.sh
index fa56a001..9eebb2e0 100755
--- a/start-container-docker.sh
+++ b/start-container-docker.sh
@@ -13,10 +13,11 @@ set -e
# - definition of ${session_host} and ${session_port}, can be used for
# a remote connexion to the container
usage() {
- echo "Usage: $0 --arch container-arch --distro flavour [--session-host host] [--session-name name] [--task {build|test}] [--weight weight]"
+ echo "Usage: $0 --arch container-arch --distro flavour [--prefix prefix] [--session-host host] [--session-name name] [--task {build|test}] [--weight weight]"
echo
echo " container-arch: architecture (eg: amd64, i386, arm64, armhf)"
echo " distro: distribution (eg: trusty)"
+ echo " prefix: prefix to prepend to output variables and functions"
echo " session-host: hostname where the container will run, defaults to localhost"
echo " useful if the name resolution does not work correctly"
echo " session-name: session, in case the default '$BUILD_NUMBER-$JOB_NAME' is not suitable"
@@ -33,6 +34,7 @@ exec 1>&2
container_arch=
distro=
+prefix=
session_host=
session_name=
task="build"
@@ -51,6 +53,11 @@ do
[ x${distro} = x ] && usage
shift 2
;;
+ --prefix)
+ prefix=$2
+ [ x${prefix} = x ] && usage
+ shift 2
+ ;;
--session-host)
session_host=$2
[ x${session_host} = x ] && usage
@@ -180,8 +187,18 @@ trap EXIT
exec 1>&3 2>&4
cat <<EOF
+# v1 interface
CONTAINER="ssh -p ${session_port} -A ${session_host}"
CONTAINER_CLEANUP="${CONTAINER_CLEANUP}"
session_host=${session_host}
session_port=${session_port}
+
+# v2 interface
+${prefix}CONTAINER_RSH="ssh -p ${session_port} -A ${session_host}"
+${prefix}container_cleanup ()
+{
+ ${CONTAINER_CLEANUP}
+}
+${prefix}container_host=${session_host}
+${prefix}container_port=${session_port}
EOF