sbsv2/raptor/bin/gethost.sh
changeset 713 7b7f0409fc00
parent 674 37ee82a83d43
equal deleted inserted replaced
712:df89378e9223 713:7b7f0409fc00
     1 #!/bin/bash
     1 #!/bin/bash
     2 
     2 
     3 
     3 
     4 # Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
     4 # Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies).
     5 # All rights reserved.
     5 # All rights reserved.
     6 # This component and the accompanying materials are made available
     6 # This component and the accompanying materials are made available
     7 # under the terms of the License "Eclipse Public License v1.0"
     7 # under the terms of the License "Eclipse Public License v1.0"
     8 # which accompanies this distribution, and is available
     8 # which accompanies this distribution, and is available
     9 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
     9 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
    23 # The idea is that it should be possible to use it for simple decisions
    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
    24 # e.g. windows/linux and more complex ones e.g. i386/x86_64
    25 
    25 
    26 getopts de  OPT
    26 getopts de  OPT
    27 
    27 
    28 if [[ "${OSTYPE}" =~ "linux" ]]; then
    28 if [[ "${OSTYPE}" =~ "linux" || "${HOSTPLATFORM}" =~ "linux" ]]; then
    29 	ARCH=$(uname -i)
    29 	ARCH=$(uname -i)
    30         LIBC=$(echo /lib/libc-* | sed -r 's#.*/libc-([0-9]*)\.([0-9]*)(\.([0-9]*))?.so#libc\1_\2#')
    30         LIBC=$(echo /lib/libc-* | sed -r 's#.*/libc-([0-9]*)\.([0-9]*)(\.([0-9]*))?.so#libc\1_\2#')
    31         HOSTPLATFORM="linux ${ARCH} ${LIBC}"
    31         HOSTPLATFORM="linux ${ARCH} ${LIBC}"
    32 
    32 
    33 	if [ "$LIBC" == "libc2_3" ]; then
    33 	# The 32-bit platform is often compatible in the sense that
    34         	HOSTPLATFORM_DIR="linux-${ARCH}"
    34 	# a) 32-bit programs can run on the 64-bit OS.
    35 	else
    35 	# b) a 64-bit OS can tell the compiler to create 32-bit executables.
    36         	HOSTPLATFORM_DIR="linux-${ARCH}-${LIBC}"
    36 
       
    37        	ARCH32="i386"
       
    38 
       
    39 	# deal with ubuntu/debian:
       
    40 	if [ "$ARCH" == "unknown" ]; then
       
    41 		ARCH32="${ARCH}"
    37 	fi
    42 	fi
       
    43 
       
    44        	HOSTPLATFORM_DIR="linux-${ARCH}-${LIBC}"
       
    45        	HOSTPLATFORM32_DIR="linux-${ARCH32}-${LIBC}"
    38 	
    46 	
    39 elif [[ "$OS" == "Windows_NT" ]]; then
    47 elif [[ "$OS" == "Windows_NT" ]]; then
    40 	HOSTPLATFORM="win 32"
    48 	HOSTPLATFORM="win 32"
    41 	HOSTPLATFORM_DIR="win32"
    49 	HOSTPLATFORM_DIR="win32"
       
    50 	HOSTPLATFORM32_DIR="win32"
    42 else
    51 else
    43 	HOSTPLATFORM=unknown
    52 	HOSTPLATFORM=unknown
    44 	HOSTPLATFORM_DIR=unknown
    53 	HOSTPLATFORM_DIR=unknown
    45 fi
    54 fi
    46 
    55 
    47 if [ "$OPT" == "e" ]; then 
    56 if [ "$OPT" == "e" ]; then 
    48 	echo "export HOSTPLATFORM_DIR=$HOSTPLATFORM_DIR"
    57 	echo "export HOSTPLATFORM_DIR=$HOSTPLATFORM_DIR"
       
    58 	echo "export HOSTPLATFORM32_DIR=$HOSTPLATFORM32_DIR"
    49 	echo "export HOSTPLATFORM='$HOSTPLATFORM'"
    59 	echo "export HOSTPLATFORM='$HOSTPLATFORM'"
    50 elif [ "$OPT" == "d" ]; then 
    60 elif [ "$OPT" == "d" ]; then 
    51 	echo "$HOSTPLATFORM_DIR"
    61 	echo "$HOSTPLATFORM_DIR"
    52 else
    62 else
    53 	echo "$HOSTPLATFORM"
    63 	echo "$HOSTPLATFORM"