eclair-linaro: Jenkins agent image for ECLAIR analysis tool
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: I1e45acd64a611ea0fcbae9d3c7d8cd1b5e3dc814
diff --git a/eclair-linaro/bin/detachLicense b/eclair-linaro/bin/detachLicense
new file mode 100755
index 0000000..87c29bb
--- /dev/null
+++ b/eclair-linaro/bin/detachLicense
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+usage() {
+ echo "Usage: $0 SECONDS" >&2
+ exit 2
+}
+
+[ $# -eq 1 ] || usage
+
+seconds=$1
+
+sudo su "${ECLAIR_LICENSE_USER}" -c "\"${ECLAIR_TOP_DIR}/bin/eclair_licman\" -d 38199 -t \"${seconds}\" -s u"
diff --git a/eclair-linaro/bin/forwardPorts b/eclair-linaro/bin/forwardPorts
new file mode 100755
index 0000000..7b0a6a7
--- /dev/null
+++ b/eclair-linaro/bin/forwardPorts
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+set -ex
+
+host=$(uname -n)
+socat "tcp-listen:${HASPLM_PORT},bind=${host},reuseaddr,fork" tcp:127.0.0.1:1947 > /dev/null 2>&1 &
+socat "tcp-listen:${ECLAIR_PORT},bind=${host},reuseaddr,fork" tcp:127.0.0.1:3786 > /dev/null 2>&1 &
diff --git a/eclair-linaro/bin/openACC b/eclair-linaro/bin/openACC
new file mode 100755
index 0000000..bba0ba3
--- /dev/null
+++ b/eclair-linaro/bin/openACC
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+xdg-open http://localhost:1947
diff --git a/eclair-linaro/bin/postStart b/eclair-linaro/bin/postStart
new file mode 100755
index 0000000..2a2daf6
--- /dev/null
+++ b/eclair-linaro/bin/postStart
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -ex
+sudo useradd "${ECLAIR_LICENSE_USER}" -u 2000 || :
+sudo mkdir -p /var/hasplm/update
+sudo chown eclair -R /var/hasplm
+sudo mkdir -p /etc/hasplm
+sudo chown eclair /etc/hasplm
+echo "serveraddr = ${ECLAIR_LICENSE_SERVER}" > /etc/hasplm/hasplm.ini
+cp -f "${ECLAIR_TOP_DIR}"/reqs/Sentinel_LDK_RTE/haspvlib*_113938.* /var/hasplm/update
+/usr/sbin/hasplmd_x86_64 -s
diff --git a/eclair-linaro/bin/returnLicense b/eclair-linaro/bin/returnLicense
new file mode 100755
index 0000000..36a662c
--- /dev/null
+++ b/eclair-linaro/bin/returnLicense
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+usage() {
+ echo "Usage: $0" >&2
+ exit 2
+}
+
+[ $# -eq 0 ] || usage
+
+"${ECLAIR_TOP_DIR}/bin/eclair_licman" -c 38199
diff --git a/eclair-linaro/bin/xdg-open b/eclair-linaro/bin/xdg-open
new file mode 100755
index 0000000..caa62e9
--- /dev/null
+++ b/eclair-linaro/bin/xdg-open
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+url=$1
+
+case "${url}" in
+ http://*|https://*)
+ ;;
+ file:*)
+ ;;
+ *)
+ url=file:${url}
+ ;;
+esac
+
+case "${url}" in
+ http://*|https://*)
+ if [ -n "${BROWSER}" ]
+ then
+ echo "Opening ${url}"
+ "${BROWSER}" "${url}"
+ exit 0
+ fi
+ url=${url/:1947/:${HASPLM_PORT}}
+ url=${url/:3786/:${ECLAIR_PORT}}
+ ;;
+ file:*)
+ url=${url/file:${DOCK_DIR}/file:${HOST_DIR//\\//}}
+ ;;
+esac
+
+echo "Opening ${url}"
+echo "${url}" | socat stdin "tcp:host.docker.internal:${XDG_PORT}" ||
+ echo "WARNING: xdg-open-server is not running: ${url}"