Annotation of /mcore-src/trunk/mcore-tools/src/modules/idesk/idesk-sysinfo.in
Parent Directory | Revision Log
Revision 2773 -
(hide annotations)
(download)
Thu Feb 11 15:00:24 2016 UTC (8 years, 3 months ago) by niro
File size: 1625 byte(s)
Thu Feb 11 15:00:24 2016 UTC (8 years, 3 months ago) by niro
File size: 1625 byte(s)
-sanitize variables
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 | 2773 | xinfo=$(${x11runas} xinfo) |
21 | if [[ $? = 0 ]] | ||
22 | then | ||
23 | eval ${xinfo} | ||
24 | fi | ||
25 | niro | 2103 | |
26 | # fallback | ||
27 | [[ -z ${xorg_width} ]] && xorg_width="1024" | ||
28 | [[ -z ${xorg_height} ]] && xorg_width="768" | ||
29 | |||
30 | niro | 2136 | if [ -e @@SYSCONFDIR@@/os-release ] |
31 | niro | 2103 | then |
32 | niro | 2136 | osversion=$(source @@SYSCONFDIR@@/os-release; echo "${ID}-${Version_ID}") |
33 | elif [ -e @@SYSCONFDIR@@/mageversion ] | ||
34 | niro | 2103 | then |
35 | niro | 2136 | osversion="alx-$(< @@SYSCONFDIR@@/mageversion)" |
36 | niro | 2103 | 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 | niro | 2406 | ipaddr="$(iface_for_remote_addr $(dns_to_ip alx-control.dom-aka-nt.intern))" |
48 | if [[ -z ${ipaddr} ]] | ||
49 | then | ||
50 | ipaddr="No network" | ||
51 | fi | ||
52 | |||
53 | sysinfo="Hostname: $(hostname) Serial: #${serial} IP: ${ipaddr} OS: ${osversion} Kernel: $(uname -r)" | ||
54 | niro | 2103 | #len_sysinfo="${#sysinfo}" |
55 | |||
56 | # calculate icon xpos | ||
57 | # xorg_width / 2 - len_sysinfo / 2 | ||
58 | #xpos="$(( ${xorg_width} / 2 - ${len_sysinfo} / 2 ))" | ||
59 | # xorg_width / 2 | ||
60 | xpos="$(( ${xorg_width} / 2 ))" | ||
61 | |||
62 | # calculate icon ypos | ||
63 | # xorg_height - text_height; text_height=22 pixel | ||
64 | ypos="$(( ${xorg_height} - 22))" | ||
65 | |||
66 | niro | 2406 | # generate icon info |
67 | niro | 2412 | ${sudo} ${MCORE_LIBDIR}/idesk-generate-icon-info \ |
68 | niro | 2406 | --add \ |
69 | niro | 2413 | --name "${sysinfo}" \ |
70 | --filename "sysinfo" \ | ||
71 | niro | 2406 | --command "exit 0" \ |
72 | --icon "sysinfo.png" \ | ||
73 | --xpos "${xpos}" \ | ||
74 | --ypos "${ypos}" \ | ||
75 | || die "adding icon-info" |