diff --git a/tools/itango/start-jive.sh b/tools/itango/start-jive.sh new file mode 100755 index 0000000000000000000000000000000000000000..06fa7e09a17c79951d36f5c44aa32104005ff55b --- /dev/null +++ b/tools/itango/start-jive.sh @@ -0,0 +1,38 @@ +OS=$(uname) + +case ${OS} in + Linux) + display="" + XTRA_OPTIONS="-u $(id -u ${USER}):$(id -g ${USER}) -v /etc/passwd:/etc/passwd:ro -v /etc/groups:/etc/groups:ro" + + ;; + Darwin) + display="$(scutil --nwi | grep 'address' | cut -d':' -f2 | tr -d ' ' | head -n1):0" + XTRA_OPTIONS="" + ;; +esac + +display=${display:-${DISPLAY}} + +OPTIONS="-e HOME=/hosthome -e DISPLAY=${display} -e XAUTHORITY=/hosthome/.Xauthority -e TANGO_HOST=databaseds:10000 -v ${HOME}:/hosthome -v /tmp/.X11-unix:/tmp/.X11-unix" + +if [ ! -z ${XTRA_OPTIONS} ]; then + OPTIONS="${OPTIONS} ${XTRA_OPTIONS}" +fi + +if [ ${#} -eq 1 ]; then + command=${1} + shift +else + command=/usr/local/bin/jive +fi + +#docker run --rm -it --network host ${OPTIONS} nexus.engageska-portugal.pt/ska-docker/tango-java:latest ${command} ${@} +container_name=nexus.engageska-portugal.pt/ska-docker/tango-java:latest +container=$(docker ps | egrep ${container_name} | cut -d' ' -f1) +if [ ! -z ${container} ]; then + docker exec -it ${container} ${command} ${@} +else + echo "Container \"${container_name}\" is not running." +fi +