Вы находитесь на странице: 1из 19

#!

/bin/sh --login
# --------------------------------------------------------------------------# install_wwatch3 : install WAVEWATCH III in the present directory.
#
Working from tar files (and wwatch3_arc).
#
#
Hendrik L. Tolman
#
December 2006
#
February 2012
#
#
Copyright 2009-2012 National Weather Service (NWS),
#
National Oceanic and Atmospheric Administration. All rights
#
reserved. WAVEWATCH III is a trademark of the NWS.
#
No unauthorized use without permission.
#
# --------------------------------------------------------------------------# 1. Preparations
# --------------------------------------------------------------------------# 1.a Internal variables
aux=`\ls
ftn=`\ls
inp=`\ls
tst=`\ls
doc=`\ls

wwatch3.*.aux.tar`
wwatch3.*.ftn.tar`
wwatch3.*.inp.tar`
wwatch3.*.tst.tar`
wwatch3.*.doc.tar`

tmp='ww3_temp'
ww3_env='.wwatch3.env'

#
#
#
#
#

tar
tar
tar
tar
tar

file
file
file
file
file

with
with
with
with
with

auxiliaries
source code
input files
test programs
docblocks (NCEP only)

#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#

# temporary working directory


# setup file

# 1.b ID header - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - clear


echo ' '
echo '
echo '
echo '
echo ' '

*******************************'
*** Installing WAVEWATCH III ***'
*******************************'

# 1.c Test present directory - - - - - - - - - - - - - - - - - - - - - - - - main_dir=`pwd`


cd
home_dir=`pwd`
if [ -s $ww3_env ]
then
set `grep WWATCH3_DIR $ww3_env` ; shift ; main_dir="$*"
else
echo 'No install directory defined yet. The install directory has'
echo 'to be an existing directory containing the tar files.' ; echo ' '
main_dir=nodir.$$
until [ -d $main_dir ]
do
echo -n " Directory (relative to $home_dir) : "
read OK
if [ -n "$OK" ]
then
main_dir="$OK"
fi
done
cd $main_dir

main_dir=`pwd`
echo ' '
fi
echo "Installing in $main_dir"
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n " OK ? [y/n] "
read OK
done
if [ "$OK" = 'n' ] || [ "$OK" = 'N' ]
then
echo ' ' ; echo 'Change to correct directory '
echo ' ' ; echo ' *** INSTALL ABORTED *** ' ; echo ' ' ; exit
fi
cd $main_dir
# 1.d Set up environment - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' '
echo 'Setting up environment variables.'
if [ -f $home_dir/$ww3_env ]
then
echo " Setup file $ww3_env found in $home_dir"
set `grep WWATCH3_LPR $home_dir/$ww3_env` ; shift
prnt="$*"
echo "
Printer (listings)
: $prnt"
set `grep WWATCH3_F77 $home_dir/$ww3_env` ; shift
fort="$*"
echo "
FORTRAN comp. (aux only) : $fort"
set `grep WWATCH3_CC $home_dir/$ww3_env` ; shift
cc="$*"
echo "
C Compiler (aux only)
: $cc"
set `grep WWATCH3_TMP $home_dir/$ww3_env` ; shift
temp_dir="$*"
echo "
Scratch directory
: $temp_dir"
set `grep WWATCH3_SOURCE $home_dir/$ww3_env` ; shift
s_source="$*"
echo "
Save source code
: $s_source"
set `grep WWATCH3_LIST $home_dir/$ww3_env` ; shift
s_list="$*"
echo "
Save listings
: $s_list"
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n " Update settings ? [y/n] "

