X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=Linux%2Fscripts%2FLocalFunctions.sh;h=662fbae0d65c126df57ced28728e28c141813ad4;hb=1195cf5621f8d7a36af22f32633d443e8d29221d;hp=9075cf2673dcec9539944b273c2ac46630bfa0c6;hpb=226677f5b7419d7bfdf7914b338af561d675605d;p=creaToolsTools.git diff --git a/Linux/scripts/LocalFunctions.sh b/Linux/scripts/LocalFunctions.sh index 9075cf2..662fbae 100644 --- a/Linux/scripts/LocalFunctions.sh +++ b/Linux/scripts/LocalFunctions.sh @@ -51,7 +51,7 @@ function bigDisplay { ########################################### function checkDistrib { local OS=$1 - if [ "`checkVal $OS MacOS Fedora Ubuntu Mandriva`" == "false" ] ; then + if [ "`checkVal $OS MacOS Fedora Ubuntu Mandriva CentOS`" == "false" ] ; then echo "Operating System not supported: $OS" echo "Currently supported system: Fedora Ubuntu MacOS" exit 1 @@ -62,8 +62,14 @@ function checkDistrib { function getDistrib { local OS=`uname` - if [ "$OS" == Darwin ] ; then OS=MacOS; - elif [ "$OS" == Linux ] ; then OS=`awk 'NR==1{print $1}' /etc/issue` + if [ "$OS" == Darwin ] ; then OS=MacOS; +##EED2016-10-15 +## elif [ "$OS" == Linux ] ; then OS=$(lsb_release -i | awk '{print $3}') + elif [ "$OS" == Linux ] ; then + OS=`awk 'NR==1{print $1}' /etc/system-release` + if [ "$OS" == "" ] ; then + OS=$(lsb_release -i | awk '{print $3}') + fi else OS="" fi # checkDistrib $OS @@ -75,19 +81,37 @@ function getDistribVersion { local DISTRIB=`getDistrib` if [ "$DISTRIB" == MacOS ] ; then OSVesion=VOID_Darwin_EED; - elif [ "$DISTRIB" == Fedora ] ; then OSVersion=`awk 'NR==1{print $3}' /etc/issue` + elif [ "$DISTRIB" == Fedora ] ; then OSVersion=`awk 'NR==1{print $3}' /etc/system-release` elif [ "$DISTRIB" == Ubuntu ] ; then OSVersion=`awk 'NR==1{print $2}' /etc/issue` + elif [ "$DISTRIB" == CentOS ] ; then OSVersion=`awk 'NR==1{print $3}' /etc/issue` else OSVersion="VOID_EED" fi echo $OSVersion } +########################################### +function getKernelVersion { + local DISTRIB=`getDistrib` + + if [ "$DISTRIB" == MacOS ] ; then KernelVesion=VOID_Darwin_EED; + elif [ "$DISTRIB" == Fedora ] ; then KernelVersion=$(uname -a | awk '{print $3}') + elif [ "$DISTRIB" == Ubuntu ] ; then KernelVersion=$(uname -a | awk '{print $3}') + elif [ "$DISTRIB" == CentOS ] ; then KernelVersion=$(uname -a | awk '{print $3}') + else KernelVersion="VOID_EED" + fi + echo $KernelVersion +} + + + + ########################################### function getDownloadCommand { local DISTRIB=`getDistrib` if [ "$DISTRIB" == MacOS ] ; then downloadCommand=curl; - elif [ "$DISTRIB" == Fedora ] ; then downloadCommand=aria -x 16 + elif [ "$DISTRIB" == Fedora ] ; then downloadCommand='aria2c -x 16' + elif [ "$DISTRIB" == CentOs ] ; then downloadCommand='aria2c -x 16' elif [ "$DISTRIB" == Ubuntu ] ; then downloadCommand=wget else downloadCommand="VOID_EED" fi @@ -97,7 +121,9 @@ function getDownloadCommand { ########################################### function getncore { if [ `uname` == Darwin ] ; then # MacOS - system_profiler | grep Processor | awk '$1=="Number" {print $4}' +#EED 2018-08-26 +# system_profiler | grep Processor | awk '$1=="Number" {print $4}' + sysctl hw.physicalcpu hw.logicalcpu | grep logicalcpu | awk '{print $2}' else cat /proc/cpuinfo | grep processor | wc -l fi