File getOpenFOAMgit.sh of Package openfoam22x

#! /bin/bash

version=2.2.x

# Get source
  echo "Get source..."
  if [ -d OpenFOAM-${version}.git ]; then
   # Update
   pushd OpenFOAM-${version}.git
    git pull
   popd
  else
   # Clone
   git clone git://github.com/OpenFOAM/OpenFOAM-${version}.git OpenFOAM-${version}.git
  fi
  # Get git revision
  pushd OpenFOAM-${version}.git
    git_rev_short=`git rev-parse --short HEAD`
    git_rev_long=`git rev-parse HEAD`
  popd

# Package source directory...
  echo "Copy sources to package directory..."
  rm -rf OpenFOAM-${version}
  cp -rf OpenFOAM-${version}.git OpenFOAM-${version}
  rm -rf OpenFOAM-${version}/.git*
  echo `date` > OpenFOAM-${version}/git-${git_rev_long}

  echo "Compress package directory..."
  rm -rf OpenFOAM-${version}-git${git_rev_short}.tar.bz2
  tar -cjf OpenFOAM-${version}-git${git_rev_short}.tar.bz2 OpenFOAM-${version}/

  echo "Remove package directory..."
  rm -rf OpenFOAM-${version}

  ls --color -l ./

# Set git revision in spec-file
  sed s/define.openfoam_git_revision.*$/define\ openfoam_git_revision\ ${git_rev_short}/ \
      -i openfoam22x.spec