read OK
case $OK in
'y'|'Y') do_set='y' ;;
'n'|'N') do_set='n' ;;
esac
done
else
echo ' No setup file found.'
prnt=printer
fort=f77
cc=cc
temp_dir=
if [ -d /tmp ]
then
if [ -n "$user" ]
then
temp_dir=/tmp/$user
else
if [ -n "$USER" ]
then
temp_dir=/tmp/$USER
fi
fi
fi
s_source=no
s_list=no
do_set='y'
fi
if [ "$do_set" = 'y' ]
then
echo ' '
echo "Modifying set-up :"
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ]
do
echo ' '
echo -n "
Printer for listings [$prnt] : "
instr="$NULL" ; read instr
if [ -n "$instr" ]
then
prnt="$instr"
fi
echo -n "
Compiler for aux. [$fort] : "
instr="$NULL" ; read instr
if [ -n "$instr" ]
then
fort="$instr"
fi
echo -n "
Compiler for aux. [$cc] : "
instr="$NULL" ; read instr
if [ -n "$instr" ]
then
cc="$instr"
fi
OK="$NULL"

until [ "$OK" = 'y' ]


do
echo -n "
Scratch space [$temp_dir] : "
instr="$NULL" ; read instr
if [ -n "$instr" ]
then
temp_dir="$instr"
fi
if [ -n "$temp_dir" ]
then
if [ -d $temp_dir ]
then
OK='y'
else
if `mkdir $temp_dir` 2> /dev/null
then
OK='y'
fi
rmdir $temp_dir
fi
fi
done
echo -n "
Save source code files (*.f) [$s_source] : "
instr="$NULL" ; read instr
if [ -n "$instr" ]
then
if [ "$instr" = 'yes' ] || [ "$instr" = 'YES' ]
then
s_source='yes'
else
s_source='no'
fi
fi
echo -n "
Save listing files [$s_list] : "
instr="$NULL" ; read instr
if [ -n "$instr" ]
then
if [ "$instr" = 'yes' ] || [ "$instr" = 'YES' ]
then
s_list='yes'
else
s_list='no'
fi
fi
echo
echo
echo
echo
echo
echo
echo
echo
echo
read
done
fi
echo ' '

' '
" Modified set up :"
"
Printer (listings)
:
"
FORTRAN comp. (aux only) :
"
C Compiler (aux only)
:
"
Scratch directory
:
"
Save sources
:
"
Save listings
:
-n " New settings OK ? [y/n] "
OK

$prnt"
$fort"
$cc"
$temp_dir"
$s_source"
$s_list"

# 1.e Save environment in file - - - - - - - - - - - - - - - - - - - - - - - cd $home_dir


rm -f $ww3_env
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo
echo

'#'
'# Environment variables for wavewatch III'
'# ---------------------------------------'
'#'
' '
"WWATCH3_LPR
$prnt"
"WWATCH3_F77
$fort"
"WWATCH3_CC
$cc"
"WWATCH3_DIR
$main_dir"
"WWATCH3_TMP
$temp_dir"
"WWATCH3_SOURCE $s_source"
"WWATCH3_LIST
$s_list"
' '

>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>

$ww3_env
$ww3_env
$ww3_env
$ww3_env
$ww3_env
$ww3_env
$ww3_env
$ww3_env
$ww3_env
$ww3_env
$ww3_env
$ww3_env
$ww3_env

if [ ! -d $temp_dir ]
then
mkdir $temp_dir
fi
cd $temp_dir
rm -f * 2> /dev/null
cd $main_dir
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n 'Continue with actual implementation ? [y/n] '
read OK
done
if [ "$OK" = 'n' ] || [ "$OK" = 'N' ]
then
echo ' '
echo '
*******************************'
echo '
***
End of program
***'
echo '
*******************************'
echo ' '
exit
else
echo ' '
echo 'Starting actual implementation ...'
echo ' Use Ctrl-C to terminate program ...'
echo ' '
fi
# 1.f Test presence of files - - - - - - - - - - - - - - - - - - - - - - - - if [ -f "$aux" ]
then
echo "Auxiliary file $aux found ..."
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do

echo -n " (re)install compile and link system ? [y/n] "


