diff --git a/bin/foamPackGeneral b/bin/foamBinDirs
similarity index 60%
rename from bin/foamPackGeneral
rename to bin/foamBinDirs
index 886f62a275177d9827e4a5f1e6725bec1ca29753..ef96dee328db3882d6bd9e5c4504a70970687391 100755
--- a/bin/foamPackGeneral
+++ b/bin/foamBinDirs
@@ -1,11 +1,11 @@
 #!/bin/sh
-#------------------------------------------------------------------------------
+#---------------------------------*- sh -*-------------------------------------
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
 #    \\/     M anipulation  |
-#-------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
 #
@@ -23,47 +23,38 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # Script
-#     foamPackGeneral [outputDir]
+#     foamBinDirs <packDir> <arch>
 #
 # Description
-#     Packs and compresses the OpenFOAM directory for release
+#     Returns all directories containing binary files of OpenFOAM
 #
 #------------------------------------------------------------------------------
 
-timeStamp=$(date +%Y-%m-%d)
-packDir=$WM_PROJECT-$WM_PROJECT_VERSION
-packFile=${packDir}.General_${timeStamp}.gtgz
-
-if [ ! -d $packDir ]
+if [ $# -ne 2 ]
 then
-    echo "Error: directory $packDir does not exist"
+    echo "Error: architecture type expected, exiting"
+    echo
+    echo "Usage : ${0##*/} <packDir> <arch>"
+    echo
     exit 1
 fi
-
-# add optional output directory
-if [ -d "$1" ]
-then
-    packFile="$1/$packFile"
-fi
-
-if [ -f $packFile ]
-then
-    echo "Error: $packFile already exists"
-    exit 1
-fi
-
-# Create time stamp file
-# ~~~~~~~~~~~~~~~~~~~~~~
-
-echo $timeStamp 2>/dev/null > $packDir/.timeStamp
-
-# Pack and compress the packFile
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-echo
-echo "Packing $packDir source files into $packFile"
-echo
-
-foamPackSource $packDir $packFile
+packDir=$1
+arch=$2
+
+# base arch (w/o precision, optimization, etc)
+baseArch=$(echo "$arch" | sed -e 's@[DS]P.*$@@')
+
+# get list of directories
+(
+    for dir in \
+        $packDir/lib/$arch \
+        $packDir/applications/bin/$arch \
+        $packDir/wmake/rules \
+        $packDir/wmake/bin/$baseArch \
+        ;
+    do
+        [ -d $dir ] && echo $dir
+    done
+)
 
 #------------------------------------------------------------------------------
diff --git a/bin/foamPack b/bin/foamPack
index ed1200f246918fa3be92d4b00dea1a495590fd2f..920bfaf52b1c5e64977b0fc1d05de413bb6f05d4 100755
--- a/bin/foamPack
+++ b/bin/foamPack
@@ -1,11 +1,11 @@
 #!/bin/sh
-#------------------------------------------------------------------------------
+#---------------------------------*- sh -*-------------------------------------
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
 #    \\/     M anipulation  |
-#-------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
 #
@@ -29,7 +29,6 @@
 #     Packs and compresses the OpenFOAM directory for release
 #
 #------------------------------------------------------------------------------
-tmpFile=${TMPDIR:-/tmp}/foamPackFiles.$$
 
 timeStamp=$(date +%Y-%m-%d)
 packDir=$WM_PROJECT-$WM_PROJECT_VERSION
@@ -37,7 +36,7 @@ packFile=${packDir}_${timeStamp}.gtgz
 
 if [ ! -d $packDir ]
 then
-    echo "Error: directory $packDir does not exist" 1>&2
+    echo "Error: directory $packDir does not exist"
     exit 1
 fi
 
@@ -49,7 +48,7 @@ fi
 
 if [ -f $packFile ]
 then
-    echo "Error: $packFile already exists" 1>&2
+    echo "Error: $packFile already exists"
     exit 1
 fi
 
@@ -58,54 +57,13 @@ fi
 
 echo $timeStamp 2>/dev/null > $packDir/.timeStamp
 
-# Clean up on termination and on Ctrl-C
-trap 'rm -f $tmpFile 2>/dev/null; exit 0' EXIT TERM INT
-
-
-# Pack and compress the packFile using GNU tar
-# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# Pack and compress the packFile
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 echo
-echo "Packing foam version $packDir into $packFile"
+echo "Packing $packDir source files into $packFile"
 echo
-echo "finding and packing"
 
-find -H $packDir               \
-    ! -type d -type f          \
-    ! -name "*~"               \
- -a ! -name ".*~"              \
- -a ! -name "*.orig"           \
- -a ! -name "*.dep"            \
- -a ! -name "*.o"              \
- -a ! -name "*.so"             \
- -a ! -name "*.a"              \
- -a ! -name "core"             \
- -a ! -name "core.[1-9]*"      \
- -a ! -name "pvml.[1-9]*"      \
- -a ! -name "log[0-9]*"        \
- -a ! -name "so_locations"     \
-| sed                          \
- -e "\@$packDir/lib/@d"        \
- -e '\@/\.git/@d'              \
- -e '\@applications/bin/@d'    \
- -e '\@wmake/bin/@d'           \
- -e '\@/t/@d'                  \
- -e '\@Make[.A-Za-z]*/[^/]*/@d'   \
- -e '\@doc/[Dd]oxygen/html@d'     \
- -e '\@doc/[Dd]oxygen/latex@d'    \
- -e '\@doc/[Dd]oxygen/man@d'      \
- -e '\@/lnInclude@d'              \
- -e '\@/ii_files@d'               \
- | tee $tmpFile
-
-tar czpf $packFile --files-from $tmpFile
-
-if [ $? -eq 0 ]
-then
-    echo "Finished packing and compressing $packDir into file $packFile"
-else
-    echo "Error: failure packing $packDir into file $packFile" 1>&2
-    rm -f $packFile 2>/dev/null
-fi
+foamPackSource $packDir $packFile
 
 #------------------------------------------------------------------------------
diff --git a/bin/foamPackBin b/bin/foamPackBin
index 8f356521d1e139859dc10db323779d9eecc44de5..3a6358f5970def5c8910a0463a9e50441e6bf638 100755
--- a/bin/foamPackBin
+++ b/bin/foamPackBin
@@ -70,17 +70,7 @@ do
 done
 
 # get list of directories
-dirList=$(
-    for dir in \
-        $packDir/lib/$arch \
-        $packDir/applications/bin/$arch \
-        $packDir/wmake/rules \
-        $packDir/wmake/bin/$baseArch \
-        ;
-    do
-        [ -d $dir ] && echo $dir
-    done
-)
+dirList=`foamBinDirs $packDir $arch`
 
 echo
 echo "Packing $arch ($baseArch) port of $packDir into $packFile"
diff --git a/bin/foamPackSource b/bin/foamPackSource
index 6af0c145ab9cd84819601c2785e6eb93364f2d26..8305a929a8251208ebcc5a71ce1dcd04a6d7cd10 100755
--- a/bin/foamPackSource
+++ b/bin/foamPackSource
@@ -61,34 +61,7 @@ fi
 # Clean up on termination and on Ctrl-C
 trap 'rm -f $tmpFile 2>/dev/null; exit 0' EXIT TERM INT
 
-find -H $packDir               \
-    ! -type d                  \
-   \( -type f -o -type l \)    \
-    ! -name "*~"               \
- -a ! -name ".*~"              \
- -a ! -name "*.orig"           \
- -a ! -name "*.dep"            \
- -a ! -name "*.o"              \
- -a ! -name "*.so"             \
- -a ! -name "*.a"              \
- -a ! -name "*.tgz"            \
- -a ! -name "core"             \
- -a ! -name "core.[1-9]*"      \
- -a ! -name "libccmio*"        \
-| sed                          \
- -e "\@$packDir/lib/@d"        \
- -e '\@/\.git/@d'              \
- -e '\@/\.tags/@d'             \
- -e '\@/\README\.org@d'        \
- -e '\@applications/bin/@d'    \
- -e '\@wmake/bin/@d'           \
- -e '\@/t/@d'                  \
- -e '\@/Make[.A-Za-z]*/[^/]*/@d'\
- -e '\@/platforms/@d'          \
- -e '\@/download/@d'           \
- -e '\@/libccmio-.*/@d'        \
- -e '\@/debian/@d'
- > $tmpFile
+foamSourceFiles $packDir > $tmpFile
 
 
 # provide some feedback
diff --git a/bin/foamPackThirdPartyGeneral b/bin/foamPackThirdParty
similarity index 91%
rename from bin/foamPackThirdPartyGeneral
rename to bin/foamPackThirdParty
index 2a14492af5e28783dd57bac1d5315b92b0290d03..4cd5b9c9ee6dd2bb4885a96f46b303e475d3866c 100755
--- a/bin/foamPackThirdPartyGeneral
+++ b/bin/foamPackThirdParty
@@ -1,11 +1,11 @@
 #!/bin/sh
-#------------------------------------------------------------------------------
+#---------------------------------*- sh -*-------------------------------------
 # =========                 |
 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
 #  \\    /   O peration     |
 #   \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
 #    \\/     M anipulation  |
-#-------------------------------------------------------------------------------
+#------------------------------------------------------------------------------
 # License
 #     This file is part of OpenFOAM.
 #
@@ -23,7 +23,7 @@
 #     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
 #
 # Script
-#     foamPackThirdPartyGeneral [outputDir]
+#     foamPackThirdParty [outputDir]
 #
 # Description
 #     Packs and compresses the OpenFOAM ThirdParty directory for release
@@ -33,7 +33,7 @@
 timeStamp=$(date +%Y-%m-%d)
 packDir=${WM_THIRD_PARTY_DIR:-ThirdParty}
 packDir=${packDir##*/}
-packFile=${packDir}.General_${timeStamp}.gtgz
+packFile=${packDir}_${timeStamp}.gtgz
 
 if [ ! -d $packDir ]
 then
diff --git a/bin/foamSourceFiles b/bin/foamSourceFiles
new file mode 100755
index 0000000000000000000000000000000000000000..f20e7927ce754504ddd95610c269e6dee0d3b979
--- /dev/null
+++ b/bin/foamSourceFiles
@@ -0,0 +1,81 @@
+#!/bin/sh
+#---------------------------------*- sh -*-------------------------------------
+# =========                 |
+# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+#  \\    /   O peration     |
+#   \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
+#    \\/     M anipulation  |
+#------------------------------------------------------------------------------
+# License
+#     This file is part of OpenFOAM.
+#
+#     OpenFOAM is free software: you can redistribute it and/or modify it
+#     under the terms of the GNU General Public License as published by
+#     the Free Software Foundation, either version 3 of the License, or
+#     (at your option) any later version.
+#
+#     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+#     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+#     for more details.
+#
+#     You should have received a copy of the GNU General Public License
+#     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Script
+#     foamSourceFiles <directory>
+#
+# Description
+#     Returns all the .C and .H files and Make/options
+#     and Make/files in a given directory.
+#
+#------------------------------------------------------------------------------
+
+if [ $# -ne 1 ]
+then
+    echo "Usage : ${0##*/} directory"
+    echo ""
+    echo "Returns all .C and .H files and Make/options and Make/files."
+    echo ""
+    exit 1
+fi
+
+# canonical form (no double and no trailing dashes)
+packDir=$(echo "$1" | sed -e 's@//*@/@g' -e 's@/$@@')
+
+if [ ! -d $packDir ]
+then
+    echo "Error: directory $packDir does not exist"
+    exit 1
+fi
+
+find -H $packDir               \
+    ! -type d                  \
+   \( -type f -o -type l \)    \
+    ! -name "*~"               \
+ -a ! -name ".*~"              \
+ -a ! -name "*.orig"           \
+ -a ! -name "*.dep"            \
+ -a ! -name "*.o"              \
+ -a ! -name "*.so"             \
+ -a ! -name "*.a"              \
+ -a ! -name "*.tgz"            \
+ -a ! -name "core"             \
+ -a ! -name "core.[1-9]*"      \
+ -a ! -name "libccmio*"        \
+| sed                          \
+ -e "\@$packDir/lib/@d"        \
+ -e '\@/\.git/@d'              \
+ -e '\@/\.gitignore@d'         \
+ -e '\@/\.tags/@d'             \
+ -e '\@/\README\.org@d'        \
+ -e '\@applications/bin/@d'    \
+ -e '\@wmake/bin/@d'           \
+ -e '\@/t/@d'                  \
+ -e '\@/Make[.A-Za-z]*/[^/]*/@d'\
+ -e '\@/platforms/@d'          \
+ -e '\@/download/@d'           \
+ -e '\@/libccmio-.*/@d'        \
+ -e '\@/debian/@d'
+
+#------------------------------------------------------------------------------
diff --git a/bin/mpigammarun b/bin/mpigammarun
deleted file mode 100755
index fa789ddf5537701225c22312256195c633b9e4fc..0000000000000000000000000000000000000000
--- a/bin/mpigammarun
+++ /dev/null
@@ -1,288 +0,0 @@
-#! /bin/sh
-#
-# Giuseppe Ciaccio 15 November 2000
-# This script is derived from the mpirun.args original script of MPICH .
-#
-hasprinthelp=1
-progname=
-cmdLineArgs=
-machineFile=
-machineFileArg=
-fake_progname=
-np=1
-mpirun_verbose=0
-just_testing=0
-machineFileArg=
-machineFile=
-Show=eval
-#
-PrintHelp() {
-#
-# If you change this, make the corresponding changes in README so that
-# the man pages are updated.
-#
-cat <<EOF
-mpirun [mpirun_options...] <progname> [options...]
-
-  mpirun_options:
-    -h      This help
-    -machinefile <machine-file name>
-	    The file is a list of machines to be involved in the job run.
-	    Local machine is always involved (and hosts instance #0).
-            Default machine file is /etc/gamma.conf
-    -np <np>
-            specify the number of process instances to be generated.
-    -t      Testing - do not actually run, just print what would be
-            executed
-    -v      Verbose - throw in some comments
-
-Multiple architectures as well as multiple pathnames for the executables
-cannot be handled yet.
-
-EOF
-}
-
-while [ 1 -le $# ] ; do
-  arg=$1
-  #echo $arg
-  #echo $#
-  shift
-  case $arg in 
-     -arch) 
-	shift
-	;;
-    -np)
-	np="$1"
-        nodigits=`echo $np | sed 's/^[0-9]*$//'`
-        if [ "$nodigits" != "" -o $np -lt 1 ] ; then
-           echo np: $np is an invalid number of processors.  Exiting.
-           exit 1
-	fi
-	shift
-	;;
-    -machine)
-	shift
-	;;
-    -machinefile)
-        machineFileArg="-machinefile"
-        machineFile="$1"
-	shift
-	;;
-    -device)
-	shift
-	;;
-    -stdin)
-	shift
-	;;
-    -stdout)
-        shift
-        ;;
-    -stderr)
-        shift
-        ;;
-    -nolocal)
-	;;	
-    -h)
-	if [ "$hasprinthelp" = 1 ] ; then
-	   PrintHelp
-        fi
-      	exit 1
-	;;	
-    -e)
-	;;
-    -pg)
-      	;;
-    -leave_pg|-keep_pg)
-	;;
-    -batch)
-        ;;
-    -jid)
-        shift
-        ;;
-    -globusrsl)
-	shift
-	;;
-    -globusdb)
-	shift
-	;;
-    -globusargs)
-	shift
-	;;
-    -p4pg)
-	shift
-	;;
-    -p4wd)
-	shift
-	;;
-    -tcppg)
-	shift
-	;;
-    -p4ssport)
-	shift
-	;;
-    -paragontype)
-	shift
-	;;
-    -paragonname)
-	shift
-	;;
-    -paragonpn)
-	shift
-	;;
-    -v)
-       	mpirun_verbose=1
-	;;
-    -t)
-      	just_testing=1
-	Show=echo
-	;;
-    -tv|-totalview)
-	;;
-    -ksq)
-        ;;
-    -dbx)
-      	;;
-    -gdb)
-	;;
-    -xxgdb)
-	;;
-    -ddd)
-	;;
-    -pedb)
-	;;
-    -nopoll)
-	;;
-    -maxtime|-cpu)
-	shift
-	;;
-    -mem)
-	shift
-	;;
-    -mvhome)
-	;;
-    -mvback)
-	shift
-	;;
-    -cac)
-	shift
-	;;
-    -echo)
-	;;
-    -usage|-help|-\?)
-      	# Accept these for help until the program name is provided.
-      	if [ "$progname" = "" ] ; then
-	   if [ "$hasprinthelp" = "1" ] ; then
-	      PrintHelp
-           fi
-	   exit 1
-      	fi
-	;;
-    *)
-	# The first unrecognized argument is assumed to be the name of
-      	# the program, but only if it is executable
-	proginstance=`echo $arg | sed "s/%a/$arch/g"`
-      	if [ "$progname" = "" -a "$fake_progname" = "" -a \
-		! -x "$proginstance" ] ; then
-	    fake_progname="$arg"
-      	elif [ "$progname" = "" -a -x "$proginstance" ] ; then 
-	    progname="$arg"
-            # any following unrecognized arguments are assumed to be arguments
-            # to be passed to the program, as well as all future args
-	    while [ 1 -le $# ] ; do
-               cmdLineArgs="$cmdLineArgs $1"
-	       shift
-            done
-         else
-	    echo "Warning: Command line arguments for program should be given"
-            echo "after the program name.  Assuming that $arg is a"
-            echo "command line argument for the program."
-            cmdLineArgsExecer="$cmdLineArgsExecer -arg=$arg"
-            cmdLineArgs="$cmdLineArgs $arg"
-         fi
-      ;;
-  esac
-done
-
-# We need at least the program name
-
-if [ "$progname" = "" ] ; then
-  echo "Missing: program name"
-  if [ "$fake_progname" != "" ] ; then
-      echo "Program $fake_progname either does not exist, is not "
-      echo "executable, or is an erroneous argument to mpirun."
-  fi
-  exit 1
-fi
-#
-# Fill out relative program pathnames
-#
-# Get the current directory
-# Note that PWD may NOT be `pwd` if an explicit "cd", outside of the csh
-# shell, is used.  A downside of this is that PWD may have a more reasonable
-# version of the path.  To try and fix this, we create a test file and see
-# if it is accessible from PWD and pwd; if so, we take the PWD value
-# 
-# Why can't automounters work!???!!
-#
-# For those unfamiliar with the problem, the automounter creates
-# paths like /tmp_mnt/.... .  But if you try to open a file with that path, 
-# and the ACTUAL path has not been accessed before, the automounter fails
-# to mount the partition.  In otherwords, the automounter is so mind-bogglingly
-# stupid as to not recognize its OWN MOUNTS.  Network computing indeed.
-#
-# Note that PWD may ALSO be damaged, so we need to sed PWD as well...
-#
-# We should move this to the point in the code where it needs to know a
-# particular filename, since this will fail if the directory is not
-# writable by the user.
-# 
-if [ -n "sed -e s@/tmp_mnt/@/@g" ] ; then
-    PWDtest=`pwd | sed -e s@/tmp_mnt/@/@g`
-    if [ ! -d $PWDtest ] ; then
-        PWDtest=`pwd`
-    fi
-    if [ -n "$PWD" ] ; then
-	# Use a process-specific filename
-	PWDtest2=`echo $PWD | sed -e s@/tmp_mnt/@/@g`
-        /bin/rm -f $PWDtest/.mpirtmp$$ $PWDtest2/.mpirtmp$$
-        if `eval "echo test > $PWDtest2/.mpirtmp$$" 2>/dev/null` ; then
-            if [ ! -s $PWDtest/.mpirtmp$$ ] ; then
-	        /bin/rm -f $PWDtest2/.mpirtmp$$
-                PWD=$PWDtest
-	    else
-		PWD=$PWDtest2
-	    fi
-	else
-	    # Current directory is not writable.  Hope for the best
-            PWD=$PWDtest        
-        fi
-        /bin/rm -f $PWDtest/.mpirtmp$$ $PWDtest2/.mpirtmp$$
-    else 
-        PWD=$PWDtest
-    fi
-else
-    PWD=`pwd`
-fi
-#
-if [ -n "$PWD" ] ; then
-    PWD_TRIAL=$PWD
-else
-    PWD_TRIAL=$PWDtest
-fi
-# The test for PWD_TRIAL usable is within the p4/execer/tcp test (since that
-# is where it matters)
-#
-tail=`echo $progname | sed 's/\/.*//'` 
-if  [ "$tail" = "" ] ; then
-  #echo Absolute path, don't need to change anything
-  true
-else
-  #echo Relative path
-  progname="$PWD_TRIAL/$progname"
-fi
-
-if [ $mpirun_verbose = 1 ] ; then
-  echo "running $progname on $np $arch $machine processors"
-fi
-
-$Show $progname $cmdLineArgs $machineFileArg $machineFile -GAMMANP $np
diff --git a/bin/tools/foamConfigurePaths b/bin/tools/foamConfigurePaths
new file mode 100755
index 0000000000000000000000000000000000000000..5bd2494b81acc748f2b8f5a799145a50bbb87fa3
--- /dev/null
+++ b/bin/tools/foamConfigurePaths
@@ -0,0 +1,108 @@
+#!/bin/sh
+#---------------------------------*- sh -*-------------------------------------
+# =========                 |
+# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+#  \\    /   O peration     |
+#   \\  /    A nd           | Copyright (C) 1991-2010 OpenCFD Ltd.
+#    \\/     M anipulation  |
+#------------------------------------------------------------------------------
+# License
+#     This file is part of OpenFOAM.
+#
+#     OpenFOAM is free software: you can redistribute it and/or modify it
+#     under the terms of the GNU General Public License as published by
+#     the Free Software Foundation, either version 3 of the License, or
+#     (at your option) any later version.
+#
+#     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+#     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+#     for more details.
+#
+#     You should have received a copy of the GNU General Public License
+#     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+#
+# Script
+#     foamConfigurePaths
+#
+# Description
+#     hardcode installation directory
+#
+#------------------------------------------------------------------------------
+usage() {
+    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
+    cat<<USAGE
+
+usage: ${0##*/}
+  --foamInstall dir   		specify installation directory (e.g. /opt)
+  --projectName name 		specify project name (e.g. openfoam170)
+  --archOption  arch		specify architecture option (only 32 or 64 applicable)
+  --paraviewInstall dir 	specify ParaView_DIR (e.g. /opt/paraviewopenfoam380)
+
+* hardcode paths to installation
+
+USAGE
+    exit 1
+}
+
+
+[ -f etc/bashrc -a -f etc/settings.sh ] || usage "Please run from top-level directory of installation"
+
+unset foamInstall projectName archOption paraviewInstall
+
+# parse options
+while [ "$#" -gt 0 ]
+do
+    case "$1" in
+    -h | --help)
+        usage
+        ;;
+    --foamInstall)
+        [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
+	foamInstall="$2"
+	echo "Replacing foamInstall setting by $foamInstall"
+	sed -i -e '/^[^#]/s@foamInstall=.*@foamInstall='"$foamInstall@" etc/bashrc
+        shift 2
+        ;;
+   --projectName)
+       	[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
+	projectName="$2"
+	echo "Replacing WM_PROJECT_DIR setting by $projectName"
+	sed -i -e '/^[^#]/s@WM_PROJECT_DIR=.*@WM_PROJECT_DIR=$WM_PROJECT_INST_DIR/'"$projectName@" etc/bashrc
+       	shift 2
+       	;;
+    --archOption)
+        [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
+	archOption="$2"
+	echo "Replacing WM_ARCH_OPTION setting by $archOption"
+	sed -i -e '/^[^#]/s@: ${WM_ARCH_OPTION:=64}@WM_ARCH_OPTION='"$archOption@" etc/bashrc
+        shift 2
+        ;;
+    --paraviewInstall)
+        [ "$#" -ge 2 ] || usage "'$1' option requires an argument"
+	paraviewInstall="$2"
+	echo "Replacing ParaView_DIR setting by $paraviewInstall"
+	sed -i -e '/^[^#]/s@ParaView_DIR=.*@ParaView_DIR='"$paraviewInstall@" etc/apps/paraview3/bashrc
+        shift 2
+        ;;
+    *)
+        usage "unknown option/argument: '$*'"
+        ;;
+    esac
+done
+
+[ -n "$foamInstall" -o -n "$projectName" -o -n "$archOption"  -o -n "$paraviewInstall" ] || usage "Please specify at least one configure option"
+
+#echo "Replacing WM_PROJECT setting by $projectName"
+#sed -i -e 's@WM_PROJECT=.*@WM_PROJECT='"$projectName@" etc/bashrc
+
+# Replace the WM_MPLIB always
+echo "Replacing WM_MPLIB setting by SYSTEMOPENMPI"
+sed -i -e '/^[^#]/s@: ${WM_MPLIB:=.*}@WM_MPLIB=SYSTEMOPENMPI@' etc/bashrc
+# Replace the compilerInstall always
+echo "Replacing compilerInstall setting by system"
+sed -i -e '/^[^#]/s@: ${compilerInstall:=.*}@compilerInstall=system@' etc/settings.sh
+
+
+
+#------------------------------------------------------------------------------
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000000000000000000000000000000000000..37d8825189adba068bfba981a174615e434ea0c0
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+openfoamdev (0-1) unstable; urgency=low
+
+  * Initial release
+
+ -- OpenCFD Ltd. <patches@opencfd.co.uk>  Mon, 14 Jun 2010 16:50:46 +0100
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000000000000000000000000000000000000..7f8f011eb73d6043d2e6db9d2c101195ae2801f2
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+7
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000000000000000000000000000000000000..7f1ffece57936c5dd8dd9bb99dd353d42b061239
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,19 @@
+Source: openfoamdev
+Section: optional
+Priority: optional
+Maintainer: OpenCFD Ltd. <patches@opencfd.co.uk>
+Build-Depends: debhelper (>= 7), quilt
+Standards-Version: 3.8.4
+Homepage: http://www.openfoam.com
+
+Package: openfoamdev
+Architecture: any
+Depends: csh,g++,${shlibs:Depends}, ${misc:Depends},binutils-dev,flex,libscotch-dev,libopenmpi-dev,libxt-dev,openmpi-bin
+Description: OpenFOAM
+ OpenFOAM is a free, open source CFD software package produced by a
+ commercial  company, OpenCFD Ltd. It has a large user base across
+ most areas of engineering and science, from both commercial and academic
+ organisations. OpenFOAM has an extensive range of features to solve
+ anything from complex fluid flows involving chemical reactions, turbulence
+ and heat transfer, to solid dynamics and electromagnetics.
+
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000000000000000000000000000000000000..2106c078bd761f03f3f0f6c18e4196751e6133bd
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,30 @@
+This work was packaged for Debian by:
+
+    OpenCFD Ltd. <patches@opencfd.co.uk> on Mon, 14 Jun 2010 16:50:46 +0100
+
+Copyright:
+
+    Copyright (C) 1991-2010 OpenCFD Ltd.
+
+License:
+
+    This file is part of OpenFOAM.
+
+    OpenFOAM is free software: you can redistribute it and/or modify it
+    under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
+    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+    for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
+
+The Debian packaging is:
+
+    Copyright (C) 2010 OpenCFD Ltd. <patches@opencfd.co.uk>
+
+    and is licensed under the GPL version 3 
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/debian/postinst b/debian/postinst
new file mode 100755
index 0000000000000000000000000000000000000000..e28adbc93fea3ca06e1d52c48ae4e5d128b2cfee
--- /dev/null
+++ b/debian/postinst
@@ -0,0 +1,48 @@
+#!/bin/sh
+# postinst script for OpenFOAM
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+    configure)
+       #echo "** postinst called with $*"
+       echo ""
+       echo "** To use OpenFOAM please add"
+       echo "**"
+       echo "**    . /opt/openfoamdev/etc/bashrc"
+       echo "**"
+       echo "** To your ~/.bashrc"
+       echo ""
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
+
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000000000000000000000000000000000000..ce5f53f5c081cd892d1470bd05348146dfcefced
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,109 @@
+#!/usr/bin/make -f
+#-*- makefile -*-
+# After debian/rules from less package
+
+include /usr/share/quilt/quilt.make
+
+# Uncomment this to turn on verbose mode.
+export DH_VERBOSE=1
+
+# This is the debhelper compatibility version to use.
+
+#DEB_BUILD_GNU_TYPE	= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+#DEB_HOST_GNU_TYPE	= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+#ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+#CONFARGS= --host=$(DEB_HOST_GNU_TYPE)
+#endif
+#
+#CFLAGS = -Wall -g #-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+#
+#ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+#CFLAGS += -O0
+#else
+#CFLAGS += -O2
+#endif
+
+DEB_BUILD_ARCH_BITS	= $(shell dpkg-architecture -qDEB_BUILD_ARCH_BITS)
+foamArch=
+ifeq ($(DEB_BUILD_ARCH_BITS),64)
+foamArch=linux64GccDPOpt
+else
+foamArch=linuxGccDPOpt
+endif
+
+packageName		= $(shell dh_listpackages)
+installDir		= debian/$(packageName)/opt/$(packageName)
+paraviewInstallDir	= /opt/paraviewopenfoam380
+
+DEB_DH_SHLIBDEPS_ARGS=-L$(installDir)/lib/$(foamArch)
+
+build: patch build-stamp
+build-stamp:
+	dh_testdir
+
+	# Add here commands to compile the package.
+	#./Allwmake
+
+	touch build-stamp
+
+clean: unpatch
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp
+
+	# Add here commands to clean up after the build process.
+	#./Allwclean
+	#set
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_prep
+	dh_installdirs
+
+	# Install source files into debian/.
+	install -d $(installDir)
+	tar cf - `bin/foamSourceFiles .` | (cd $(installDir); tar xfp -)
+	(cd $(installDir); bin/tools/foamConfigurePaths --foamInstall /opt  --projectName $(packageName) --paraviewInstall $(paraviewInstallDir) )
+
+	# Install binary files into debian/.
+	tar cf - `bin/foamBinDirs . $(foamArch)` | (cd $(installDir); tar xfp -)
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installdebconf
+	dh_installdocs
+	dh_installexamples
+	dh_installmenu
+#	dh_installemacsen
+#	dh_installinit
+	dh_installmime
+	dh_installcron
+	#dh_installman debian/lesspipe.1
+	#dh_undocumented
+	dh_installchangelogs
+	#dh_link
+	#dh_strip
+	dh_compress
+	dh_fixperms
+	dh_makeshlibs
+	dh_installdeb
+#	dh_perl 
+	dh_shlibdeps -- --ignore-missing-info	#We depend on vtk libs without info
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+source diff:                                                                  
+	@echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary