00001 #!/bin/bash
00002
00003 # Find platform.
00004 #
00005 #check_platform () {
00006
00007 #WE really needed?
00008 export ARCH="`uname`"
00009
00010 echo -n "Checking for OS ... " >&2
00011 if [ ! -s /etc/redhat-release ] ; then
00012 echo " not RedHat-derived. Stop." >&2
00013 exit 1
00014 fi
00015 if [ "x$(grep "Scientific Linux" /etc/redhat-release)" = "x" ] && [ "x$(grep "CentOS" /etc/redhat-release)" = "x" ] ; then
00016 echo "not SLC! Scientific Linux [345] expected. Stop." >&2
00017 exit 1
00018 fi
00019
00020 slc_major=$(sed 's/^.*[Rr]elease[ ]\+\([0-9]\+\)\..*$/\1/' < /etc/redhat-release)
00021 echo "SLC "$slc_major >&2
00022
00023 if [ $slc_major -eq 4 ]; then
00024
00025 echo -n "Checking for machine ... " >&2
00026 machine=$(uname -m | grep -E "i[3456]86")
00027 if [ "x$machine" = "x" ] ; then
00028 machine=$(uname -m)
00029 case "X${machine}" in
00030 "Xx86_64") machine="amd64" ;;
00031 esac
00032 else
00033 machine="ia32"
00034 fi
00035 echo $machine >&2
00036
00037 gcc_major=$(g++ --version | sed '2,$d;s/^[^ ]\+[ ]\+[^ ]\+[ ]\+\([0-9]\+\)\..*$/\1/')
00038 gcc_minor=$(g++ --version | sed '2,$d;s/^.*GCC)[ ]\+[0-9]\+\.\([0-9]\+\)\.\([0-9]\+\).*$/\1\2/')
00039
00040 platform="slc${slc_major}_${machine}_gcc${gcc_major}${gcc_minor}"
00041 platform=$(echo ${platform} | sed 's/gcc34[0-9]*$/gcc34/')
00042 echo "Platform is "${platform}
00043
00044 export SYSNAME=${platform}
00045
00046 elif [ $slc_major -eq 5 ]; then
00047
00048 # boot strapping gcc43 compiler
00049
00050 # get machine arch
00051 if test "x${MACHINE_ARCH}" = "x" ; then
00052 MACHINE_ARCH=`uname -m` ;
00053 fi ;
00054
00055 # forcing compiler to gcc43 with correct platform
00056 source /afs/cern.ch/sw/lcg/external/gcc/4.3.2/${MACHINE_ARCH}/setup.sh
00057
00058 echo $PATH
00059 gcc -v
00060
00061 . ./lcg_platform.sh
00062 lcg_platform >& /dev/null
00063 SYSNAME=$LCG_PLATFORM
00064
00065 else
00066
00067 echo "Found SL major version $slc_major: not supported in check_platform"
00068 exit 1
00069
00070 fi
00071
00072 echo SYSNAME is $SYSNAME