read OK
case $OK in
'y'|'Y') do_aux='y' ;;
'n'|'N') do_aux='n' ;;
esac
done
else
echo "Auxiliary file $aux not found"
do_aux='n'
fi
if [ -f "$ftn" ]
then
echo "Source code file $ftn found ..."
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n " Update source code files ?
read OK
case $OK in
'y'|'Y') do_ftn='y' ;;
'n'|'N') do_ftn='n' ;;
esac
done
else
echo "Source code file $ftn not found"
do_ftn='n'
fi
if [ -f "$inp" ]
then
echo "Input files file $inp found ..."
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n " Update input files ?
read OK
case $OK in
'y'|'Y') do_inp='y' ;;
'n'|'N') do_inp='n' ;;
esac
done
else
echo "Input files file $inp not found"
do_inp='n'
fi
if [ -f "$tst" ]
then
echo "Test cases $tst found ..."
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n " Update test cases ?
read OK
case $OK in

[y/n] "

[y/n] "

[y/n] "

'y'|'Y') do_tst='y' ;;
'n'|'N') do_tst='n' ;;
esac
done
else
echo "Test cases $tst not found"
do_tst='n'
fi
if [ -f "$doc" ]
then
echo "Docblocks $doc found ..."
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n " Update NCO documentation ?
read OK
case $OK in
'y'|'Y') do_doc='y' ;;
'n'|'N') do_doc='n' ;;
esac
done
fi

[y/n] "

if [ "$do_aux" = 'n' ] && [ "$do_ftn" = 'n' ] && \


[ "$do_inp" = 'n' ] && [ "$do_tst" = 'n' ] && [ "$do_doc" = 'n' ]
then
echo ' ' ; echo ' *** NO ACTION REQUIRED/POSSIBLE *** ' ; echo ' ' ; exit
fi
# 1.g Set mode of update - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' '
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ]
do
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n "Update all files (no prompt) ? [y/n] "
read OK
case $OK in
'y'|'Y') do_all='y' ;;
'n'|'N') do_all='n' ;;
esac
done
echo -n "
Are you sure ? [y/-] "
read OK
done
# 1.h Check / make directories

- - - - - - - - - - - - - - - - - - - - - - -

echo ' '


echo 'Checking/making directories :'
for dir in $tmp aux bin ftn obj mod exe inp test work
do
if [ ! -d $dir ]
then

echo " making directory $dir"


mkdir $dir
fi
done
if [ "$do_doc" = 'y' ]
then
if [ ! -d doc90 ]
then
echo " making directory doc90"
mkdir doc90
fi
fi
#
#
#
#

--------------------------------------------------------------------------- #
2. Set up auxiliaries
#
--------------------------------------------------------------------------- #
2.a Check if requested and ID output
if [ "$do_aux" = 'y' ]
then
echo ' ' ; echo ' '
echo ' ************************'
echo '*** Set up auxiliaries ***'
echo ' *****************************************************************'
echo "
Directory $main_dir/aux"

# 2.b Unpack tar file in $tmp - - - - - - - - - - - - - - - - - - - - - - - echo ' '


echo "Unpacking $aux in $tmp ..."
cd $tmp
tar -xf ../$aux
# 2.c FORTRAN executables - - - - - - - - - - - - - - - - - - - - - - - - - echo ' '
echo 'FORTRAN executables :'
echo '---------------------'
for code in w3adc w3prnt w3list w3split
do
echo " Program $code ..."
if [ -f "$main_dir/aux/$code.f" ] && [ "$do_all" = 'n' ]
then
echo "
Previous $code.f found in $main_dir/aux"
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n "
Update this file ? [y/n] "
read OK
case $OK in
'y'|'Y') go_on='y' ;;
'n'|'N') go_on='n' ;;
esac
done
else
go_on='y'
fi

