Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2417 - (show annotations) (download)
Mon Aug 31 11:32:34 2015 UTC (8 years, 8 months ago) by niro
File size: 1585 byte(s)
-fixed a typo
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 fi
48
49 sysinfo="Hostname: $(hostname) Serial: #${serial} IP: ${ipaddr} OS: ${osversion} Kernel: $(uname -r)"
50 #len_sysinfo="${#sysinfo}"
51
52 # calculate icon xpos
53 # xorg_width / 2 - len_sysinfo / 2
54 #xpos="$(( ${xorg_width} / 2 - ${len_sysinfo} / 2 ))"
55 # xorg_width / 2
56 xpos="$(( ${xorg_width} / 2 ))"
57
58 # calculate icon ypos
59 # xorg_height - text_height; text_height=22 pixel
60 ypos="$(( ${xorg_height} - 22))"
61
62 # generate icon info
63 ${sudo} ${MCORE_LIBDIR}/idesk-generate-icon-info \
64 --add \
65 --name "${sysinfo}" \
66 --filename "sysinfo" \
67 --command "exit 0" \
68 --icon "sysinfo.png" \
69 --xpos "${xpos}" \
70 --ypos "${ypos}" \
71 || die "adding icon-info"