Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2406 - (show annotations) (download)
Mon Aug 31 09:00:31 2015 UTC (8 years, 8 months ago) by niro
File size: 1428 byte(s)
-only generate an icon info file and let generate-all-desktop-icon genrate all icons, also print the current ip of the host
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 # die if no display was found
8 xinfo &> /dev/null || exit 1
9
10 # eval xorg_width and xorg_height
11 eval $(x11runas xinfo)
12
13 # fallback
14 [[ -z ${xorg_width} ]] && xorg_width="1024"
15 [[ -z ${xorg_height} ]] && xorg_width="768"
16
17 if [ -e @@SYSCONFDIR@@/os-release ]
18 then
19 osversion=$(source @@SYSCONFDIR@@/os-release; echo "${ID}-${Version_ID}")
20 elif [ -e @@SYSCONFDIR@@/mageversion ]
21 then
22 osversion="alx-$(< @@SYSCONFDIR@@/mageversion)"
23 else
24 osversion="alx-UNKNOWN"
25 fi
26
27 if [[ -n $(type -P mcore-serial) ]]
28 then
29 serial="$(mcore-serial)"
30 else
31 serial="UNKNOWN"
32 fi
33
34 ipaddr="$(iface_for_remote_addr $(dns_to_ip alx-control.dom-aka-nt.intern))"
35 if [[ -z ${ipaddr} ]]
36 then
37 ipaddr="No network"
38 else
39 fi
40
41 sysinfo="Hostname: $(hostname) Serial: #${serial} IP: ${ipaddr} OS: ${osversion} Kernel: $(uname -r)"
42 #len_sysinfo="${#sysinfo}"
43
44 # calculate icon xpos
45 # xorg_width / 2 - len_sysinfo / 2
46 #xpos="$(( ${xorg_width} / 2 - ${len_sysinfo} / 2 ))"
47 # xorg_width / 2
48 xpos="$(( ${xorg_width} / 2 ))"
49
50 # calculate icon ypos
51 # xorg_height - text_height; text_height=22 pixel
52 ypos="$(( ${xorg_height} - 22))"
53
54 # generate icon info
55 ${MCORE_LIBDIR}/idesk-generate-icon-info \
56 --add \
57 --name "sysinfo" \
58 --command "exit 0" \
59 --icon "sysinfo.png" \
60 --xpos "${xpos}" \
61 --ypos "${ypos}" \
62 || die "adding icon-info"