if [ "$go_on" = 'y' ]
then
echo "
Updating $code.f in $main_dir/aux"
cp $code.f $main_dir/aux/.
if [ -f "$main_dir/exe/$code" ] && [ "$do_all" = 'n' ]
then
echo "
Previous $code found in $main_dir/exe"
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n "
Update this file ? [y/n] "
read OK
case $OK in
'y'|'Y') go_on='y' ;;
'n'|'N') go_on='n' ;;
esac
done
fi
if [ "$go_on" = 'y' ]
then
echo "
Updating $code in $main_dir/bin"
echo "
Compiling ..."
if `$fort $code.f > fort.out 2> fort.err`
then
rm -f $main_dir/bin/$code
if [ -f a.out ]
then
echo "
Storing ..."
mv a.out ../bin/$code
else
echo ' ' ; echo "
*** FILE a.out NOT FOUND *** "
echo ' ' ; cat fort.out ; echo ' ' ; cat fort.err ; echo ' '
fi
else
echo ' ' ; echo "
*** ERROR IN COMPILING $code.f *** "
echo ' ' ; cat fort.out ; echo ' ' ; cat fort.err ; echo ' '
fi
fi
fi
rm -f $code.f
rm -f fort.*
done
# 2.d C objects ( presently not used ) - - - - - - - - - - - - - - - - - - - #
#
#

echo ' '


echo 'C objects :'
echo '-----------'

# 2.e UNIX shell scripts by type - - - - - - - - - - - - - - - - - - - - - - echo ' '


echo "(All remaining aux scripts are stored in $main_dir/bin)"
for list in 1 2 3

do
echo ' '
case $list in
1) echo 'Scripts for compiling and linking :'
echo '-----------------------------------'
goto=bin
files='ad3 ad3_test w3_make w3_new make_makefile.sh make_MPI'
files="$files switch.gen `ls comp.*` `ls link.*`" ;;
2) echo 'GrADS aux scripts'
echo '-----------------'
goto=aux
files='map2_1.gs map2_2.gs map2_3.gs map_s3.gs spec.gs source.gs'
files="$files 1source.gs colorset.gs cbarn.gs spec_ids.gen"
files="$files profile.gs" ;;
3) echo 'Other :'
echo '-------'
goto=bin
files=`ls` ;;
esac
if [ -z "$files" ]
then
echo ' No files found'
else
for file in $files
do
if [ -f "$main_dir/$goto/$file" ] && [ "$do_all" = 'n' ]
then
echo " File $file already exists."
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n "
Update this file ? [y/n] "
read OK
case $OK in
'y'|'Y') mv $file $main_dir/$goto/. ;;
'n'|'N') rm $file ;;
esac
done
else
if [ -f "$main_dir/$goto/$file" ]
then
echo " Updating $file ..."
else
echo " Storing $file ..."
fi
mv $file $main_dir/$goto/.
fi
done
fi
done
# 2.f comp and link shell scripts - - - - - - - - - - - - - - - - - - - - - echo ' '
echo 'Compile and link shell scripts :'
echo '--------------------------------'
cd $main_dir/bin

for file in switch comp link


do
if [ -f $file ]
then
echo " File $file exists (will not be modified)."
else
echo " File $file does not exists."
echo "
Copied from $file.gen (has to be modified by user)"
cp $file.gen $file
fi
done
# 2.g spec_ids file - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' '
echo 'spec_ids file :'
echo '---------------'
cd $main_dir/aux
for file in spec_ids
do
if [ -f $file ]
then
echo " File $file exists (will not be modified)."
else
echo " File $file does not exists."
echo "
Copied from $file.gen (may be modified by user)"
cp $file.gen $file
fi
done
# 2.h restrict file access - - - - - - - - - - - - - - - - - - - - - - - - - cd $main_dir/bin
chmod 700 *
chmod 600 switch*
# 2.i Links to work directory - - - - - - - - - - - - - - - - - - - - - - - echo
echo 'Set up links to
cd $main_dir/work
ln -s ../bin/switch
ln -s ../bin/comp
ln -s ../bin/link
ln -s ../bin/make_MPI
ln -s ../aux/c*.gs
ln -s ../aux/s*.gs
ln -s ../aux/1s*.gs
ln -s ../aux/spec_ids

work directory ...'


.
.
.
.
.
.
.
.

