Skip to content
Snippets Groups Projects
Commit 24a52d58 authored by Administrator's avatar Administrator Committed by David Emschermann
Browse files

Improve automatic installation script

Get the number of CPUs also on macosx.
Allow to define the number of used processes as command line parameter.
parent cab7fdc7
No related branches found
No related tags found
1 merge request!701Update autoinstaller script
Pipeline #15870 passed
......@@ -30,10 +30,13 @@ main()
setup_env_variables
number_of_cpus
parse_command_line "$@"
echo FSOFTVER: $FSOFTVER
echo FROOTVER: $FROOTVER
echo "FSOFTVER: $FSOFTVER"
echo "FROOTVER: $FROOTVER"
echo "NUMOFCPU: $NUMOFCPU"
check_prerequisites
......@@ -63,11 +66,21 @@ setup_env_variables()
export FSOFTVER=$FSOFTPRO
export FROOTVER=$FROOTPRO
# My experience tells me that the default could be 2, even if there is only 1 processor, as 1 processing and 1 queued job normally is optimal Will leave it at 1 though.
export NUMOFCPU=`[ -f /proc/cpuinfo ] && grep -i processor /proc/cpuinfo | wc -l || echo 1`
export CBMSRCDIR=`pwd`
}
number_of_cpus()
{
arch=`uname -s | tr '[A-Z]' '[a-z]'`
# get the number of processors
if [ "$arch" = "linux" ]; then
NUMOFCPU=$([ -f /proc/cpuinfo ] && grep -i processor /proc/cpuinfo | wc -l || echo 1)
elif [ "$arch" = "darwin" ];
then
NUMOFCPU=$(sysctl -n hw.ncpu)
fi
}
parse_command_line()
{
SETUP_FAIRSOFT=0 && SETUP_FAIRROOT=0 && SETUP_CBMROOT=0;
......@@ -97,6 +110,16 @@ parse_command_line()
export FSOFTVER=$FSOFTPRO
export FROOTVER=$FROOTPRO
shift;;
-nproc)
shift
NUMOFCPU=$1
re='^[0-9]+$'
if ! [[ $NUMOFCPU =~ $re ]]; then
echo "$NUMOFCPU passed as argument of -nproc is no integer"
exit 1
fi
echo "*** Building with $NUMOFCPU processes in parallel"
shift;;
-o|old|-old|--old)
echo "*** OLD VERSION specified"
export FSOFTVER=$FSOFTOLD
......@@ -150,13 +173,19 @@ parse_command_line()
echo "Autoinstall_framework will install FairSoft, FairRoot and CbmRoot packages"
echo "If no flags are specified, the program will install all three"
echo "otherwise the user may specify one or more to by calling the corresponding flags"
echo "-h, --help Shows this brief help"
echo "-fs, --fairsoft Installation of FairSoft"
echo "-fr, --fairroot Installation of FairRoot"
echo "-cr, --cbmroot Installation of CbmRoot"
echo
echo "-h, --help Shows this brief help"
echo
echo "-fs, --fairsoft Installation of FairSoft"
echo "-fr, --fairroot Installation of FairRoot"
echo "-cr, --cbmroot Installation of CbmRoot"
echo
echo "-nproc <number> Use <number> of paralle processes for compilation"
echo
echo "-d, --dev Runs with dev version"
echo "-p, --pro Runs with pro version"
echo "-o, --old Runs with old version"
echo
echo "-y, --yes Automatically uses new envirnoment configuration post installation"
echo "-n, --no Answers no to automatic environment update"
echo ""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment