#!/bin/bash
# This file is part of Megatest.
#
# Megatest is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Megatest is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Megatest. If not, see <http://www.gnu.org/licenses/>.
# # disable if not running on homehost
# if [[ -e .homehost ]]; then
# homehostname=$( host `cat .homehost` | awk '{print $NF}' | sed 's/\.$//' )
# hostname=$( hostname -f )
#
# if [[ ! ($homehostname == $hostname) ]]; then
# echo "ERROR: this host ($hostname) is not the homehost ($homehostname) for this megatest run area. Cannot start dashboard."
# echo " Please log into homehost before launching dashboard."
# exit 1
# fi
# fi
# check that $DISPLAY is set
if [[ -z $DISPLAY ]]; then
echo 'ERROR: $DISPLAY environment variable is not set; megatest dashboard requires X display address to be set in $DISPLAY.'
exit 1
fi
# check that $DISPLAY is proper
if [[ -x $(which xdpyinfo 2>/dev/null) ]]; then
if ! xdpyinfo -display "$DISPLAY" &>/dev/null; then
echo 'ERROR: megatest dashboard cannot open display "'$DISPLAY'". Please check $DISPLAY environment variable.'
exit 1
fi
fi
if [[ $(ulimit -a | grep 'open files' | awk '{print $4}') -gt 10000 ]];then ulimit -n 10000;fi
lsbr=$(lsb_release -sr)
source PREFIX/ARCHSTR/cfg.sh
exec PREFIX/dboard "$@"