2>
2>
2>
2>
2>
2>
2>
2>

/dev/null
/dev/null
/dev/null
/dev/null
/dev/null
/dev/null
/dev/null
/dev/null

# 2.j Links to work directory - - - - - - - - - - - - - - - - - - - - - - - echo


echo 'Set up links to test directory ...'
cd $main_dir/test
ln -s ../bin/switch . 2> /dev/null

# 2.k Links to bin directory - - - - - - - - - - - - - - - - - - - - - - - - echo


echo 'Set up links to bin directory ...'
cd $main_dir/bin
ln -s ../install_wwatch3 . 2> /dev/null
fi
#
#
#
#

--------------------------------------------------------------------------- #
3. Set up source codes
#
--------------------------------------------------------------------------- #
3.a Check if requested and ID output
if [ "$do_ftn" = 'y' ]
then
echo ' ' ; echo ' '
echo ' *********************************'
echo '*** Set up propgram source code ***'
echo ' *****************************************************************'
echo "
Directory $main_dir/ftn"

# 3.b Unpack tar file in $tmp - - - - - - - - - - - - - - - - - - - - - - - cd $main_dir/ftn


ls *.ftn *.f90 > $main_dir/old.files 2> /dev/null
echo ' '
echo "Unpacking $ftn in $tmp ..."
cd $main_dir/$tmp
tar -xf ../$ftn
# 3.c Sources by type - - - - - - - - - - - - - - - - - - - - - - - - - - - nr_differ=0
for list in 1 2 3 4
do
echo ' '
case $list in
1) echo 'Main programs :'
echo '--------------' ; files=`ls ww3_*.ftn gx_*.ftn` ;;
2) echo 'Subroutines (.ftn) :'
echo '--------------------' ; files=`ls *.ftn` ;;
3) echo 'Subroutines (.f90) :'
echo '--------------------' ; files=`ls *.f90` ;;
4) echo 'Other :'
echo '-------' ; files=`ls` ;;
esac
nr_the_same=0
if [ -z "$files" ]
then
echo ' No files found'
else
for file in $files
do
if [ -f $main_dir/ftn/$file ]
then

if `cmp $file $main_dir/ftn/$file > /dev/null 2> /dev/null`


then
rm -f $file
nr_the_same=`expr $nr_the_same + 1`
echo " File $file unchanged."
else
if [ "$do_all" = 'y' ]
then
echo " Updating $file ..."
mv $file $main_dir/ftn/.
file_o="`echo $file | sed 's/\./ /' | awk '{print $1}'`.o"
rm -f $main_dir/obj/$file_o
nr_differ=`expr $nr_differ + 1`
else
echo " File $file already exists."
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n "
Update this file ? [y/n] "
read OK
done
case $OK in
'y'|'Y') ok=y ;;
'n'|'N') ok=n ;;
esac
if [ "$ok" = 'y' ]
then
echo " Updating $file ..."
mv $file $main_dir/ftn/.
file_o="`echo $file | sed 's/\./ /' | awk '{print $1}'`.o"
rm -f $main_dir/obj/$file_o
nr_differ=`expr $nr_differ + 1`
else
rm -f $file
fi
fi
fi

else
echo " New file $file ..."
mv $file $main_dir/ftn/.
file_o="`echo $file | sed 's/\./ /' | awk '{print $1}'`.o"
rm -f $main_dir/obj/$file_o
nr_differ=`expr $nr_differ + 1`
fi
cp $main_dir/old.files $main_dir/old.files.temp
sed -n "/$file/!p" $main_dir/old.files.temp > $main_dir/old.files
rm -f $main_dir/old.files.temp
done
fi
if [ "$nr_the_same" != '0' ]
then
echo " $nr_the_same files unchanged."
fi

done
if [ "`wc -c $main_dir/old.files | awk '{ print $1}'`" -gt '2' ]
then
echo ' '
echo 'Files not in archive :'
echo '----------------------'
for not_in in `cat $main_dir/old.files`
do
echo " $not_in"
done
fi
rm -f $main_dir/old.files
rm -f $main_dir/old.files.temp
echo ' '
echo "$nr_differ files updated or added"
fi
#
#
#
#

