source: CONFIG/UNIFORM/u1/propagate_master_config.ksh @ 1697

Last change on this file since 1697 was 1691, checked in by jgipsl, 12 years ago

Added some help for managing configurations in new structure.

  • diff_configurations.ksh

This script can be used to check if all files are the same in the different configurations. Syntax : ./diff_configurations.ksh

  • propagate_master_config.ksh

This script can be used to copy modifications done in one configuration to all other configurations. The files will be copied only if they exist in both configurations. Syntax : ./propagate_master_config config_to_copy

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#!/bin/ksh
2#
3# Use this script to propagated modifcations done to files in one configuration
4# into the all other configurations in the same directory. Files will be copied
5# only where they already exist.
6#
7# Syntax :
8# ./propagate_master_config MyConfig
9# Modifcations in MyConfig will be copied to the other configurations.
10
11# Josefine Ghattas IPSL
12
13if [ $# == 0 ] ; then
14    echo "You need to specify the configuration from which the modifications will be propagted"
15    echo "./propagate_master_config MyConfig"
16    exit
17fi
18
19MasterConfig=$1
20verbose=yes
21BaseDir=`pwd`
22ConfigFamily=$(basename ${BaseDir}) 
23ConfigList=`ls |grep ${ConfigFamily} |grep -v out |grep -v $MasterConfig`
24
25echo All modifications in configuration $MasterConfig will copied to the other configurations $ConfigList
26
27cd $BaseDir/$MasterConfig
28FileList=`ls -d GENERAL/DRIVER/* GENERAL/PARAM/* GENERAL/POST/* USER_SPEC/*/*/* USER_SPEC/*/*/*/*`
29
30cpfile=$BaseDir/cpfile
31
32echo "" > $cpfile
33cd $BaseDir
34for conf in $ConfigList ; do
35    for file in $FileList ; do
36        if [ -f ${conf}/${file} ] ; then
37            cmp -s ${MasterConfig}/${file}  ${conf}/${file}
38            if [ $? -ne 0 ] ; then
39            # Files are differents
40                echo "cp ${MasterConfig}/${file} ${conf}/${file}" >> $cpfile
41                if [ $verbose == yes ] ; then
42                    diff  --brief ${MasterConfig}/${file}  ${conf}/${file}
43                    diff  ${MasterConfig}/${file}  ${conf}/${file}
44                fi         
45            fi
46        fi
47    done
48echo "" >> $cpfile
49done
50
51# Test if there is nothing to copy
52grep cp $cpfile
53if [ $? -ne 0 ] ; then
54    echo "Noting to be done. All files are the same."
55    rm $cpfile
56    exit
57fi
58
59# List files to copy and ask for permission to copy
60echo ""
61cat $cpfile
62
63echo "Would you like to do the actions listed above, answer yes/no ?"
64echo -n " Your answer : "
65read answer
66
67case ${answer} in
68yes|y)
69chmod +x $cpfile
70$cpfile
71echo "Copy has now been done."
72;;
73no|n)
74echo "Nothing will be done"
75;;
76*)
77echo "Bad answer. Nothing will be dnoe"
78;;
79esac
80rm $cpfile
81
82exit
Note: See TracBrowser for help on using the repository browser.