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 2108 by niro, Thu Jan 2 14:57:21 2014 UTC mcore-src/trunk/mcore-tools/src/modules/idesk/idesk-sysinfo.in revision 2413 by niro, Mon Aug 31 11:11:18 2015 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)  eval $(${x11runas} xinfo)
21    
22  # fallback  # fallback
23  [[ -z ${xorg_width} ]] && xorg_width="1024"  [[ -z ${xorg_width} ]] && xorg_width="1024"
24  [[ -z ${xorg_height} ]] && xorg_width="768"  [[ -z ${xorg_height} ]] && xorg_width="768"
25    
26  if [ -e /etc/os-release ]  if [ -e @@SYSCONFDIR@@/os-release ]
27  then  then
28   osversion=$(source /etc/os-release; echo "${ID}-${Version_ID}")   osversion=$(source @@SYSCONFDIR@@/os-release; echo "${ID}-${Version_ID}")
29  elif [ -e /etc/mageversion ]  elif [ -e @@SYSCONFDIR@@/mageversion ]
30  then  then
31   osversion="alx-$(< /etc/mageversion)"   osversion="alx-$(< @@SYSCONFDIR@@/mageversion)"
32  else  else
33   osversion="alx-UNKNOWN"   osversion="alx-UNKNOWN"
34  fi  fi
# Line 27  else Line 40  else
40   serial="UNKNOWN"   serial="UNKNOWN"
41  fi  fi
42    
43  sysinfo="Hostname: $(hostname) Serial: #${serial} OS: ${osversion} Kernel: $(uname -r)"  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  #len_sysinfo="${#sysinfo}"  #len_sysinfo="${#sysinfo}"
52    
53  # calculate icon xpos  # calculate icon xpos
# Line 40  xpos="$(( ${xorg_width} / 2 ))" Line 60  xpos="$(( ${xorg_width} / 2 ))"
60  # xorg_height - text_height; text_height=22 pixel  # xorg_height - text_height; text_height=22 pixel
61  ypos="$(( ${xorg_height} - 22))"  ypos="$(( ${xorg_height} - 22))"
62    
63  [ -d ~/.idesktop ] || install -d ~/.idesktop  # generate icon info
64    ${sudo} ${MCORE_LIBDIR}/idesk-generate-icon-info \
65  cat > ~/.idesktop/sysinfo.lnk << EOF   --add \
66  table Icon   --name "${sysinfo}" \
67    Caption: ${sysinfo}   --filename "sysinfo" \
68    Command: exit 0   --command "exit 0" \
69    Icon: /etc/alxconfig-ng/ica-sessions/icons/sysinfo.png   --icon "sysinfo.png" \
70    X: ${xpos}   --xpos "${xpos}" \
71    Y: ${ypos}   --ypos "${ypos}" \
72    Width: 1   || die "adding icon-info"
   Height: 1  
 end  
 EOF  

Legend:
Removed from v.2108  
changed lines
  Added in v.2413