# Tell the Control Center that ldm is loaded

if [ -f /etc/ltsp/getltscfg-cluster.conf ]; then
    if ! boolean_is_true "$CLUSTER_CONFIGURED"; then
        . /etc/ltsp/getltscfg-cluster.conf
        INTERFACE=$(ip route | grep default | cut -d " " -f5)
        INTERFACE_MAC=$(ifconfig | grep ${INTERFACE} | cut -f11 -d" ")
        INTERFACE_IP=$(ifconfig ${INTERFACE} | grep inet | cut -f2 -d":" | cut -f1 -d" ")
        CPU=$(cat /proc/cpuinfo | grep "^model name" | head -1 | sed "s/.*: //")
        RAM=$(free -m | grep "^Mem" | awk '{print $2}')
        VGA=$(lspci | grep "VGA" | sed "s/.* \[//" | sed "s/\]//")
        URL="http://$SERVER/ltsp-cluster-control/Admin"
        ldm-dialog --message "<b>`eval_gettext "This thin client hasn't been configured yet."`</b>

<b>`eval_gettext "MAC address"`:</b> ${INTERFACE_MAC}
<b>`eval_gettext "IP address"`:</b> ${INTERFACE_IP}
<b>`eval_gettext "CPU"`:</b> ${CPU}
<b>`eval_gettext "RAM"`:</b> ${RAM}MB
<b>`eval_gettext "Video"`:</b> ${VGA}

<b>`eval_gettext "Web Interface"`:</b> ${URL}
"
    fi
    getltscfg-cluster -l prompt
fi
