diff options
Diffstat (limited to 'tec_uname')
-rw-r--r-- | tec_uname | 137 |
1 files changed, 137 insertions, 0 deletions
diff --git a/tec_uname b/tec_uname new file mode 100644 index 0000000..acf22b0 --- /dev/null +++ b/tec_uname @@ -0,0 +1,137 @@ +#!/bin/bash + +Pause() +{ + echo -n Press Enter to continue or Ctrl+C to abort... + read contscr + echo ' ' +} + +ComputeTecUname() +{ + # Base Defintions + TEC_SYSNAME=`uname -s` + TEC_SYSVERSION=`uname -r|cut -f1 -d.` + TEC_SYSMINOR=`uname -r|cut -f2 -d.` + TEC_SYSARCH=`uname -m` + + # Fixes + if [ $TEC_SYSNAME == SunOS ]; then + TEC_SYSARCH=`uname -p` + fi + if [ $TEC_SYSNAME == IRIX ]; then + TEC_SYSARCH=`uname -p` + fi + if [ $TEC_SYSNAME == FreeBSD ]; then + TEC_SYSMINOR=`uname -r|cut -f2 -d.|cut -f1 -d-` + fi + if [ $TEC_SYSNAME == AIX ]; then + TEC_SYSVERSION=`uname -v` + TEC_SYSMINOR=`uname -r` + TEC_SYSARCH=ppc + fi + if [ $TEC_SYSNAME == Darwin ]; then + TEC_SYSNAME=MacOS + TEC_SYSVERSION=`sw_vers -productVersion|cut -f1 -d.` + TEC_SYSMINOR=`sw_vers -productVersion|cut -f2 -d.` + TEC_SYSARCH=`uname -p` + fi + + if [ $TEC_SYSARCH == i686 ]; then + TEC_SYSARCH=x86 + fi + if [ $TEC_SYSARCH == i386 ]; then + TEC_SYSARCH=x86 + fi + if [ $TEC_SYSARCH == powerpc ]; then + TEC_SYSARCH=ppc + fi + if [ $TEC_SYSARCH == x86_64 ]; then + TEC_SYSARCH=x64 + fi + if [ $TEC_SYSARCH == amd64 ]; then + TEC_SYSARCH=x64 + fi + + # Compose + TEC_UNAME=$TEC_SYSNAME$TEC_SYSVERSION$TEC_SYSMINOR + + # Cygwin + CYGW=`uname -s|cut -f1 -d-` + if [ $CYGW == CYGWIN_NT ]; then + TEC_SYSNAME=CYGWIN + TEC_UNAME='cygw'$TEC_SYSVERSION$TEC_SYSMINOR + fi + + # Linux 2.4 and GCC 3.x + if [ $TEC_UNAME == Linux24 ]; then + GCCVER=`gcc -dumpversion|cut -f1 -d.` + if [ $GCCVER == 3 ]; then + TEC_UNAME=$TEC_UNAME'g3' + fi + fi + + # Linux 2.6 and GCC 4.x + if [ $TEC_UNAME == Linux26 ]; then + GCCVER=`gcc -dumpversion|cut -f1 -d.` + if [ $GCCVER == 4 ]; then + TEC_UNAME=$TEC_UNAME'g4' + fi + fi + + # Linux and PowerPC + if [ $TEC_SYSNAME == Linux ]; then + if [ $TEC_SYSARCH == ppc ]; then + TEC_UNAME=$TEC_UNAME'ppc' + fi + fi + + # 64-bits Linux + if [ $TEC_SYSNAME == Linux ]; then + if [ $TEC_SYSARCH == x64 ]; then + BUILD_64=Yes + TEC_UNAME=$TEC_UNAME'_64' + fi + + if [ $TEC_SYSARCH == ia64 ]; then + BUILD_64=Yes + TEC_UNAME=$TEC_UNAME'_ia64' + fi + fi + + # 64-bits FreeBSD + if [ $TEC_SYSNAME == FreeBSD ]; then + if [ $TEC_SYSARCH == x64 ]; then + BUILD_64=Yes + TEC_UNAME=$TEC_UNAME'_64' + fi + fi + + # Solaris and Intel + if [ $TEC_SYSNAME == SunOS ]; then + if [ $TEC_SYSARCH == x86 ]; then + TEC_UNAME=$TEC_UNAME'x86' + fi + fi + + # MacOS and Intel + if [ $TEC_SYSNAME == MacOS ]; then + if [ $TEC_SYSMINOR == 6 ]; then + TEC_SYSARCH=x64 + else + if [ $TEC_SYSARCH == x86 ]; then + TEC_UNAME=$TEC_UNAME'x86' + fi + fi + fi + + TU_DEBUG=1 + if [ $TU_DEBUG == 1 ]; then + echo ' ' + echo ' Info:' + echo 'TEC_SYSNAME='$TEC_SYSNAME + echo 'TEC_SYSVERSION='$TEC_SYSVERSION + echo 'TEC_SYSMINOR='$TEC_SYSMINOR + echo 'TEC_SYSARCH='$TEC_SYSARCH + fi +} |