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.
Fclean_config.sh in utils/build/mk – NEMO

source: utils/build/mk/Fclean_config.sh @ 9651

Last change on this file since 9651 was 9651, checked in by nicolasmartin, 6 years ago

Reorganisation plan for NEMO repository: add missing modifications from previous commit

  • Property svn:executable set to *
File size: 1.8 KB
Line 
1#!/bin/bash
2######################################################
3# Author : Simona Flavoni for NEMO
4# Contact : sflod@locean-ipsl.upmc.fr
5#
6# Some functions called from makenemo
7# Fclean_config   : config removing
8######################################################
9#set -x
10set -o posix
11#set -u
12#set -e
13#+
14#
15# ================
16# Fclean_config.sh
17# ================
18#
19# ------------------------
20# Remove the configuration
21# ------------------------
22#
23# SYNOPSIS
24# ========
25#
26# ::
27#
28#  $ Fclean_config.sh CONFNAME
29#
30#
31# DESCRIPTION
32# ===========
33#
34#
35# Remove the configuration:
36#
37# - remove CONFIG_NAME/WORK
38# - remove CONFIG_NAME/BLD
39# - remove CONFIG_NAME from TOOLS/mk/cfg.txt
40#
41# EXAMPLES
42# ========
43#
44# ::
45#
46#  $ ./Fclean_config.sh ORCA2_LIM
47#
48#
49# TODO
50# ====
51#
52# option debug
53#
54#
55# EVOLUTIONS
56# ==========
57#
58# $Id: Fclean_config.sh 2158 2010-10-20 17:30:03Z sflod $
59#
60#
61#
62#   * creation
63#
64#-
65
66NEW_CONF=${x_n}
67
68if [ ${#NEW_CONF} -eq 0 ] ; then
69   echo " "
70   echo "No configuration specified, please use makenemo -n CONFIG clean_config "
71else
72   echo "Are you sure that you want to remove this directory $NEW_CONF? [y/n] "
73   read answer
74   answer=`echo $answer | sed 's/^[y].*$/y/'`
75
76   if [  -z "$answer" -o "x$answer" = "xy" ]; then
77
78      ## testing if configuration exists
79      if [[ ! $( grep "${NEW_CONF} " */work_cfgs.txt ) ]] ; then
80         echo "The configuration ${NEW_CONF} does not exist in file work_cfgs.txt"     
81         echo "No removing configuration"
82         echo " "
83      else
84         CONFIG_DIR=${MAIN_DIR}/$( grep -l "${NEW_CONF} " */work_cfgs.txt | cut -d/ -f1 )
85         rm -rf ${CONFIG_DIR}/${NEW_CONF}
86         sed -e "/${NEW_CONF} /d"  ${CONFIG_DIR}/work_cfgs.txt >  ${CONFIG_DIR}/work_cfgs.tmp
87         mv  ${CONFIG_DIR}/work_cfgs.tmp  ${CONFIG_DIR}/work_cfgs.txt
88         echo "${NEW_CONF} configuration REMOVED" 
89      fi
90
91   else
92      echo " "
93      echo "nothing to remove"
94   fi
95
96fi
97
98unset -v answer
Note: See TracBrowser for help on using the repository browser.