Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

mcore-src/trunk/mcore-tools/bin/idesk-sysinfo.sh revision 2103 by niro, Thu Jan 2 09:56:27 2014 UTC mcore-src/trunk/mcore-tools/src/modules/idesk/idesk-sysinfo.in revision 2825 by niro, Tue Aug 1 16:17:14 2017 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/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  # die if no display was found
17  xinfo &> /dev/null || exit 1  ${x11runas} xinfo &> /dev/null || exit 1
18    
19  # eval xorg_width and xorg_height  # eval xorg_width and xorg_height
20  eval $(xinfo)  xinfo=$(${x11runas} xinfo)
21    if [[ $? = 0 ]]
22    then
23     eval ${xinfo}
24    fi
25    
26  # fallback  # fallback
27  [[ -z ${xorg_width} ]] && xorg_width="1024"  [[ -z ${xorg_width} ]] && xorg_width="1024"
28  [[ -z ${xorg_height} ]] && xorg_width="768"  [[ -z ${xorg_height} ]] && xorg_width="768"
29    
30  if [ -e /etc/os-release ]  if [ -e @@SYSCONFDIR@@/os-release ]
31  then  then
32   osversion=$(source /etc/os-release; echo "${ID}-${Version_ID}")   osversion=$(source @@SYSCONFDIR@@/os-release; echo "${ID}-${Version_ID}")
33  elif [ -e /etc/mageversion ]  elif [ -e @@SYSCONFDIR@@/mageversion ]
34  then  then
35   osversion="alx-$(< /etc/mageversion)"   osversion="alx-$(< @@SYSCONFDIR@@/mageversion)"
36  else  else
37   osversion="alx-UNKNOWN"   osversion="alx-UNKNOWN"
38  fi  fi
# Line 27  else Line 44  else
44   serial="UNKNOWN"   serial="UNKNOWN"
45  fi  fi
46    
47  sysinfo="Hostname: $(hostname) Serial: #${serial} OS: ${osversion} Kernel: $(uname -r)"  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}"  #len_sysinfo="${#sysinfo}"
56    
57  # calculate icon xpos  # calculate icon xpos
# Line 40  xpos="$(( ${xorg_width} / 2 ))" Line 64  xpos="$(( ${xorg_width} / 2 ))"
64  # xorg_height - text_height; text_height=22 pixel  # xorg_height - text_height; text_height=22 pixel
65  ypos="$(( ${xorg_height} - 22))"  ypos="$(( ${xorg_height} - 22))"
66    
67  cat > ~/.idesktop/sysinfo.lnk << EOF  # generate icon info
68  table Icon  ${sudo} ${MCORE_LIBDIR}/idesk-generate-icon-info \
69    Caption: ${sysinfo}   --add \
70    Command: exit 0   --name "${sysinfo}" \
71    Icon: /etc/alxconfig-ng/ica-sessions/icons/sysinfo.png   --filename "sysinfo" \
72    X: ${xpos}   --command "exit 0" \
73    Y: ${ypos}   --icon "sysinfo.png" \
74    Width: 1   --xpos "${xpos}" \
75    Height: 1   --ypos "${ypos}" \
76  end   || die "adding icon-info"
 EOF  

Legend:
Removed from v.2103  
changed lines
  Added in v.2825