From cf573b1272c40bf81419911f015b9ef318e96a3c Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Wed, 13 Feb 2019 15:10:54 +0000 Subject: [PATCH] tools/dashboard: follow latest build if not locked to P/D/A --- tools/dashboard | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/tools/dashboard b/tools/dashboard index 3e78450e97..efb1250948 100755 --- a/tools/dashboard +++ b/tools/dashboard @@ -3,17 +3,35 @@ # SPDX-License-Identifier: GPL-2.0 # Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) -. config/options "" +cd "$(readlink -f "$(dirname "$0")")/.." + +if [ -n "${PROJECT}" -a "$1" != "auto" ]; then + . config/options "" +fi + +_find_latest_tcdir() { + if [ -n "${THREAD_CONTROL}" ]; then + echo "${THREAD_CONTROL}" + else + ls -1tdr "${PWD}"/build.*/.threads 2>/dev/null | tail -1 + fi +} while [ : ]; do echo "Waiting for build to start..." + while [ : ]; do - pid="$(cat "${THREAD_CONTROL}/pid" 2>/dev/null || true)" - [ -n "${pid}" ] && ps -p ${pid} &>/dev/null && break + tcdir="$(_find_latest_tcdir)" + + if [ -n "${tcdir}" ]; then + pid="$(cat "${tcdir}/pid" 2>/dev/null || true)" + [ -n "${pid}" ] && ps -p ${pid} &>/dev/null && break + fi + sleep 1.0 done - tail -Fn+0 --pid=${pid} ${THREAD_CONTROL}/status 2>/dev/null + tail -Fn+0 --pid=${pid} "${tcdir}/status" 2>/dev/null echo done