Annotation of /mcore-src/trunk/mcore-tools/src/modules/idesk/idesk-sysinfo.in
Parent Directory | Revision Log
Revision 2413 -
(hide annotations)
(download)
Mon Aug 31 11:11:18 2015 UTC (8 years, 8 months ago) by niro
File size: 1590 byte(s)
Mon Aug 31 11:11:18 2015 UTC (8 years, 8 months ago) by niro
File size: 1590 byte(s)
-fixed broken sysinfo icon
1 | niro | 2103 | #!/bin/bash |
2 | |||
3 | niro | 2406 | MCORE_LIBDIR="@@MCORE_LIBDIR@@" |
4 | source @@SYSCONFDIR@@/mcore/mcore.conf | ||
5 | source ${MCORE_LIBDIR}/include/common.global.class | ||
6 | |||
7 | niro | 2412 | if [[ $(whoami) = ${MCORE_UNPRIV_USER} ]] |
8 | then | ||
9 | x11runas="" | ||
10 | sudo="sudo" | ||
11 | else | ||
12 | x11runas="x11runas" | ||
13 | sudo="" | ||
14 | fi | ||
15 | |||
16 | niro | 2103 | # die if no display was found |
17 | niro | 2412 | ${x11runas} xinfo &> /dev/null || exit 1 |
18 | niro | 2103 | |
19 | # eval xorg_width and xorg_height | ||
20 | niro | 2412 | eval $(${x11runas} xinfo) |
21 | niro | 2103 | |
22 | # fallback | ||
23 | [[ -z ${xorg_width} ]] && xorg_width="1024" | ||
24 | [[ -z ${xorg_height} ]] && xorg_width="768" | ||
25 | |||
26 | niro | 2136 | if [ -e @@SYSCONFDIR@@/os-release ] |
27 | niro | 2103 | then |
28 | niro | 2136 | osversion=$(source @@SYSCONFDIR@@/os-release; echo "${ID}-${Version_ID}") |
29 | elif [ -e @@SYSCONFDIR@@/mageversion ] | ||
30 | niro | 2103 | then |
31 | niro | 2136 | osversion="alx-$(< @@SYSCONFDIR@@/mageversion)" |
32 | niro | 2103 | 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 | niro | 2406 | 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 | niro | 2103 | #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 | niro | 2406 | # generate icon info |
64 | niro | 2412 | ${sudo} ${MCORE_LIBDIR}/idesk-generate-icon-info \ |
65 | niro | 2406 | --add \ |
66 | niro | 2413 | --name "${sysinfo}" \ |
67 | --filename "sysinfo" \ | ||
68 | niro | 2406 | --command "exit 0" \ |
69 | --icon "sysinfo.png" \ | ||
70 | --xpos "${xpos}" \ | ||
71 | --ypos "${ypos}" \ | ||
72 | || die "adding icon-info" |