source:
utils/build/mk/Fclean_config.sh
@
11985
Last change on this file since 11985 was 9651, checked in by nicolasmartin, 6 years ago | |
---|---|
|
|
File size: 1.8 KB |
Rev | Line | |
---|---|---|
[2301] | 1 | #!/bin/bash |
2 | ###################################################### | |
3 | # Author : Simona Flavoni for NEMO | |
4 | # Contact : sflod@locean-ipsl.upmc.fr | |
5 | # | |
[2359] | 6 | # Some functions called from makenemo |
[2301] | 7 | # Fclean_config : config removing |
8 | ###################################################### | |
9 | #set -x | |
10 | set -o posix | |
11 | #set -u | |
12 | #set -e | |
13 | #+ | |
14 | # | |
15 | # ================ | |
16 | # Fclean_config.sh | |
17 | # ================ | |
18 | # | |
[2520] | 19 | # ------------------------ |
[2301] | 20 | # Remove the configuration |
[2520] | 21 | # ------------------------ |
[2301] | 22 | # |
23 | # SYNOPSIS | |
24 | # ======== | |
25 | # | |
26 | # :: | |
27 | # | |
28 | # $ Fclean_config.sh CONFNAME | |
29 | # | |
30 | # | |
31 | # DESCRIPTION | |
32 | # =========== | |
33 | # | |
34 | # | |
35 | # Remove the configuration: | |
36 | # | |
[2520] | 37 | # - remove CONFIG_NAME/WORK |
38 | # - remove CONFIG_NAME/BLD | |
[9598] | 39 | # - remove CONFIG_NAME from TOOLS/mk/cfg.txt |
[2520] | 40 | # |
[2301] | 41 | # EXAMPLES |
42 | # ======== | |
43 | # | |
44 | # :: | |
45 | # | |
[2520] | 46 | # $ ./Fclean_config.sh ORCA2_LIM |
[2301] | 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 | #- | |
[9651] | 65 | |
66 | NEW_CONF=${x_n} | |
67 | ||
68 | if [ ${#NEW_CONF} -eq 0 ] ; then | |
69 | echo " " | |
70 | echo "No configuration specified, please use makenemo -n CONFIG clean_config " | |
71 | else | |
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 | ||
96 | fi | |
97 | ||
98 | unset -v answer |
Note: See TracBrowser
for help on using the repository browser.