linuxcnc/scripts/linuxcnc_info
Dewey Garrett 3a0e07da83 Application menu fixes
Remove latency-plot as an Application menu item as it doesn't work for
a system which has _only_ a RIP build because the environment for
execution of commands from the Application menu is limited.
(unaware of linuxcnc RIP vars, for example, package require Hal fails)

Provide an alternative point-and-click access for latency-plot,
latency-histogram:
  Since demo scripts in configs/apps/ are invoked from the main script
  (scripts/linuxcnc) where more environemntal vars are available
  these programs are modifed to work for a system with only a RIP build.

also:
  For RIP only system: make configs/apps/xhc-hb04 demos work
  Renaming for variable EMC2_SCRIPT
  Improve pyvcp_demo exit handling
  linuxcnc_info use editor search
  app scripts: prepend auto_path (RIP, gui usage)

Signed-off-by: Dewey Garrett <dgarrett@panix.com>
2014-09-28 16:18:52 -07:00

131 lines
3.6 KiB
Bash
Executable file

#!/bin/bash
# This script creates a file in /tmp and
# opens it with first visual editor found in a search list for editors
# Copyright: 2014
# Author: Dewey Garrett <dgarrett@panix.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
ofile=/tmp/linuxcnc.info
# all output
exec 1>$ofile
exec 2>&1
# try to find a visual editor to show created file
# use list with existing preference first, then other common editors
editors="$VISUAL gedit mousepad geany nedit gvim abiword"
for e in $editors ; do
if [ -x "$(which $e)" ] ; then
VIEWER=$e
break #use first editor found
fi
done
function show () {
if [ -z "$1" ] ; then
echo
return
fi
name=$1
shift
value=$*
printf "%20s: %s\n" "$name" "$value"
}
function parse_cpuinfo () {
cat /proc/cpuinfo|grep "$1"|head -1|cut -d: -f2-
}
function parse_after_colon () {
echo "$*"|cut -d: -f2-
}
function tryversion () {
prog="$1"
if [ $(which "$prog") ] ; then
ans=$($prog --version 2>/dev/null)
if [ -z "$ans" ] ; then
echo "?"
else
echo "$ans"
fi
else
echo "not_in_PATH"
fi
}
cat <<EOF
This file can be posted to a web site like:
http://pastebin.com
in order to provide information about the linuxcnc
system and configuration.
EOF
echo VIEWER=$VIEWER
show " Date" $(date)
show " UTC Date" $(date -u)
show " this program" $0
show " uptime" $(uptime)
show " lsb_release -sa" $(lsb_release -sa 2>/dev/null)
show " which linuxcnc" $(which linuxcnc)
show " pwd" $(pwd -P)
show " USER" $USER
show " LOGNAME" $LOGNAME
show " HOME" $HOME
show " EDITOR" $EDITOR
show " VISUAL" $VISUAL
show " LANGUAGE" $LANGUAGE
show " TERM" $TERM
show " COLORTERM" $COLORTERM
show " DISPLAY" $DISPLAY
show " display size" $(parse_after_colon $(xdpyinfo|grep dimensions))
echo
echo "uname items:"
show " nodename -n" $(uname -n)
show " kernel-name -s" $(uname -s)
show " kernel-vers -v" $(uname -v)
show " machine -k" $(uname -n)
show " processor -p" $(uname -p)
show " platform -i" $(uname -i)
show " oper system -o" $(uname -o)
show ""
echo "/proc items:"
show " cmdline" $(< /proc/cmdline)
show " model name" $(parse_cpuinfo "model name")
show " cores" $(parse_cpuinfo "cpu cores")
show " cpu MHz" $(parse_cpuinfo "cpu MHz")
show " parport" $(cat /proc/ioports|grep parport)
show " serial" $(cat /proc/ioports|grep serial)
echo
echo "Varsions:"
show " gcc" $(gcc --version|head -1)
show " python" $(python --version 2>&1)
show " git" $(git --version)
show " tcl" $(echo "puts $::tcl_version"|tclsh)
show " tk" $(echo "puts $::tk_version;destroy ."|wish)
show " glade" $(tryversion glade)
show " glade-gtk2" $(tryversion glade-gtk2)
echo
echo "linuxcnc_var all:"
echo
for n in $(linuxcnc_var all) ; do
show "${n%%=*}" ${n##*=}
done
[ -n $VIEWER ] && $VIEWER "$ofile"