forked from NOAA-EPIC/hpc-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_metplus.sh_5.0.2
executable file
·58 lines (47 loc) · 1.83 KB
/
build_metplus.sh_5.0.2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
set -eux
name="metplus"
version=${1:-${STACK_metplus_version}}
# Hyphenated version used for install prefix
compiler=$(echo $HPC_COMPILER | sed 's/\//-/g')
cd ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}
software="v"$version
pkg_name=METplus-$version
met_version=${1:-${STACK_met_version}}
URL="https://github.com/dtcenter/METplus/archive/$software.tar.gz"
[[ -d $software ]] || ( $WGET $URL; tar -xf $software.tar.gz )
[[ -d $pkg_name ]] && cd $pkg_name || ( echo "$pkg_name does not exist, ABORT!"; exit 1 )
if $MODULES; then
source $MODULESHOME/init/bash
module load hpc-$HPC_COMPILER
module try-load met
echo "Using module met version (none if blank) = ${MET_VERSION:-:}"
prefix="${PREFIX:-"/opt/modules"}/$compiler/$name/$version"
met_prefix=${MET_ROOT:-"${PREFIX:-"/opt/modules"}/$compiler"}
else
prefix=${MET_ROOT:-"/usr/local"}
met_prefix=$prefix
fi
if [[ -d $prefix ]]; then
if [[ $OVERWRITE =~ [yYtT] ]]; then
echo "WARNING: $prefix EXISTS: OVERWRITING!"
$SUDO rm -rf $prefix
else
echo "WARNING: $prefix EXISTS, SKIPPING"
exit 0
fi
fi
mkdir -p $prefix
# Install is simply copying over the unpacked package to the install location
cp -r ${HPC_STACK_ROOT}/${PKGDIR:-"pkg"}/${pkg_name}/* $prefix
cd $prefix
curr_dir=$(pwd)
# Update the path to the MET tools for the users
cd ${curr_dir}/parm/metplus_config
cat defaults.conf | \
sed "s%MET_INSTALL_DIR = /path/to%MET_INSTALL_DIR = $met_prefix/met/$met_version%g" \
> metplus_system_new.conf
mv metplus_system_new.conf metplus_system.conf
# generate modulefile from template
$MODULES && update_modules compiler $name $version
echo $name $version $URL >> ${HPC_STACK_ROOT}/hpc-stack-contents.log