#!/bin/bash # # USAGE: ./installOF9.10 # # Created by Mads Reck (madstmp (a-t) gmail.com) # REVISION # September 2009 # Revision 11, march 21, 2010, some fixes be Bruno Santos # Revision 10, march 16, 2010, arch-check by Fabio Canesin # Revision 09, march 15, 2010, New fixup section by Bruno Santos # Revision 08, january 27 , 2010, changed fixup to be more general - I hope # Revision 07, december 11, 2009, git changed to http # Revision 06, november 28, fixup for Ubuntu 9.10 # Revision 05, november 05, git pull removed # Revision 04, october 20, 2009 # set -e ARCH=`uname -m` echo "-----------------------------------------------------" echo "Created by..................Mads Reck " echo "Revisions and updates.......Bruno Santos " echo " Anton Kidess " echo " Fabio Canesin " echo "-----------------------------------------------------" if [ x`echo $ARCH | grep -e "i.86"` != "x" ]; then #works for i?86 echo " Your system appears to be 32 BIT. Acting accordingly" echo "-----------------------------------------------------" echo "Making sure that you have all needed libraries" echo "-----------------------------------------------------" echo "Apparently we need to run apt-get multiple times to " echo " be SURE that everything is installed " sudo apt-get update -y sudo apt-get upgrade -y sudo apt-get install -y binutils-dev flex git git-core build-essential python-dev libqt4-dev libreadline5-dev wget zlib1g-dev cmake cd ~ mkdir OpenFOAM cd OpenFOAM echo "------------------------------------------------------" echo "Downloading ThirdParty stuff" echo "------------------------------------------------------" wget http://downloads.sourceforge.net/foam/ThirdParty-1.6.General.gtgz?use_mirror=mesh wget http://downloads.sourceforge.net/foam/ThirdParty-1.6.linuxGcc.gtgz?use_mirror=mesh echo "------------------------------------------------------" echo "Untarring - this takes a while..." echo "------------------------------------------------------" tar xfz ThirdParty-1.6.General.gtgz tar xfz ThirdParty-1.6.linuxGcc.gtgz echo "FIX up for Ubuntu 9.10" cd ~/OpenFOAM/ThirdParty-1.6/gcc-4.3.3/platforms/linux/lib mv libstdc++.so.6 libstdc++.so.6.orig ln -s `locate libstdc++.so.6.0 | grep "^/usr/lib" | head -n 1` libstdc++.so.6 mv libgcc_s.so.1 libgcc_s.so.1.orig ln -s `locate libgcc_s.so. | grep "^/lib" | head -n 1` libgcc_s.so.1 cd ~/OpenFOAM echo "Fix up done" echo "------------------------------------------------------" echo "Retrieveing OpenFOAM..." echo "------------------------------------------------------" ln -s ~/OpenFOAM/ThirdParty-1.6 ~/OpenFOAM/ThirdParty-1.6.x git clone http://repo.or.cz/r/OpenFOAM-1.6.x.git cd OpenFOAM-1.6.x/ . ~/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc echo . ~/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc >> ~/.bashrc echo "------------------------------------------------------" echo "Compiling OpenFOAM...output is in make.log" echo " THIS CAN TAKE HOURS" echo "------------------------------------------------------" ./Allwmake >make.log 2>&1 echo "------------------------------------------------------" echo "Checking installation - you should see NO criticals..." echo "------------------------------------------------------" foamInstallationTest fi if [ "$ARCH" == "x86_64" ]; then echo "-----------------------------------------------------" echo " Your system appears to be 64 BIT. Acting accordingly" echo "-----------------------------------------------------" echo "Making sure that you have all needed libraries" echo "-----------------------------------------------------" echo "Apparently we need to run apt-get multiple times to " echo " be SURE that everything is installed " sudo apt-get update -y sudo apt-get upgrade -y sudo apt-get install -y binutils-dev flex git git-core build-essential python-dev libqt4-dev libreadline5-dev wget zlib1g-dev cmake cd ~ mkdir OpenFOAM cd OpenFOAM echo "------------------------------------------------------" echo "Downloading ThirdParty stuff" echo "------------------------------------------------------" wget http://downloads.sourceforge.net/foam/ThirdParty-1.6.General.gtgz?use_mirror=mesh wget http://downloads.sourceforge.net/foam/ThirdParty-1.6.linux64Gcc.gtgz?use_mirror=mesh echo "------------------------------------------------------" echo "Untarring - this takes a while..." echo "------------------------------------------------------" tar xfz ThirdParty-1.6.General.gtgz tar xfz ThirdParty-1.6.linux64Gcc.gtgz echo "FIX up for Ubuntu 9.10" cd ~/OpenFOAM/ThirdParty-1.6/gcc-4.3.3/platforms/linux64/lib64 mv libstdc++.so.6 libstdc++.so.6.orig ln -s `locate libstdc++.so.6.0 | grep "^/usr/lib" | head -n 1` libstdc++.so.6 mv libgcc_s.so.1 libgcc_s.so.1.orig ln -s `locate libgcc_s.so. | grep "^/lib" | head -n 1` libgcc_s.so.1 cd ~/OpenFOAM echo "Fix up done" echo "------------------------------------------------------" echo "Retrieveing OpenFOAM..." echo "------------------------------------------------------" ln -s ~/OpenFOAM/ThirdParty-1.6 ~/OpenFOAM/ThirdParty-1.6.x git clone http://repo.or.cz/r/OpenFOAM-1.6.x.git cd OpenFOAM-1.6.x/ . ~/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc echo . ~/OpenFOAM/OpenFOAM-1.6.x/etc/bashrc >> ~/.bashrc echo "------------------------------------------------------" echo "Compiling OpenFOAM...output is in make.log" echo " THIS CAN TAKE HOURS" echo "------------------------------------------------------" ./Allwmake >make.log 2>&1 echo "------------------------------------------------------" echo "Checking installation - you should see NO criticals..." echo "------------------------------------------------------" foamInstallationTest fi set +e