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 @ 8859

Last change on this file since 8859 was 8834, checked in by nicolasmartin, 7 years ago

Cleaning of main script 'trusting.sh': transfer code lines to 'trusting_func.sh' with new functions, improve overall readability

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