#!/bin/bash

# ------------------------------------------------------------
# RPC Project :
# RPC_system_info : return main characteristics of the system
# 
# works without argument
# P. Robert, LPP, 2014-02-14
# ------------------------------------------------------------
Narg=0

if( (test $# = 1 ) && (test $1 = -h ) ) ; then hh=1 ; else hh=0 ; fi

if test $# != $Narg || test $hh = 1
   then
   echo "$appli : return main characteristics of the system"
   echo "$appli   require $Narg argument(s)"
   echo ""
   if test $hh = 1 ; then exit 0 ; fi
   echo "$appli36 : *** ERROR ! Command aborted." >&2
   exit 1
fi

echo
echo "------------------------------------------------------------------------"
uname -n > /dev/null
if test $? = 0 ; then echo "network node hostname : `uname -n`" ; fi
uname -s > /dev/null
if test $? = 0 ; then echo "kernel name           : `uname -s`" ; fi
uname -r > /dev/null
if test $? = 0 ; then echo "kernel release        : `uname -r`" ; fi
uname -v > /dev/null
if test $? = 0 ; then echo "kernel version        : `uname -v`" ; fi
uname -o > /dev/null
if test $? = 0 ; then echo "operating system      : `uname -o`" ; fi
uname -m > /dev/null
if test $? = 0 ; then echo "machine hardware name : `uname -m`" ; fi
uname -p > /dev/null
if test $? = 0 ; then echo "processor type        : `uname -p`" ; fi
uname -i > /dev/null
if test $? = 0 ; then echo "hardware platform     : `uname -i`" ; fi

Syst=`uname -o`

if (test $Syst = Msys)
    then
       num=`ipconfig | grep Adresse IPv4 |sed -e "s/.*IPv4://"`
       if test $? = 0 ; then echo "adresse IPv4          : $num" ; fi
    else
      num=`ifconfig | grep Bcast |sed -e "s/Bcast.*//" -e "s/.*adr://"`
      if test $? = 0 ; then echo "adresse IPv4          : $num" ; fi
fi
echo "------------------------------------------------------------------------"
echo