--------------------------------------------------------------------------- #
4. Set up input files
#
--------------------------------------------------------------------------- #
4.a Check if requested and ID output
if [ "$do_inp" = 'y' ]
then
echo ' ' ; echo ' '
echo ' ************************'
echo '*** Set up input files ***'
echo ' *****************************************************************'
echo "
Directory $main_dir/inp"

# 4.b Unpack tar file in $tmp - - - - - - - - - - - - - - - - - - - - - - - echo ' '


echo "Unpacking $inp in $tmp ..."
cd $main_dir/$tmp
tar -xf ../$inp
# 4.c Input files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - echo ' '
echo 'Input files :'
echo '-------------'
nr_the_same=0
files=`ls ww3_*.inp track_i.ww3`
files="$files `ls gx_*.inp`"

for file in $files


do
if [ -f $main_dir/inp/$file ]
then
if `cmp $file $main_dir/inp/$file > /dev/null 2> /dev/null`
then
rm -f $file
nr_the_same=`expr $nr_the_same + 1`
echo " File $file unchanged."

else
if [ "$do_all" = 'y' ]
then
echo " Updating $file ..."
mv $file $main_dir/inp/.
else
echo " File $file already exists."
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n "
Update this file ? [y/n] "
read OK
done
case $OK in
'y'|'Y') ok=y ;;
'n'|'N') ok=n ;;
esac
if [ "$ok" = 'y' ]
then
echo " Updating $file ..."
mv $file $main_dir/inp/.
else
rm $file
fi
fi
fi
else
echo " New file $file ..."
mv $file $main_dir/inp/.
fi
done
if [ "$nr_the_same" != '0' ]
then
echo " $nr_the_same files unchanged."
fi
# 4.d Links to work directory - - - - - - - - - - - - - - - - - - - - - - - cd $main_dir/inp
echo
echo 'Set up links to work directory ...'
files=`ls *.inp *.ww3`
cd $main_dir/work
for file in $files
do
if [ ! -f $file ]
then
ln -s ../inp/$file .
fi
done
fi
#
#
#
#

--------------------------------------------------------------------------- #
5. Set up test cases
#
--------------------------------------------------------------------------- #
5.a Check if requested and ID output

if [ "$do_tst" = 'y' ]
then
echo ' ' ; echo ' '
echo ' ***********************'
echo '*** Set up test cases ***'
echo ' *****************************************************************'
echo "
Directory $main_dir/test"
# 5.b Unpack tar file in $tmp - - - - - - - - - - - - - - - - - - - - - - - echo ' '
echo "Unpacking $tst in $tmp ..."
cd $main_dir/$tmp
tar -xf ../$tst
# 5.c Tests by types - - - - - - - - - - - - - - - - - - - - - - - - - - - - for list in 1 2 3 4
do
echo ' '
case $list in
1) echo 'Propagation tests :' ; \
echo '-------------------' ; files=`ls ww3_tp*` ;;
2) echo 'Source term tests :' ; \
echo '-------------------' ; files=`ls ww3_ts*` ;;
3) echo 'Multi-scale tests :' ; \
echo '-------------------' ; \
files=`ls mww3_test_* mww3_case_* mww3_data_*.tar.gz` ;;
4) echo 'Other tests :' ; \
echo '-------------' ; files=`ls` ;;
esac
nr_the_same='0'

if [ -z "$files" ]
then
echo ' No files found'
else
for file in $files
do
if [ -f $main_dir/test/$file ]
then
if `cmp $file $main_dir/test/$file > /dev/null 2> /dev/null`
then
rm -f $file
nr_the_same=`expr $nr_the_same + 1`
echo " File $file unchanged."
else
if [ "$do_all" = 'y' ]
then
echo " Updating $file ..."
mv $file $main_dir/test/.
else
echo " File $file already exists."
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n "
Update this file ? [y/n] "

