diff --git a/makenemo b/makenemo index 0ae6d05904e644f40ed99c4134213e09c3b4645c..5d03dcc173bf75e896bb8794df6356b5eb0492f2 100755 --- a/makenemo +++ b/makenemo @@ -349,8 +349,8 @@ if [ ${TML_CONF} != ${NEW_CONF} ]; then printf "\nYou are installing a new configuration %s from %s " ${NEW_CONF} ${TML_CONF} if [ -n "${NEM_SUBDIR}" ]; then printf "with sub-components: %s\n" "${NEM_SUBDIR}"; fi echo - ${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${CONFIG_DIR}/${TML_CONF} fi +${COMPIL_DIR}/Fmake_config.sh ${NEMO_TDIR}/${NEW_CONF} ${CONFIG_DIR}/${TML_CONF} # must be called for existing config to create EXP00 if not existing ## Save new configuration with sub-components set in work_cfgs.txt [ -f ${CONFIG_DIR}/work_cfgs.txt ] && sed -i "/^${NEW_CONF} /d" ${CONFIG_DIR}/work_cfgs.txt diff --git a/mk/Fmake_config.sh b/mk/Fmake_config.sh index 04df7d09e223271468312375b654ba83d7c58c82..22955c4d0b125339e889781978c961b28453b9c2 100755 --- a/mk/Fmake_config.sh +++ b/mk/Fmake_config.sh @@ -25,12 +25,10 @@ set -o posix # =========== # # -# - Make the config directory -# - Create repositories needed : -# -# - EXP00 for namelist -# - MY_SRC for user sources -# - BLD for compilation +# - Make the config directory if needed +# - Create repositories if needed : +# - EXP00 for namelist, xml and AGRIF_FixedGrids.in +# - MY_SRC for user sources # # EXAMPLES # ======== @@ -56,12 +54,33 @@ set -o posix # * creation # #- -\mkdir -p ${1} -\mkdir -p ${1}/EXP00 -\mkdir -p ${1}/MY_SRC -[ "${2}/cpp_${2##*/}.fcm" != "${1}/cpp_${1##*/}.fcm" ] && \cp -R -n ${2}/cpp_${2##*/}.fcm ${1}/cpp_${1##*/}.fcm -for f in ${2}/EXPREF/*.xml ${2}/EXPREF/*namelist*; do - if [[ -L ${f} && $(readlink -f ${f}) =~ "SHARED" ]]; then ln -sf $(readlink -f ${f}) ${1}/EXP00/$(basename ${f}); else cp -R -n ${f} ${1}/EXP00/.; fi -done -[ -f ${2}/EXPREF/AGRIF_FixedGrids.in ] && \cp -a -n ${2}/EXPREF/AGRIF_FixedGrids.in ${1}/EXP00/. -[ -d ${2}/MY_SRC ] && \cp -an ${2}/MY_SRC/* ${1}/MY_SRC/. 2> /dev/null +[ ! -d ${1} ] && \mkdir -p ${1} +[ "${2}" != "${1}" ] && \cp -n ${2}/cpp_${2##*/}.fcm ${1}/cpp_${1##*/}.fcm +# +if [ ! -d ${1}/EXP00 ] +then + echo " Creating ${1}/EXP00" + \mkdir -p ${1}/EXP00 + echo " -> Copying existing xml, namelist and AGRIF_FixedGrids.in files from ${2}/EXPREF to ${1}/EXP00" + for f in $( ls -1 ${2}/EXPREF/*.xml ${2}/EXPREF/*namelist* ${2}/EXPREF/AGRIF_FixedGrids.in 2>/dev/null ) + do + if [[ -L ${f} && $( readlink -f ${f} ) =~ "SHARED" ]] + then + \ln -sf $( readlink -f ${f} ) ${1}/EXP00/$( basename ${f} ) # keep link from SHARED + else + \cp ${f} ${1}/EXP00/. + fi + done +fi +# +if [ ! -d ${1}/MY_SRC ] +then + if [ -d ${2}/MY_SRC ] + then + echo " Copying ${2}/MY_SRC to ${1}/MY_SRC" + \cp -a ${2}/MY_SRC ${1}/MY_SRC 2> /dev/null + else + echo " Creating ${1}/MY_SRC" + \mkdir -p ${1}/MY_SRC # create an empty directory + fi +fi