Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2825 - (show annotations) (download)
Tue Aug 1 16:17:14 2017 UTC (6 years, 8 months ago) by niro
File size: 1658 byte(s)
-honor changes of r2819 - fix broken ip behavior
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 xinfo=$(${x11runas} xinfo)
21 if [[ $? = 0 ]]
22 then
23 eval ${xinfo}
24 fi
25
26 # fallback
27 [[ -z ${xorg_width} ]] && xorg_width="1024"
28 [[ -z ${xorg_height} ]] && xorg_width="768"
29
30 if [ -e @@SYSCONFDIR@@/os-release ]
31 then
32 osversion=$(source @@SYSCONFDIR@@/os-release; echo "${ID}-${Version_ID}")
33 elif [ -e @@SYSCONFDIR@@/mageversion ]
34 then
35 osversion="alx-$(< @@SYSCONFDIR@@/mageversion)"
36 else
37 osversion="alx-UNKNOWN"
38 fi
39
40 if [[ -n $(type -P mcore-serial) ]]
41 then
42 serial="$(mcore-serial)"
43 else
44 serial="UNKNOWN"
45 fi
46
47 iface="$(iface_for_remote_addr $(dns_to_ip alx-control.dom-aka-nt.intern))"
48 ipaddr="$(get_iface_ip ${iface})"
49 if [[ -z ${ipaddr} ]]
50 then
51 ipaddr="No network"
52 fi
53
54 sysinfo="Hostname: $(hostname) Serial: #${serial} IP: ${ipaddr} OS: ${osversion} Kernel: $(uname -r)"
55 #len_sysinfo="${#sysinfo}"
56
57 # calculate icon xpos
58 # xorg_width / 2 - len_sysinfo / 2
59 #xpos="$(( ${xorg_width} / 2 - ${len_sysinfo} / 2 ))"
60 # xorg_width / 2
61 xpos="$(( ${xorg_width} / 2 ))"
62
63 # calculate icon ypos
64 # xorg_height - text_height; text_height=22 pixel
65 ypos="$(( ${xorg_height} - 22))"
66
67 # generate icon info
68 ${sudo} ${MCORE_LIBDIR}/idesk-generate-icon-info \
69 --add \
70 --name "${sysinfo}" \
71 --filename "sysinfo" \
72 --command "exit 0" \
73 --icon "sysinfo.png" \
74 --xpos "${xpos}" \
75 --ypos "${ypos}" \
76 || die "adding icon-info"