read OK
done
case $OK in
'y'|'Y') ok=y ;;
'n'|'N') ok=n ;;
esac
if [ "$ok" = 'y' ]
then
echo " Updating $file ..."
mv $file $main_dir/test/.
else
rm $file
fi
fi
fi
else
echo " New file $file ..."
mv $file $main_dir/test/.
fi
done
fi
if [ "$nr_the_same" != '0' ]
then
echo " $nr_the_same files unchanged."
fi
done
fi
# 5.d Make executable - - - - - - - - - - - - - - - - - - - - - - - - - - - cd $main_dir/test
chmod 700 *
chmod 644 *.tar.gz
#
#
#
#

--------------------------------------------------------------------------- #
6. Set up docblocks
#
--------------------------------------------------------------------------- #
6.a Check if requested and ID output
if [ "$do_doc" = 'y' ]
then
echo ' ' ; echo ' '
echo ' *********************'
echo '*** Set up docblocks ***'
echo ' *****************************************************************'
echo "
Directory $main_dir/doc90"

# 6.b Unpack tar file in $tmp - - - - - - - - - - - - - - - - - - - - - - - echo ' '


echo "Unpacking $doc in $tmp ..."
cd $main_dir/$tmp
tar -xf ../$doc
# 6.c Docblocks (NCEP only) - - - - - - - - - - - - - - - - - - - - - - - - echo ' '

echo 'Docblocks :'


echo '-----------'
nr_the_same=0
files=`ls *.doc`
for file in $files
do
if [ -f $main_dir/doc90/$file ]
then
if `cmp $file $main_dir/doc90/$file > /dev/null 2> /dev/null`
then
rm -f $file
nr_the_same=`expr $nr_the_same + 1`
echo " File $file unchanged."
else
if [ "$do_all" = 'y' ]
then
echo " Updating $file ..."
mv $file $main_dir/doc90/.
else
echo " File $file already exists."
OK="$NULL"
until [ "$OK" = 'y' ] || [ "$OK" = 'Y' ] || \
[ "$OK" = 'n' ] || [ "$OK" = 'N' ]
do
echo -n "
Update this file ? [y/n] "
read OK
done
case $OK in
'y'|'Y') ok=y ;;
'n'|'N') ok=n ;;
esac
if [ "$ok" = 'y' ]
then
echo " Updating $file ..."
mv $file $main_dir/doc90/.
else
rm $file
fi
fi
fi
else
echo " New file $file ..."
mv $file $main_dir/doc90/.
fi
done

if [ "$nr_the_same" != '0' ]
then
echo " $nr_the_same files unchanged."
fi
fi
#
#
#
#

--------------------------------------------------------------------------- #
7. Clean up and final remarks
#
--------------------------------------------------------------------------- #
7.a Remove scratch directory

# echo ' '


# echo 'Final clean-up'
# echo " Removing directory $tmp"
cd $main_dir
rm -fr $tmp
# 7.b Concluding remarks - - - - - - - - - - - - - - - - - - - - - - - - - - if [ "$do_aux" = 'y' ]
then
echo ' ' ; echo ' '
echo ' *******************'
echo '*** Final remarks ***'
echo ' *****************************************************************'
echo ' '
echo 'To run the WAVEWATCH III executables and the scripts to generate '
echo 'and update these executables from arbitrary directories, add the'
echo 'following directories to the path of your interactive shell :'
echo ' '
echo "
$main_dir/bin"
echo "
$main_dir/exe"
echo ' '
echo "Note that the compile and link scripts 'comp' and 'link' as"
echo 'generated by the install procedure are generic scripts which'
echo 'require modification by the user to accomodate hardware and'
echo "optimization requirements (see $main_dir/work)"
echo ' '
fi
echo
echo
echo
echo
echo

' ' ; echo ' '


'
'
'
' '

*******************************'
***
End of program
***'
*******************************'

# end of script ------------------------------------------------------------- #

Вам также может понравиться