New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
install_new_branch.sh in branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST – NEMO

source: branches/2015/dev_r5092_CNRS18_TRUST/NEMOGCM/TRUST/install_new_branch.sh @ 5799

Last change on this file since 5799 was 5799, checked in by nicolasmartin, 9 years ago

dev_r5092_CNRS18_TRUST Establishing common environment for installing & running trusting, consolidation of scripts & continuation of templates & help section improvments

  • Property svn:executable set to *
File size: 2.9 KB
Line 
1#!/bin/bash
2
3
4cd $( dirname $0 )
5
6## Set defaults
7##---------------------------------------------------
8TRUS_DIRE=$PWD
9TRUS_DBUG=0; TRUS_PROD=0; TRUS_HELP=0
10
11
12## Get options (for replacing initials settings)
13##---------------------------------------------------
14while [ $# -ne 0 ]; do
15    case $1 in
16   '-d'|'--debug'  ) TRUS_DBUG=1 ; shift  ;; '-j'|'--job'     ) TRUS_NPRO=$2; shift 2;;
17   '-m'|'--machine') TRUS_HPCC=$2; shift 2;; '-h'|'--help'    ) TRUS_HELP=1 ; shift  ;;
18   '-u'|'--user'   ) TRUS_USER=$2; shift 2;; '-w'|'--workdir') TRUS_WORK=$2; shift 2;;
19   "*"             ) TRUS_HELP=1 ; shift  ;;
20    esac
21done
22
23
24## Initialization (HPC & user environment)
25##---------------------------------------------------
26if [[ ! -e config/${TRUS_USER}.cfg || ! -e config/${TRUS_HPCC}.cfg || ${TRUS_HELP} -eq 1 ]]; then
27    cat trusting_help.txt
28
29    if [ ${TRUS_HELP} -eq 0 ]; then
30   printf "\n\n\033[0;33m"
31   printf "At least one configuration (arch or user) file is missing or misspelled:"
32   printf "\t'%s'.cfg\t'%s'.cfg" ${TRUS_USER} ${TRUS_HPCC}
33   printf "\033[0m"
34    fi
35
36    printf "\n\nContent of 'config' folder:\n"
37    find config -name *.cfg | cut -d/ -f2 \
38   | xargs -n 4 printf "\t- %-25s\t- %-25s\t- %-25s\t- %-25s\n"
39    exit 1
40else
41    . trusting.env
42    [ ${TRUS_DBUG} -eq 1 ] && set -vx
43fi
44
45
46## List last branches from NEMO Forge
47##---------------------------------------------------
48printf "\nWhat branch do you want to install in "${TRUS_WORK}" for trusting test ? "
49echo 'Enter 0 to abort'
50select branch in 'trunk' $( svn ls ${TRUS_SVNH}/branches/2015 | tr -d / | sort -r ); do
51
52    if [ $REPLY -eq 0 ]; then exit 1; else export TRUS_BRAN=$branch; fi
53
54    printf "\nInstallation of a working copy of '%s' branch in '%s'? " ${TRUS_BRAN} ${TRUS_WORK}
55    echo 'Type [Y|y|yes] to confirm, if not back to branches list number'
56    read answer
57    [[ $answer == 'Y' || $answer == 'y' || $answer == 'yes' ]] && break
58
59done
60
61echo
62
63
64## First checkout of selected branch
65##---------------------------------------------------
66echo 'Initial checkout of '${TRUS_BRAN}' branch'
67mkdir -p ${TRUS_WORK}/${TRUS_BRAN}/NEMOGCM
68cd       ${TRUS_WORK}/${TRUS_BRAN}/NEMOGCM
69
70svn_bran=branches/2015/${TRUS_BRAN}
71[ ${TRUS_BRAN} == 'trunk' ] && svn_bran=${TRUS_BRAN}
72
73for elmt in ${TRUS_CKOT}; do
74    printf "%s " $elmt
75
76    if [ $elmt == 'TOOLS/maketools' ]; then
77   svn co -q ${TRUS_SVNH}/${svn_bran}/NEMOGCM/TOOLS --depth empty
78   svn up -q $elmt
79    else
80   svn co -q ${TRUS_SVNH}/${svn_bran}/NEMOGCM/$elmt $elmt
81    fi
82
83done
84
85printf "\n\n"
86
87
88## Compile rebuild_nemo.exe in anticipation
89##---------------------------------------------------
90if [ $( find ARCH -name arch-${TRUS_HPCC}.fcm ) ]; then
91    echo 'Compile NEMO rebuild tool'
92    cd TOOLS && ./maketools -n REBUILD_NEMO -m ${TRUS_HPCC} -j ${TRUS_NPRO} > /dev/null
93    [ $? -eq 0 ] && printf "\033[0;32mOK\033[0m" || printf "\033[0;31mKO\033[0m"
94    printf "\n\n"
95else
96    printf "\033[0;31mNo arch file found to compile NEMO rebuild tool\033[0m\n\n"
97fi
98
99exit 0
100
Note: See TracBrowser for help on using the repository browser.