Magellan Linux

Contents of /mcore-src/trunk/mcore-tools/src/modules/idesk/idesk-sysinfo.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2413 - (show annotations) (download)
Mon Aug 31 11:11:18 2015 UTC (8 years, 7 months ago) by niro
File size: 1590 byte(s)
-fixed broken sysinfo icon
1 #!/bin/bash
2
3 MCORE_LIBDIR="@@MCORE_LIBDIR@@"
4 source @@SYSCONFDIR@@/mcore/mcore.conf
5 source ${MCORE_LIBDIR}/include/common.global.class
6
7 if [[ $(whoami) = ${MCORE_UNPRIV_USER} ]]
8 then
9 x11runas=""
10 sudo="sudo"
11 else
12 x11runas="x11runas"
13 sudo=""
14 fi
15
16 # die if no display was found
17 ${x11runas} xinfo &> /dev/null || exit 1
18
19 # eval xorg_width and xorg_height
20 eval $(${x11runas} xinfo)
21
22 # fallback
23 [[ -z ${xorg_width} ]] && xorg_width="1024"
24 [[ -z ${xorg_height} ]] && xorg_width="768"
25
26 if [ -e @@SYSCONFDIR@@/os-release ]
27 then
28 osversion=$(source @@SYSCONFDIR@@/os-release; echo "${ID}-${Version_ID}")
29 elif [ -e @@SYSCONFDIR@@/mageversion ]
30 then
31 osversion="alx-$(< @@SYSCONFDIR@@/mageversion)"
32 else
33 osversion="alx-UNKNOWN"
34 fi
35
36 if [[ -n $(type -P mcore-serial) ]]
37 then
38 serial="$(mcore-serial)"
39 else
40 serial="UNKNOWN"
41 fi
42
43 ipaddr="$(iface_for_remote_addr $(dns_to_ip alx-control.dom-aka-nt.intern))"
44 if [[ -z ${ipaddr} ]]
45 then
46 ipaddr="No network"
47 else
48 fi
49
50 sysinfo="Hostname: $(hostname) Serial: #${serial} IP: ${ipaddr} OS: ${osversion} Kernel: $(uname -r)"
51 #len_sysinfo="${#sysinfo}"
52
53 # calculate icon xpos
54 # xorg_width / 2 - len_sysinfo / 2
55 #xpos="$(( ${xorg_width} / 2 - ${len_sysinfo} / 2 ))"
56 # xorg_width / 2
57 xpos="$(( ${xorg_width} / 2 ))"
58
59 # calculate icon ypos
60 # xorg_height - text_height; text_height=22 pixel
61 ypos="$(( ${xorg_height} - 22))"
62
63 # generate icon info
64 ${sudo} ${MCORE_LIBDIR}/idesk-generate-icon-info \
65 --add \
66 --name "${sysinfo}" \
67 --filename "sysinfo" \
68 --command "exit 0" \
69 --icon "sysinfo.png" \
70 --xpos "${xpos}" \
71 --ypos "${ypos}" \
72 || die "adding icon-info"