| 1 | #!/bin/bash |
| 2 | |
| 3 | usage(){ |
| 4 | echo " |
| 5 | bbmerge-auto.sh is a wrapper for BBMerge that attempts to use all available |
| 6 | memory, instead of a fixed amount. This is for use with the Tadpole options |
| 7 | of error-correction (ecct) and extension, which require more memory. |
| 8 | For merging by overlap only, please use bbmerge.sh. If you set memory |
| 9 | manually with the -Xmx flag, bbmerge.sh and bbmerge-auto.sh are equivalent. |
| 10 | |
| 11 | For information about usage and parameters, please run bbmerge.sh. |
| 12 | " |
| 13 | } |
| 14 | |
| 15 | #This block allows symlinked shellscripts to correctly set classpath. |
| 16 | pushd . > /dev/null |
| 17 | DIR="${BASH_SOURCE[0]}" |
| 18 | while [ -h "$DIR" ]; do |
| 19 | cd "$(dirname "$DIR")" |
| 20 | DIR="$(readlink "$(basename "$DIR")")" |
| 21 | done |
| 22 | cd "$(dirname "$DIR")" |
| 23 | DIR="$(pwd)/" |
| 24 | popd > /dev/null |
| 25 | |
| 26 | #DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/" |
| 27 | CP="$DIR""current/" |
| 28 | JNI="-Djava.library.path=""$DIR""jni/" |
| 29 | JNI="" |
| 30 | |
| 31 | z="-Xmx14g" |
| 32 | z2="-Xms14g" |
| 33 | set=0 |
| 34 | |
| 35 | if [ -z "$1" ] || [[ $1 == -h ]] || [[ $1 == --help ]]; then |
| 36 | usage |
| 37 | exit |
| 38 | fi |
| 39 | |
| 40 | calcXmx () { |
| 41 | source "$DIR""/calcmem.sh" |
| 42 | setEnvironment |
| 43 | parseXmx "$@" |
| 44 | if [[ $set == 1 ]]; then |
| 45 | return |
| 46 | fi |
| 47 | freeRam 15000m 84 |
| 48 | z="-Xmx${RAM}m" |
| 49 | z2="-Xms${RAM}m" |
| 50 | } |
| 51 | calcXmx "$@" |
| 52 | |
| 53 | function merge() { |
| 54 | local CMD="java $EA $EOOM $z $z2 $JNI -cp $CP jgi.BBMerge $@" |
| 55 | echo $CMD >&2 |
| 56 | eval $CMD |
| 57 | } |
| 58 | |
| 59 | merge "$@" |