#!/bin/bash MCORE_LIBDIR="@@MCORE_LIBDIR@@" source @@SYSCONFDIR@@/mcore/mcore.conf source ${MCORE_LIBDIR}/include/common.global.class if [[ $(whoami) = ${MCORE_UNPRIV_USER} ]] then x11runas="" sudo="sudo" else x11runas="x11runas" sudo="" fi # die if no display was found ${x11runas} xinfo &> /dev/null || exit 1 # eval xorg_width and xorg_height xinfo=$(${x11runas} xinfo) if [[ $? = 0 ]] then eval ${xinfo} fi # fallback [[ -z ${xorg_width} ]] && xorg_width="1024" [[ -z ${xorg_height} ]] && xorg_width="768" if [ -e @@SYSCONFDIR@@/os-release ] then osversion=$(source @@SYSCONFDIR@@/os-release; echo "${ID}-${Version_ID}") elif [ -e @@SYSCONFDIR@@/mageversion ] then osversion="alx-$(< @@SYSCONFDIR@@/mageversion)" else osversion="alx-UNKNOWN" fi if [[ -n $(type -P mcore-serial) ]] then serial="$(mcore-serial)" else serial="UNKNOWN" fi iface="$(iface_for_remote_addr $(dns_to_ip alx-control.dom-aka-nt.intern))" ipaddr="$(get_iface_ip ${iface})" if [[ -z ${ipaddr} ]] then ipaddr="No network" fi sysinfo="Hostname: $(hostname) Serial: #${serial} IP: ${ipaddr} OS: ${osversion} Arch: $(uname -m) Kernel: $(uname -r)" #len_sysinfo="${#sysinfo}" # calculate icon xpos # xorg_width / 2 - len_sysinfo / 2 #xpos="$(( ${xorg_width} / 2 - ${len_sysinfo} / 2 ))" # xorg_width / 2 xpos="$(( ${xorg_width} / 2 ))" # calculate icon ypos # xorg_height - text_height; text_height=22 pixel ypos="$(( ${xorg_height} - 22))" # generate icon info ${sudo} ${MCORE_LIBDIR}/idesk-generate-icon-info \ --add \ --name "${sysinfo}" \ --filename "sysinfo" \ --command "exit 0" \ --icon "sysinfo.png" \ --xpos "${xpos}" \ --ypos "${ypos}" \ || die "adding icon-info"