sbsv2/raptor/bin/gethost.sh
changeset 0 044383f39525
child 674 37ee82a83d43
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 #!/bin/bash
       
     2 
       
     3 
       
     4 # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     5 # All rights reserved.
       
     6 # This component and the accompanying materials are made available
       
     7 # under the terms of the License "Eclipse Public License v1.0"
       
     8 # which accompanies this distribution, and is available
       
     9 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    10 #
       
    11 # Initial Contributors:
       
    12 # Nokia Corporation - initial contribution.
       
    13 #
       
    14 # Contributors:
       
    15 #
       
    16 # Description:
       
    17 # Determine hosttype
       
    18 #
       
    19 #
       
    20 
       
    21 # Print out a list of host information in order of significance.
       
    22 # for use within Makefiles and other scripts.
       
    23 # The idea is that it should be possible to use it for simple decisions
       
    24 # e.g. windows/linux and more complex ones e.g. i386/x86_64
       
    25 
       
    26 getopts de  OPT
       
    27 
       
    28 if [[ "${OSTYPE}" =~ "linux" ]]; then
       
    29 	ARCH=$(uname -i)
       
    30         LIBC=$(echo /lib/libc-* | sed -r 's#.*/libc-([0-9]*)\.([0-9]*)(\.([0-9]*))?.so#libc\1_\2#')
       
    31         HOSTPLATFORM="linux ${ARCH} ${LIBC}"
       
    32 
       
    33 	if [ "$LIBC" == "libc2_3" ]; then
       
    34         	HOSTPLATFORM_DIR="linux-${ARCH}"
       
    35 	else
       
    36         	HOSTPLATFORM_DIR="linux-${ARCH}-${LIBC}"
       
    37 	fi
       
    38 	
       
    39 elif [[ "$OS" == "Windows_NT" ]]; then
       
    40 	HOSTPLATFORM="win 32"
       
    41 	HOSTPLATFORM_DIR="win32"
       
    42 else
       
    43 	HOSTPLATFORM=unknown
       
    44 	HOSTPLATFORM_DIR=unknown
       
    45 fi
       
    46 
       
    47 if [ "$OPT" == "e" ]; then 
       
    48 	echo "export HOSTPLATFORM_DIR=$HOSTPLATFORM_DIR"
       
    49 	echo "export HOSTPLATFORM='$HOSTPLATFORM'"
       
    50 elif [ "$OPT" == "d" ]; then 
       
    51 	echo "$HOSTPLATFORM_DIR"
       
    52 else
       
    53 	echo "$HOSTPLATFORM"
       
    54 fi