Replace dashboard with a simple script to watch any running build.

This commit is contained in:
fewtarius 2023-10-12 01:53:22 +00:00
parent fa6be77fe0
commit 900fd48b0f
No known key found for this signature in database
GPG key ID: F4AE55305D1B8C1A

View file

@ -1,46 +1,23 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2020-present Fewtarius
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv)
###
### A simple loop to watch the status of any active builds.
###
cd "$(readlink -f "$(dirname "$0")")/.."
DELAY=${1:-5}
if [ -n "${PROJECT}" -a "$1" != "auto" ]; then
. config/options ""
fi
_find_latest_tcdir() {
local IFS=$'\n'
if [ -n "${THREAD_CONTROL}" ]; then
echo "${THREAD_CONTROL}"
while true
do
ACTIVE=$(find build*/.threads -name status -mmin -5 -printf "%T@ %p\n" | sort -n | awk 'END {print $NF}')
if [ "${ACTIVE}" ]
then
clear
cat ${ACTIVE}
sleep ${DELAY}
else
for dir in $(ls -1td "${PWD}"/build.*/.threads 2>/dev/null); do
[ -f "${dir}/parallel.pid" ] && echo "${dir}" && break
done
echo -e "\nThere are no active builds available to view."
exit 1
fi
return 0
}
while [ : ]; do
echo "Waiting for build to start..."
while [ : ]; do
tcdir="$(_find_latest_tcdir)"
if [ -n "${tcdir}" ]; then
pid="$(cat "${tcdir}/parallel.pid" 2>/dev/null || true)"
[ -n "${pid}" ] && ps -p ${pid} &>/dev/null && break
fi
sleep 1.0
done
if [ "${THREADCOUNT}" = "0" ]; then
tail -Fn+0 --pid=${pid} "${tcdir}/status" 2>/dev/null | grep -vE "STALLED|IDLE"
else
tail -Fn+0 --pid=${pid} "${tcdir}/status" 2>/dev/null
fi
echo
done