source: palm/trunk/SCRIPTS/mbuild_new @ 6

Last change on this file since 6 was 6, checked in by raasch, 17 years ago

some more installation and utility files added

File size: 46.8 KB
RevLine 
[1]1#!/bin/ksh
[5]2# mbuild - Programmuebersetzungsscript   Version:  @(#)MBUILD 1.0    10/02/07
[1]3
4     # Prozedur zur Uebersetzung von Programmteilen mittels make-Mechanismus
5     # auf einem Remote-Rechner, ausgehend von Quellcode auf einem lokalen
6     # Rechner
7
8     # Folgende Probleme existieren unter Linux, wenn keine AT&T-Korn-Shell
9     # verwendet wird:
10     # Wertzuweisungen an Variablen innerhalb von DO-Schleifen werden nicht
11     # nach aussen weitergegeben. "while read line" funktioniert nicht
12     # innerhalb einer Pipe.
13
14     # letzte Aenderung:
15     # 06/05/02 - Siggi - Beginn der Entwicklung
16     # 12/06/02 - Siggi - Abschluss der Entwicklungsarbeiten
17     # 23/06/02 - Siggi - voerst kein make-clean, Abbruch bei batch-mode
18     # 24/07/02 - Siggi - Keine Verwendung der temporaeren Datei tmp_mbuild
19     #                    unter linux mehr noetig, da nun AT&T-Korn-Shell
20     #                    benutzt wird
21     # 12/09/02 - Siggi - ibmh (hanni.hlrn.de) validiert
22     # 19/12/02 - Siggi - ibmb validiert
23     # 05/02/03 - Siggi - hostname nobela included
24     # 04/03/03 - Siggi - host nech included
25     # 06/03/03 - Siggi - make_call_string is echoed without '' to
26     #                    file LAST_MAKE_CALL (otherwise error on NEC, because
27     #                    '' are part of compiler options
28     # 16/03/03 - Siggi - Two underscores are placed in front of every define
29     #                    string, in case that palm.f90 version contains
30     #                    such strings
31     # 16/04/03 - Siggi - First extensions for linux machines
32     # 24/06/03 - Siggi - host orkan included
33     # 17/07/03 - Siggi - IP adress set to new "cross" machine at DKRZ
34     # 24/07/03 - Siggi - host maestro admitted
35     # 06/08/03 - Siggi - host gregale admitted
36     # 05/11/03 - Siggi - hosts irifi and quanero are now belonging to lcmuk
37     # 19/11/03 - Heiko - on lcmuk, mbuild does not tar the *.i files
38     # 08/01/04 - Siggi - additional preprocessor directive for ibm included
39     #                    (-D$OMP=OMP) in order to avoid problems with
40     #                    OMP_NUM_THREADS
41     # 09/01/04 - Siggi - action above cancelled
42     # 28/01/04 - Siggi - action above re-cancelled
43     # 08/03/04 - Siggi - host scirocco admitted
44     # 26/03/04 - Siggi - .o and .mod files are also deleted in depository, if
45     #                    the respective .f90 file is not listed in the makefile
46     #                    and deletion is demanded by the user
47     # 12/04/04 - Siggi - scp2 instead of scp used for transfer from decalpha
48     #                    due to error in ssh installation (otherwise a prompt
49     #                    for the password appears)
50     # 23/07/04 - Siggi - changes due to the new berni configuration
51     #                    (federation switch)
52     # 08/09/04 - Siggi - hanni IP address changed to 130.75.4.10
53     # 23/09/04 - Joerg - correction of IP-Address for 'cross' (DKRZ)
54     # 09/03/05 - Siggi - on nech, mbuild does not tar the *.i files
55     # 31/03/05 - Siggi - mbuild does not tar *.i files any more
56     # 24/04/05 - Siggi - netcdf support on lcmuk
57     # 25/04/05 - Siggi - netcdf support on gfdl3 (decalpha)
58     # 12/05/05 - Siggi - netcdf support on ibm
59     #                    set OBJECT_MODE=64 for compiling on ibmb, ibmh
60     # 18/05/05 - Siggi - netcdf support on nec
61     # 19/05/05 - Siggi - IP addres 134.75.155.74 changed to 165.132.26.56
62     # 23/05/05 - Siggi - netcdf support on ibms
63     # 01/06/05 - Siggi - reset of cpp_options to "" on lcmuk
64     # 30/06/05 - Siggi - netcdf support on bora
65     # 20/10/05 - Siggi - update of netcdf-version on decalpha (gfdl3)
66     # 04/11/05 - Siggi - netcdf 3.6.0-p1 on ibmh/ibmb
67     # 30/12/05 - Siggi - change of IP adresses in subnet 130.75.105
68     #                    host gfdl5 (ibmy) admitted
69     # 10/01/06 - Siggi - cpp directive for NetCDF 64bit support
70     # 20/01/06 - Siggi - cpp directive for ibmy
71     # 09/02/06 - Marcus- compile only once on lcmuk (as on ibmh/ibmb)
72     # 10/02/06 - Siggi - modifications for scp on decalpha
73     # 13/04/06 - Siggi - ostria admitted
74     # 19/04/06 - Siggi - preprocessor directive -D$OMP=OMP for ibm removed
75     # 23/05/05 - Siggi - lctit (SUN Fire X4600) admitted
76     # 29/05/05 - Siggi - atmos (lcide) admitted
77     # 23/08/06 - Siggi - netcdf support for scirocco (notebook)
78     # 24/11/06 - Siggi - breva and levanto admitted
79     # 07/02/07 - Siggi - adapted for RIAM (neck)
[5]80     # 10/02/07 - Siggi - all hpmuk-related code removed
[1]81
82
83
84    # VARIABLENVEREINBARUNGEN + DEFAULTWERTE
85 config_file=.mrun.config
86 host=all
87 host_found=false
88 ibm_hb_done=false
89 lcmuk_done=false
90 locat=normal
91 makefile=""
92 remote_mode=interactive
93 scirocco=false
94 silent=false
95 suf=f90
96 update=false
97
98 typeset -i  ih ihost=0
99
100 typeset  -R50 calltime
101 typeset  -L20 column1
102 typeset  -L50 column2
103 typeset  -L70 column3
104 typeset  -L20 version="MBUILD  1.0"
105
106    # FEHLERBEHANDLUNG
107    # BEI EXIT:
108 trap 'if [[ $locat != normal ]]
109       then
110          printf "\n\n +++ mbuild killed \n\n"
111       else
112          printf "\n\n *** mbuild finished \n\n"
113       fi' exit
114
115
116    # BEI TERMINAL-BREAK:
117 trap 'printf "\n\n +++ mbuild killed by \"^C\" \n\n"
118       exit
119      ' 2
120
121
122
123    # SHELLSCRIPT-OPTIONEN EINLESEN
124 while  getopts  :c:h:m:rs:  option
125 do
126   case  $option  in
127       (c)   config_file=$OPTARG;;
128       (h)   host=$OPTARG;;
129       (m)   makefile=$OPTARG;;
130       (r)   remote_mode=batch;;
131       (s)   suf=$OPTARG;;
132       (\?)  printf "\n  +++ unknown option $OPTARG \n";
133             locat=parameter; exit;;
134   esac
135 done
136
137
138
139    # BATCH-MODE IST ZUR ZEIT NICHT FUNKTIONSFAEHIG
140 if [[ $remote_mode = batch ]]
141 then
142    printf "\n  +++ sorry, batch mode does not work! \n"
143    locat=parameter; exit
144 fi
145
146
147
148    # LOKALEN RECHNER ERMITTELN
149 local_host_real_name=$(hostname)
150 local_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}')
151 case  $local_host_real_name  in
152     (atmos)                    local_host=lcide;;
153     (berte)                    local_host=t3eb;;
154     (bora|breva|gregale|irifi|levanto|maestro|orkan|ostria|quanero|scirocco)  local_host=lcmuk;;
155     (gate)                     local_host=neck;;
156     (gfdl3.yonsei.ac.kr)       local_host=decalpha; local_addres=165.132.26.56;;
157     (gfdl5)                    local_host=ibmy; local_addres=165.132.26.58;;
158     (gwdk081.gwdg.de)          local_host=ibm;;
159     (hreg01a-en0|hreg02a-en0)  local_host=ibmh;;
160     (nobel|nobela)             local_host=ibms;;
161     (tgg*)                     local_host=lctit;;
162     (t3e)                      local_host=t3eh;;
163     (zam003)                   local_host=t3ej2;;
164     (zam005)                   local_host=t3ej5;;
165     (*)       printf "\n  +++ local host \"$local_host_real_name\" not admitted for mbuild \n"
166               locat=local_host; exit;;
167 esac
168
169 [[ $local_host_real_name = scirocco ]]  &&  scirocco=true
170
171
172
173    # PRUEFEN, OB KONFIGURATIONS-DATEI VORHANDEN
174 if [[ ! -f $config_file ]]
175 then
176    printf "\n  +++ configuration file: "
177    printf "\n           $config_file"
178    printf "\n      does not exist"
179    locat=configuration; exit 
180 fi
181 if [[ $local_host != ibms ]]
182 then
183    config_file=$PWD/$config_file
184 else
185    config_file=`pwd`/$config_file
186 fi
187
188
189 
190    # BENUTZERNAMEN AUF LOKALEM RECHNER AUS KONFIGURATIONSDATEI ERMITTELN
191 line=""
192 grep  " $local_host" $config_file | grep "%remote_username"  |  while read line
193 do
194    if [[ "$line" != ""  ||  $(echo $line | cut -c1) != "#" ]]
195    then
196       local_username=`echo $line | cut -d" " -s -f2`
197    fi
198 done
199
200 if [[ "$local_username" = "" ]]
201 then
202    printf "\n  +++ no user name found in configuration file"
203    printf "\n      for local host \"$local_host\" "
204    locat=config_file; exit
205 fi
206
207
[5]208    # LOKALEN QUELLTEXTPFAD ERMITTELN.
209    # ZUERST PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD FUER ALLE RECHNER
210    # VEREINBART WURDE.
211    # DAZU ZUNAECHST ALLE IN DER KONFIGURATIONSDATEI VEREINBARTEN GLOBALEN
212    # VARIABLEN SETZEN, WEIL DIESE EVTL. IN PFADNAMEN VERWENDET WERDEN
213 line=""
214 grep "%" $config_file  |  while read line
215 do
216    if [[ "$line" != ""  &&  "$(echo $line | cut -d" " -s -f3)" = "" ]]
[1]217    then
[5]218       var=`echo $line | cut -d" " -s -f1 | cut -c2-`
219       value=`echo $line | cut -d" " -s -f2`
220       eval export $var=$value
[1]221    fi
[5]222 done
[1]223
[5]224    # NUN PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD VEREINBART WURDE
[1]225 line=""
226 grep "%source_path" $config_file  |  while read line
227 do
228    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
229    then
230       if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]]
231       then
232          global_source_path=`echo $line | cut -d" " -s -f2`
233       fi
234    fi
235 done
236
237 line=""
238 grep  " $local_host" $config_file | grep "%source_path"  |  while read line
239 do
240    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
241    then
242       local_source_path=`echo $line | cut -d" " -s -f2`
243    fi
244 done
245
246 if [[ "$local_source_path" = "" ]]
247 then
248    if [[ "$global_source_path" != "" ]]
249    then
250       local_source_path=$global_source_path
251    else
252       printf "\n  +++ no source path found in configuration file"
253       printf "\n      for local host \"$local_host\" "
254       printf "\n      please set \"\%source_path\" in configuration file"
255       locat=config_file; exit
256    fi
257 fi
258 eval local_source_path=$local_source_path
259
260
261     # EBENSO PFAD FUER DAS MAKE-DEPOSITORY ERMITTELN
262 line=""
263 grep "%depository_path" $config_file  |  while read line
264 do
265    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
266    then
267       if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]]
268       then
269          global_depository_path=`echo $line | cut -d" " -s -f2`
270       fi
271    fi
272 done
273
274 line=""
275 grep  " $local_host" $config_file | grep "%depository_path"  |  while read line
276 do
277    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
278    then
279       local_depository_path=`echo $line | cut -d" " -s -f2`
280    fi
281 done
282
283 if [[ "$local_depository_path" = "" ]]
284 then
285    if [[ "$global_depository_path" != "" ]]
286    then
287       local_depository_path=$global_depository_path
288    else
289       printf "\n  +++ no depository path found in configuration file"
290       printf "\n      for local host \"$local_host\" "
291       printf "\n      please set \"\%depository_path\" in configuration file"
292       locat=config_file; exit
293    fi
294 fi
295 eval local_depository_path=$local_depository_path
296
297
298
[5]299    # PRUEFEN, OB IN KONFIGURATIONSDATEI EIN HAUPTPROGRAMM
300    # VEREINBART WURDE
301 if [[ $(grep -c "%mainprog" $config_file) != 1 ]]
302 then
303    printf "\n  +++ no main program or more than one main program defined"
304    printf "\n      in configuration file"
305    locat=configuration; exit
306 else
307    line=`grep "%mainprog" $config_file`
308    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
309    then
310       printf "\n  +++ no main program defined in configuration file"
311       locat=configuration; exit
312    fi
313    mainprog=`echo $line | cut -d" " -s -f2 | cut -d"." -f1`
314 fi
315
316
317
[1]318    # MAKEFILE vorhanden
319 [[ "$makefile" = "" ]]  &&  makefile=$local_source_path/Makefile
320 if [[ ! -f $makefile ]]
321 then
322    printf "\n  +++ makefile: "
323    printf "\n           $makefile"
324    printf "\n      does not exist"
325    locat=makefile; exit 
326 fi
327
328
329    # HEADER-AUSGABE (TEIL1: MELDUNGEN UEBER LOKALEN RECHNER)
330 calltime=$(date)
331 printf "\n"
332 printf "#------------------------------------------------------------------------# \n"
333 printf "| $version$calltime | \n"
334 printf "|                                                                        | \n"
335 column1="called on:"; column2=$local_host_real_name
336 printf "| $column1$column2 | \n"
337 column1="local username:"; column2=$local_username
338 printf "| $column1$column2 | \n"
339 column1="local IP-addres:"; column2=$local_addres
340 printf "| $column1$column2 | \n"
341 column1="config file:"; column2=$config_file
342 printf "| $column1$column2 | \n"
343 column1="makefile:"; column2=$makefile
344 printf "| $column1$column2 | \n"
345 column1="local source path:"; column2=$local_source_path
346 printf "| $column1$column2 | \n"
347 column1="make depository:"; column2=$local_depository_path
348 printf "| $column1$column2 | \n"
349 printf "#------------------------------------------------------------------------# \n"
350
351# printf "|                                                                        | \n"
352
353
354 cd  $local_source_path
355
356
357    # LISTE DER ZU PRUEFENDEN QUELLTEXTDATEIEN ERSTELLEN
358 source_code_files=`ls -1  *.$suf`
359
360
361
362    # VERZEICHNIS FUER DAS MAKE-DEPOSITORY ERZEUGEN,
363    # FALLS NOCH NICHT VORHANDEN. ANSONSTEN ALLE DATEIEN
364    # NEUEREN DATUMS IN DIESES VERZEICHNIS KOPIEREN
365 if [[ ! -d $local_depository_path ]]
366 then
367    if  mkdir $local_depository_path
368    then
369       printf "\n\n  *** directory for make depository:"
370       printf "\n           $local_depository_path"
371       printf "\n      was created\n"
372
373          # MAKEFILE UND QUELLTEXTDATEIEN UNTER BEIBEHALTUNG
374          # IHRES DATUMS INS VERZEICHNIS KOPIEREN
375       printf "\n  *** makefile and source code files are copied to"
376       printf "\n      $local_depository_path\n"
377       printf "\n      copying makefile \"$makefile\" ..."
378       cp -p  $makefile  $local_depository_path/Makefile
379
380          # QUELLTEXTDATEIEN MUESSEN IM MAKEFILE AUFGEFUEHRT
381          # SEIN
382       for  filename  in  $source_code_files
383       do
384          if [[ $(grep -c $filename  $makefile) = 0 ]]
385          then
386             printf "\n  +++ source code file:"
387             printf "\n         $filename"
388             printf "\n      is not listed in makefile"
389             locat=makefile; exit
390          else
391             printf "\n      copying source code file \"$filename\" ..."
392             cp -p  $filename  $local_depository_path
393          fi
394       done
395       printf "\n"
396    else
397       printf "\n  +++ directory for make depository:"
398       printf "\n           $local_depository_path"
399       printf "\n      cannot be created"
400       locat=local_depository_path; exit
401    fi
402 else
403 
404    printf "\n  *** checking file status ..."
405
406       # MAKEFILE KOPIEREN, FALLS NEUEREN DATUMS
407    if [[ $makefile -nt $local_depository_path/Makefile ]]
408    then
409       printf "\n  *** update of \"$makefile\" "
410       cp -f -p  $makefile  $local_depository_path/Makefile
411       update=true
412
413          # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY AUCH IM NEUEN MAKEFILE
414          # VERZEICHNET SIND UND GEGEBENENFALLS DATEIEN LOESCHEN
415       cd  $local_depository_path
416       source_code_files_in_depository=`ls -1  *.$suf`
417       for  filename  in  $source_code_files_in_depository
418       do
419          if [[ $(grep -c $filename  Makefile) = 0 ]]
420          then
421             printf "\n  *** source code file in \"$local_depository_path\":"
422             printf "\n         $filename"
423             printf "\n      is not listed in makefile"
424             if [[ $silent = false ]]
425             then
426                answer=dummy
427                printf "\n\n"
428                while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
429                do
430                   printf " >>> delete \"$filename\" in \"$local_depository_path\" (y/n) ?  "
431                   read  answer
432                done
433                if [[ $answer = y  ||  $answer = Y ]]
434                then
435                   base=`echo $filename | cut -d. -f2`
436                   rm -f  $filename
437                   rm -f  ${base}.o  ${base}.mod
438                   printf "\n  *** \"$filename\" deleted in \"$local_depository_path\" "
439                else
440                   printf "\n  *** \"$filename\" not deleted in \"$local_depository_path\" "
441                fi
442             fi
443          fi
444       done
445       cd  -  > /dev/null  2>&1
446
447    elif [[ $local_depository_path/Makefile -nt $makefile ]]
448    then
449       printf "\n  *** makefile in depository is newer than"
450       printf "\n      \"$makefile\" "
451       if [[ $silent = false ]]
452       then
453          answer=dummy
454          printf "\n\n"
455          while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
456          do
457             printf " >>> update \"$makefile\" (y/n) ?  "
458             read  answer
459          done
460          if [[ $answer = y  ||  $answer = Y ]]
461          then
462             cp -f -p  $local_depository_path/Makefile  $makefile
463             printf "\n  *** \"$makefile\" updated"
464          else
465             printf "\n  *** \"$makefile\" not updated"
466          fi
467       fi
468    fi
469
470       # QUELLTEXTDATEIEN KOPIEREN, FALLS NEUEREN DATUMS
471       # SIE MUESSEN IM MAKEFILE AUFGEFUEHRT SEIN
472    for  filename  in  $source_code_files
473    do
474       if [[ $(grep -c $filename  $makefile) = 0 ]]
475       then
476          printf "\n  +++ source code file:"
477          printf "\n         $filename"
478          printf "\n      is not listed in makefile"
479          locat=makefile; exit
480       else
481          if [[ ! -f $local_depository_path/$filename ]]
482          then
483             cp -p  $filename  $local_depository_path
484             printf "\n  *** source code file \"$filename\" created in \"$local_depository_path\" "
485          fi
486          if [[ $filename -nt $local_depository_path/$filename ]]
487          then
488             printf "\n  *** update of source code file \"$filename\" "
489             cp -f -p  $filename  $local_depository_path
490             update=true
491          fi
492       fi
493    done
494
495
496       # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY IM AKTUELLEN ARBEITSVERZEICHNIS VORHANDEN
497       # ODER EVTL. NEUEREN DATUMS SIND
498    cd  $local_depository_path
499    source_code_files_in_depository=`ls -1  *.$suf`
500    cd  -  > /dev/null  2>&1
501    for  filename  in  $source_code_files_in_depository
502    do
503       if [[ ! -f $filename ]]
504       then
505          printf "\n  *** source code file \"$filename\" does not exist in current directory"
506          if [[ $silent = false ]]
507          then
508             answer=dummy
509             printf "\n\n"
510             while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
511             do
512                printf " >>> create \"$filename\" in current directory (y/n) ?  "
513                read  answer
514             done
515             if [[ $answer = y  ||  $answer = Y ]]
516             then
517                cp -p  $local_depository_path/$filename  $filename
518                printf "\n  *** source code file \"$filename\" created in current directory"
519             else
520                printf "\n  *** source code file \"$filename\" not created in current directory"
521             fi
522          fi
523       elif [[ $local_depository_path/$filename -nt $filename ]]
524       then
525          ls -al $local_depository_path/$filename
526          ls -al $filename
527          printf "\n  *** source code file \"$filename\" in depository is newer than in current directory"
528          if [[ $silent = false ]]
529          then
530             answer=dummy
531             printf "\n\n"
532             while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
533             do
534                printf " >>> update \"$filename\" in current directory (y/n) ?  "
535                read  answer
536             done
537             if [[ $answer = y  ||  $answer = Y ]]
538             then
539                cp -f -p  $local_depository_path/$filename  $filename
540                printf "\n  *** source code file \"$filename\" updated in current directory"
541             else
542                printf "\n  *** source code file \"$filename\" not updated in current directory"
543             fi
544          fi
545       fi
546    done
547
548    if [[ $update = false ]]
549    then
550       printf "\n  *** no updates necessary in \"$local_depository_path\" "
551       if [[ $silent = false ]]
552       then
553          answer=dummy
554          printf "\n\n"
555          while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
556          do
557             printf " >>> continue with updates on remote hosts (y/n) ?  "
558             read  answer
559          done
560          if [[ $answer = n  ||  $answer = N ]]
561          then
562             locat=user_abort; exit
563          fi
564       fi
565    fi
566 fi
567 
568
569 
570    # QUELLTEXTDATEIEN UND MAKEFILE MIT TAR ZUSAMMENBINDEN
571    # IN JEDEM FALL ALLEN DATEIEN WRITE-PERMIT GEBEN, DAMIT ES AUF
572    # DEN REMOTE-RECHNERN NICHT EVTL. ZU PROBLEMEN BEIM UEBERSCHREIBEN KOMMT
573 printf "\n\n  *** tar of makefile and source files in depository ..." 
574 cd  $local_depository_path
575 chmod u+w  Makefile  *.$suf
576 tar -cf  ${mainprog}_sources.tar  Makefile  *.$suf
577 printf "\n"
578
579
580
581    # BESTAETIGUNG ZUM WEITERMACHEN EINHOLEN
582 if [[ $host = all ]]
583 then
584    printf "\n  *** updates will be made for ALL hosts found in"
585    printf "\n      the configuration file"
586 else
587    printf "\n  *** update will be made for host \"$host\" "
588 fi
589
590 if [[ $silent = false ]]
591 then
592    answer=dummy
593    printf "\n\n"
594    while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
595    do
596       printf " >>> continue (y/n) ?  "
597       read  answer
598    done
599    if [[ $answer = n  ||  $answer = N ]]
600    then
601       locat=user_abort; exit
602    fi
603 fi
604 
605 
606
607   
608    # GENERIERUNG DER AKTUELLEN MODELLVERSION FUER ALLE RECHNER-/UEBERSETZUNGS-
609    # VERSIONEN, DIE IN DER KONFIGURATIONSDATEI GEFUNDEN WERDEN
610 printf "\n  *** scanning configuration file for host(s) ..."
611
612 grep  %fopts  $config_file  |  while read line
613 do
614       # KOMMENTARZEILEN UEBERSPRINGEN
615    [[ $(echo $line | cut -c1) = "#" ]]  &&  continue
616    (( ihost = ihost + 1 ))
617    hostline[$ihost]="$line"
618 done
619
620 
621 while (( ih < ihost ))
622 do
623
624    (( ih = ih + 1 ))
625
626       # REMOTE-RECHNER UND UEBERSETZUNGS-VERSION FESTSTELLEN
627       # NUR WEITERMACHEN, WENN ENTSPRECHENDER REMOTE-RECHNER MITTELS
628       # SHELLSCRIPT-OPTION AUCH AUSGEWAEHLT WURDE
629    remote_host_string=`echo ${hostline[$ih]} | cut -d" " -s -f3-`
630    remote_host=`echo $remote_host_string | cut -d" " -f1`
631    if [[ $host != all ]]
632    then
633       [[ $remote_host != $host ]]  &&  continue
634    fi
635    host_found=true
636    condition1=`echo $remote_host_string | cut -d" " -s -f2`
637    if [[ $condition1 = $remote_host ]]
638    then
639       condition1=""
640    else
641       condition2=`echo $remote_host_string | cut -d" " -s -f3`
642    fi
643
644
645       # AUF HLRN-RECHNER NUR EINMAL UEBERSETZEN
646    if [[ $remote_host = ibmb  ||  $remote_host = ibmh ]]
647    then
648       if [[ $ibm_hb_done = true ]]
649       then
650          printf "\n *** remote host \"$remote_host\" skipped since compilation has already"
651          printf "\n     been carried out on one of the HLRN machines\n"
652          continue
653       fi
654    fi
655
656       # AUF LCMUK-RECHNER NUR EINMAL UEBERSETZEN
657    if [[ $remote_host = lcmuk ]]
658    then
659       if [[ $lcmuk_done = true ]]
660       then
661          printf "\n *** local host \"$remote_host\" skipped since compilation has already"
662          printf "\n     been carried out on this host\n"
663          continue
664       fi
665    fi
666
667
668       # IP-ADRESSE DES REMOTE-RECHNERS BESTIMMEN
669    netcdf_support=false
670    case  $remote_host  in
671        (lcmuk)          remote_addres=130.75.105.3; cpp_options=""
672                         netcdf_support=true
673                         if [[ $scirocco = true ]]
674                         then
675                            netcdf_path=/opt/netcdf/3.6.2-beta4
676                         else
677                            netcdf_path=/muksoft/packages/netcdf/linux
678                         fi;;
679        (lctit)          remote_addres=172.17.75.161; netcdf_support=true
680                         netcdf_path=/home/usr5/mkanda/netcdf-3.6.1/src; cpp_options="-Mpreprocess";;
681        (decalpha)       remote_addres=165.132.26.56; cpp_options="-cpp"; netcdf_support=true
682                         netcdf_path=/usr/local/netcdf-3.5.1;;
683        (ibm)            remote_addres=134.76.99.81; cpp_options="-qsuffix=cpp=f90";;
684        (ibmb)           remote_addres=130.73.230.10; cpp_options="-qsuffix=cpp=f90"; netcdf_support=true
685                         netcdf_path=/aws/dataformats/netcdf-3.6.0-p1/64-32;;
686        (ibmh)           remote_addres=130.75.4.10; cpp_options="-qsuffix=cpp=f90"; netcdf_support=true
687                         netcdf_path=/aws/dataformats/netcdf-3.6.0-p1/64-32;;
688        (ibms)           remote_addres=150.183.5.101; cpp_options="-qsuffix=cpp=f90"; netcdf_support=true
689                         netcdf_path=/applic/lib/NETCDF64;;
690        (ibmy)           remote_addres=165.132.26.58; cpp_options="-qsuffix=cpp=f90"; netcdf_support=true
691                         netcdf_path=/usr1/users/raasch/pub/netcdf-3.6.0-p1;;
692        (nech)           remote_addres=136.172.44.192; cpp_options="-Ep"; netcdf_support=true
693                         netcdf_path=/pool/SX-6/netcdf/netcdf-3.6.0-p1;;
694        (neck)           remote_addres=133.5.178.11; cpp_options="-Ep"; netcdf_support=true
695                         netcdf_path=/home/DSRC/NC/tatuyama/pub/netcdf-3.6.0-p1;;
696        (t3eb)           remote_addres=130.73.206.21; cpp_options="-eZ";;
697        (t3eh)           remote_addres=130.75.4.131; cpp_options="-eZ";;
698        (t3ej2)          remote_addres=134.94.100.22; cpp_options="-eZ";;
699        (t3ej5)          remote_addres=134.94.100.49; cpp_options="-eZ";;
700        (ground.yonsei.ac.kr) remote_addres=134.75.155.33;;
701     (*)                 printf "\n  +++ remote host \"$remote_host\" unknown";
702                         printf "\n      please inform S. Raasch!";
703                         locat=config_file; exit;;
704    esac
705
706
707       # REMOTE-USERNAMEN ERMITTELN
708    line=""
709    grep  "$remote_host_string" $config_file | grep "%remote_username"  |  while read line1
710    do
711       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
712       then
713          line="$line1"
714       fi
715    done
716
717    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
718    then
719       printf "\n  +++ no remote username found in configuration file"
720       printf "\n      for \"$remote_host_string\" "
721       locat=config_file; exit
722    else
723       remote_username=`echo $line | cut -d" " -s -f2`
724    fi
725
726
727       # REMOTE-QUELLTEXTPFAD ERMITTELN
728    line=""
729    grep  "$remote_host_string" $config_file | grep "%source_path"  |  while read line1
730    do
731       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
732       then
733          line="$line1"
734       fi
735    done
736
737    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
738    then
739       remote_source_path=`echo $line | cut -d" " -s -f2`
740    fi
741    if [[ "$remote_source_path" = "" ]]
742    then
743       if [[ "$global_source_path" != "" ]]
744       then
745          remote_source_path=$global_source_path
746       else
747          printf "\n  +++ no source path found in configuration file"
748          printf "\n      for \"$remote_host_string\" "
749          locat=config_file; exit
750       fi
751    fi
752
753
754       # REMOTE-PFAD FUER MAKE-DEPOSITORY ERMITTELN
755    line=""
756    grep  "$remote_host_string" $config_file | grep "%depository_path"  |  while read line1
757    do
758       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
759       then
760          line="$line1"
761       fi
762    done
763
764    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
765    then
766       remote_md=`echo $line | cut -d" " -s -f2`
767    fi
768    if [[ "$remote_md" = "" ]]
769    then
770       if [[ "$global_depository_path" != "" ]]
771       then
772          remote_md=$global_depository_path
773       else
774          printf "\n  +++ no depository path found in configuration file"
775          printf "\n      for \"$remote_host_string\" "
776          printf "\n      please set \"\%depository_path\" in configuration file"
777          locat=config_file; exit
778       fi
779    fi
780
781
782       # COMPILERNAMEN ERMITTELN
783    line=""
784    grep  "$remote_host_string" $config_file | grep "%compiler_name"  |  while read line1
785    do
786       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
787       then
788          line="$line1"
789       fi
790    done
791
792    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
793    then
794       printf "\n  +++ no compiler name found in configuration file"
795       printf "\n      for \"$remote_host_string\" "
796       locat=config_file; exit
797    else
798       compiler_name=`echo $line | cut -d" " -s -f2`
799    fi
800
801
802
803       # PRAEPROZESSOR-DIREKTIVEN SETZEN
804    if [[ $(echo $remote_host | cut -c1-3) = ibm ]]
805    then
806       if [[ $remote_host = ibms ]]
807       then
808          cpp_options="$cpp_options -WF,-DMPI_REAL=MPI_DOUBLE_PRECISION"
809          [[ $netcdf_support = true ]]  &&  cpp_options="${cpp_options},-D__netcdf"
810       else
811          cpp_options="$cpp_options -WF,-DMPI_REAL=MPI_DOUBLE_PRECISION"
812          [[ $netcdf_support = true ]]  &&  cpp_options="${cpp_options},-D__netcdf,-D__netcdf_64bit"
813          [[ $remote_host = ibmy ]]  &&  cpp_options="${cpp_options},-D__ibmy_special"
814       fi
815    elif [[ $remote_host = lcmuk ]]
816    then
817       cpp_options="$cpp_options -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION"
818       [[ $netcdf_support = true ]]  &&  cpp_options="$cpp_options -D__netcdf -D__netcdf_64bit"
819    elif [[ $remote_host = lctit ]]
820    then
821       cpp_options="$cpp_options -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION"
822       [[ $netcdf_support = true ]]  &&  cpp_options="$cpp_options -D__netcdf"
823    elif [[ $remote_host = decalpha ]]
824    then
825       cpp_options="$cpp_options -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION"
826       [[ $netcdf_support = true ]]  &&  cpp_options="$cpp_options -D__netcdf"
827    elif [[ $remote_host = nech  ||  $remote_host = neck ]]
828    then
829       cpp_options="$cpp_options -DMPI_REAL=MPI_REAL8 -DMPI_2REAL=MPI_2REAL8 -DSCFFT=DZFFT -DCSFFT=ZDFFT"
830       [[ $netcdf_support = true ]]  &&  cpp_options="$cpp_options -D__netcdf -D__netcdf_64bit"
831    fi
832
833    if [[ $(echo $remote_host | cut -c1-3) = ibm ]]
834    then
835       for  string  in  $remote_host_string
836       do
837          if [[ $(echo $string | cut -c1-3) = ibm ]]
838          then
839             cpp_options="${cpp_options},-D__ibm"
840             if [[ $remote_host = ibmy ]]
841             then
842                cpp_options="${cpp_options},-D__ibmy_special"
843             fi
844          else
845             cpp_options="${cpp_options},-D__$string"
846          fi
847       done
848       cpp_options="$cpp_options "
849    elif [[ $remote_host = nech  ||  $remote_host = neck ]]
850    then
851       for  string  in  $remote_host_string
852       do
853          if [[ $(echo $string | cut -c1-3) = nec ]]
854          then
855             cpp_options="${cpp_options} -D__nec"
856          else
857             cpp_options="${cpp_options} -D__$string"
858          fi
859       done
860       cpp_options="$cpp_options "
861    else
862       for  string  in  $remote_host_string
863       do
864          cpp_options="$cpp_options -D__$string "
865       done
866    fi
867
868
869       # COMPILEROPTIONEN ERMITTELN
870    line=""
871    grep  "$remote_host_string" $config_file | grep "%fopts"  |  while read line1
872    do
873       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
874       then
875          line="$line1"
876       fi
877    done
878    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
879    then
880       printf "\n  +++ no compiler options found in configuration file"
881       printf "\n      for \"$remote_host_string\" "
882       locat=config_file; exit
883    else
884          # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN
885       compiler_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'`
886    fi
887    if [[ $netcdf_support = true ]]
888    then
889       case  $remote_host  in
890          (decalpha)  compiler_options="-I${netcdf_path}/include  $compiler_options";;
891          (ibmb|ibmh) compiler_options="-I ${netcdf_path}/include-64  $compiler_options";;
892          (ibms)      compiler_options="-I /applic/netcdf64/src/f90  $compiler_options";;
893          (ibmy)      compiler_options="-I ${netcdf_path}/include  $compiler_options";;
894          (lcmuk)     compiler_options="-I ${netcdf_path}/include  $compiler_options";;
895          (lctit)     compiler_options="-I ${netcdf_path}/f90      $compiler_options";;
896          (nech|neck) compiler_options="-I ${netcdf_path}/include  $compiler_options";;
897       esac
898    fi
899
900
901
902       # LADER-OPTIONEN ERMITTELN
903    line=""
904    grep  "$remote_host_string" $config_file | grep "%lopts"  |  while read line1
905    do
906       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
907       then
908          line="$line1"
909       fi
910    done
911
912    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
913    then
914       printf "\n  +++ no loader options found in configuration file"
915       printf "\n      for \"$remote_host_string\" "
916       locat=config_file; exit
917    else
918          # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN
919       loader_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'`
920    fi
921    if [[ $netcdf_support = true ]]
922    then
923       case  $remote_host  in
924          (decalpha)                   loader_options="$loader_options -L${netcdf_path}/lib -lnetcdf";;
925          (ibmb|ibmh|lcmuk|nech|neck)  loader_options="$loader_options -L${netcdf_path}/lib -lnetcdf";;
926          (ibms)                       loader_options="$loader_options -L${netcdf_path} -lnetcdf";;
927          (ibmy)                       loader_options="$loader_options -L${netcdf_path}/lib -lnetcdf";;
928          (lctit)                      loader_options="$loader_options -L${netcdf_path}/libsrc -lnetcdf";;
929       esac
930    fi
931
932
933    printf "\n\n#------------------------------------------------------------------------# \n"
934    if [[ $remote_host = $local_host ]]
935    then
936       column1="remote_host:"; column2="$remote_host (= local host!)"
937    else
938       column1="remote_host:"; column2=$remote_host
939    fi
940    printf "| $column1$column2 | \n"
941    printf "|                                                                        | \n"
942    column1="conditions:"; column2="$condition1 $condition2"
943    printf "| $column1$column2 | \n"
944    column1="make depository:"; column2=$remote_md
945    printf "| $column1$column2 | \n"
946    column1="username:"; column2=$remote_username
947    printf "| $column1$column2 | \n"
948    column1="addres:"; column2=$remote_addres
949    printf "| $column1$column2 | \n"
950    column1="compiler:"; column2=$compiler_name
951    printf "| $column1$column2 | \n"
952    column1="cpp options:"; column2=$cpp_options
953    printf "| $column1$column2 | \n"
954    line=$(echo "$cpp_options" | cut -c51-)
955    while [[ "$line" != "" ]]
956    do
957       column1=""
958       column2=$line
959       printf "| $column1$column2 | \n"
960       line=$(echo "$line" | cut -c51-)
961    done
962    column1="compiler options:"; column2=$compiler_options
963    printf "| $column1$column2 | \n"
964    line=$(echo "$compiler_options" | cut -c51-)
965    while [[ "$line" != "" ]]
966    do
967       column1=""
968       column2=$line
969       printf "| $column1$column2 | \n"
970       line=$(echo "$line" | cut -c51-)
971    done
972    column1="loader options:"; column2=$loader_options
973    printf "| $column1$column2 | \n"
974    line=$(echo "$loader_options" | cut -c51-)
975    while [[ "$line" != "" ]]
976    do
977       column1=""
978       column2=$line
979       printf "| $column1$column2 | \n"
980       line=$(echo "$line" | cut -c51-)
981    done
982    printf "#------------------------------------------------------------------------# \n"
983
984    if [[ $silent = false ]]
985    then
986       answer=dummy
987       printf "\n\n"
988       while [[ "$answer" != y  &&  "$answer" != Y  && "$answer" != c  &&  "$answer" != C  && "$answer" != s  &&  "$answer" != S  &&  "$answer" != a  &&  "$answer" != A ]]
989       do
990          printf " >>> continue (y(es)/c(ontinue)/a(bort)/s(skip)) ?  "
991          read  answer
992       done
993       if [[ $answer = a  ||  $answer = A ]]
994       then
995          locat=user_abort; exit
996       fi
997       if [[ $answer = c  ||  $answer = C ]]
998       then
999          silent=false
1000       fi
1001       if [[ $answer = s  ||  $answer = S ]]
1002       then
1003          continue
1004       fi
1005    fi
1006
1007
1008    if [[ $remote_mode = batch ]]
1009    then
1010
1011          # BATCH-JOB PARAMETER SETZEN
1012       case  $remote_host  in
1013           (t3eb)           queue=berte; memory=60; cputime=1000; xoption="-X 0";;
1014           (t3eh)           queue=comp_t3e; memory=60; cputime=360;;
1015           (t3ej2)          queue=normal; memory=60; cputime=1000; xoption="-X 0";;
[5]1016           (t3ej5|ground.yonsei.ac.kr)  printf "\n  --- remote host \"$remote_host\" does not allow batch jobs"; continue;;
[1]1017       esac
1018
1019
1020          # BATCH-JOB ZUSAMMENSTELLEN
1021       printf "\n  *** creating batch-job for remote host"
1022       echo " "  >  mbuild_job
1023
1024          # AUF CRAY-RECHNERN IN JUELICH WIRD KEIN BENUTZER-PROFILE AUSGEFUEHRT
1025          # DIES WIRD HIER GETAN, UM PFADE USW. ZU SETZEN
1026       if [[ $remote_host = t3ej2 ]]
1027       then
1028          echo "set +vx"                       >>  mbuild_job
1029          echo ". .profile"                    >>  mbuild_job
1030          echo "set -x"                        >>  mbuild_job
1031       fi
1032
1033          # AUF CRAY-RECHNERN GELADENE MODULE AUFLISTEN
1034       if [[ $host = t3eb  || $host = t3eh  ||  $host = t3ej2 ]]
1035       then
1036          echo "module list"                   >>  mbuild_job
1037       fi
1038
1039
1040          # WECHSEL IN TEMPORAERES VERZEICHNIS
1041       echo "cd ${remote_md}"  >>  mbuild_job
1042
1043
1044          # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN
1045       echo  "scp  ${local_username}@${local_addres}:~/modell/code_3dp/palm_current_version/${mainprog}_sources.tar  ${mainprog}_sources.tar"  >>  mbuild_job
1046#       echo  "[[ \$? != 0 ]]  &&  (echo "+++ scp failed"; exit)"  >>  mbuild_job
1047
1048
1049          # FALLS VORHANDEN, LETZTE VERSION AUF DEM REMOTE-RECHNER AUSPACKEN
1050       echo  "[[ -f ${mainprog}_current_version.tar ]]  &&  tar -xvf  ${mainprog}_current_version.tar"  >>  mbuild_job
1051
1052
1053          # AKTUELLE QUELLTEXTVERSION AUF REMOTE-RECHNER AUSPACKEN
1054       echo  "tar -xvf  ${mainprog}_sources.tar"              >>  mbuild_job
1055
1056
1057          # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN
1058       echo  "make  PROG=$mainprog  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "  >>  mbuild_job
1059       echo  "chmod  u+w  *"                                  >>  mbuild_job
1060
1061          # NEUE VERSION AUF REMOTE-RECHNER ZUSAMMENPACKEN
1062       echo  "tar -cvf  ${mainprog}_current_version.tar  *.f90  *.o"  >>  mbuild_job
1063
1064
1065          # AKTUELLES VERSIONSVERZEICHNIS AUF REMOTE-RECHNER BEREINIGEN
1066       echo  "make  clean"                                    >>  mbuild_job
1067       echo  "rm ${mainprog}_sources.tar"                     >>  mbuild_job
1068       echo  "rm *.f90 Makefile"                              >>  mbuild_job
1069
1070
1071
1072          # JOB MITTELS SUBJOB STARTEN
1073       printf "\n  *** sending batch job to remote host"
1074#       subjob  $xoption  -h $remote_host  -q $queue  -m $memory  -t $cputime  -v  mbuild_job
1075
1076
1077          # JOBFILE LOESCHEN
1078#       rm  aljob
1079
1080    else
1081
1082       if [[ $remote_host != $local_host ]]
1083       then
1084
1085             # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN
1086             # FALLS DIESES NOCH NICHT EXISTIERT, WIRD ES ERZEUGT
1087          echo "  *** copying \"${mainprog}_sources.tar\" to \"${remote_addres}:${remote_md}/\" "
1088          if [[ $remote_host != lctit ]]
1089          then
1090             ssh  ${remote_username}@${remote_addres} "[[ ! -d ${remote_md} ]]  &&  (echo \"  *** ${remote_md} will be created\"; mkdir -p  ${remote_md})"
1091          else
1092                # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
1093                # MIT SSH, DESHALB AUFRUF PER PIPE
1094             print "[[ ! -d ${remote_md} ]]  &&  (echo \"  *** ${remote_md} will be created\"; mkdir -p  ${remote_md})"  |  ssh ${remote_username}@${remote_addres}  2>&1
1095          fi
1096          if [[ $local_host = decalpha ]]
1097          then
1098                # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTÄNDIGEN PFADES
1099                # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM
1100                # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN
1101             remote_md=`echo $remote_md | sed 's/\$HOME\///'`
1102             /bin/scp  ${mainprog}_sources.tar  ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar
1103          else
1104             scp  ${mainprog}_sources.tar  ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar
1105          fi
1106
1107
1108
1109             # FALLS VORHANDEN, LETZTE VERSION AUF DEM REMOTE-RECHNER AUSPACKEN
1110          echo "  *** untar previous update on remote host, if existing"
1111          if [[ $remote_host != lctit ]]
1112          then
1113             ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]]  &&  tar -xf  ${mainprog}_current_version.tar"
1114          else
1115                # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
1116                # MIT SSH, DESHALB AUFRUF PER PIPE
1117             print  "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]]  &&  tar -xf  ${mainprog}_current_version.tar"  |  ssh  ${remote_username}@${remote_addres}  2>&1
1118          fi
1119
1120
1121             # AKTUELLE QUELLTEXTVERSION AUF REMOTE-RECHNER AUSPACKEN
1122          echo "  *** untar actual sources on remote host"
1123          if [[ $remote_host != lctit ]]
1124          then
1125             ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; tar -xf  ${mainprog}_sources.tar"
1126          else
1127                # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
1128                # MIT SSH, DESHALB AUFRUF PER PIPE
1129             print  "cd ${remote_md}; tar -xf  ${mainprog}_sources.tar"  |  ssh  ${remote_username}@${remote_addres}  2>&1
1130          fi
1131
1132
1133             # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN
1134             # KOMMANDOUEBERGABE AN SSH PER PIPE, DA SO DIE SYSTEM- UND
1135             # BENUTZERPROFILE VOLLSTAENDIG AUSGEFUEHRT WERDEN (SONST FEHLEN MAKE
1136             # Z.B. DIE PFADE ZUM COMPILER)
1137          echo "  *** execute \"make\" on remote host"
1138
1139          if [[ $remote_host = nech ]]
1140          then
1141             make_call_string="sxmake  PROG=$mainprog  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
1142          else
1143             make_call_string="make  PROG=$mainprog  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
1144          fi
1145
1146          if [[ $remote_host = t3eh ]]
1147          then
1148       
1149             print "xterm\nexit\n cd ${remote_md}; make  PROG=$mainprog  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" " | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
1150
1151          elif [[ $remote_host = t3ej2  ||  $remote_host = ibms  ||  $remote_host = ibmy ]]
1152          then
1153
1154             ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; echo '$make_call_string' > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" 2>&1 | tee ${remote_host}_last_make_protokoll
1155
1156          elif [[ $remote_host = ibmb  ||  $remote_host = ibmh ]]
1157          then
1158
1159             print "export OBJECT_MODE=64; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
1160
1161          elif [[ $remote_host = lctit ]]
1162          then
1163
1164             echo  " "  >  ${remote_host}_last_make_protokoll
1165             while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]]
1166             do
1167                print "cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
1168             done
1169
1170          else
1171
1172             print "cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
1173
1174          fi
1175
1176          if [[ $(grep -c MAKE_ERROR ${remote_host}_last_make_protokoll) != 0 ]]
1177          then
1178             printf "\a\n  +++ error(s) occurred during compiling or linking on host \"$remote_host\" "
1179             if [[ $silent = false ]]
1180             then
1181                answer=dummy
1182                printf "\n"
1183                while [[ "$answer" != c  &&  "$answer" != k ]]
1184                do
1185                   printf "  >>> continue / list errors / kill mbuild (c/l/k) ? "
1186                   read  answer
1187                   if [[ "$answer" = l ]]
1188                   then
1189                      more ${remote_host}_last_make_protokoll
1190                   fi
1191                done
1192                if [[ $answer = k ]]
1193                then
1194                   locat=user_abort; exit
1195                fi
1196             fi
1197          fi
1198
1199
1200
1201             # NEUE VERSION AUF REMOTE-RECHNER ZUSAMMENPACKEN
1202          printf "\n  *** tar update on remote host ..."
1203          if [[ $remote_host != lctit ]]
1204          then
1205             ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; chmod u+w *; tar -cf  ${mainprog}_current_version.tar  *.f90 *.o *.mod"
1206          else
1207                # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
1208                # MIT SSH, DESHALB AUFRUF PER PIPE
1209             print  "cd ${remote_md}; chmod u+w *; tar -cf  ${mainprog}_current_version.tar  *.f90 *.o *.mod"  |  ssh  ${remote_username}@${remote_addres}  2>&1
1210          fi
1211
1212
1213             # AKTUELLES VERSIONSVERZEICHNIS AUF REMOTE-RECHNER BEREINIGEN
1214#          printf "\n  *** \"make clean\" on remote host ..."
1215#          ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; make clean; rm ${mainprog}_sources.tar; rm *.f90 Makefile"
1216#          printf "\n"
1217
1218
1219             # NUR AUF EINEM HLRN-RECHNER UEBERSETZEN
1220          [[ $remote_host = ibmb  ||  $remote_host = ibmh ]]  &&  ibm_hb_done=true
1221
1222       else
1223
1224             # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF LOKALEM RECHNER AUSFUEHREN
1225          echo "  *** execute \"make\" on local host"
1226
1227          make  PROG=$mainprog  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$loader_options"  2>&1 | tee ${remote_host}_last_make_protokoll
1228
1229          if [[ $? != 0 ]]
1230          then
1231             printf "\a\n  +++ error(s) occurred during compiling or linking on host \"$remote_host\" "
1232             if [[ $silent = false ]]
1233             then
1234                answer=dummy
1235                printf "\n"
1236                while [[ "$answer" != c  &&  "$answer" != k ]]
1237                do
1238                   printf "  >>> continue / list errors / kill mbuild (c/l/k) ? "
1239                   read  answer
1240                   if [[ "$answer" = l ]]
1241                   then
1242                      more ${remote_host}_last_make_protokoll
1243                   fi
1244                done
1245                if [[ $answer = k ]]
1246                then
1247                   locat=user_abort; exit
1248                fi
1249             fi
1250          fi
1251
1252
1253             # NEUE VERSION AUF LOKALEM RECHNER ZUSAMMENPACKEN
1254          printf "\n  *** tar update on local host ..."
1255          tar -cf  ${mainprog}_current_version.tar  *.$suf *.o *.mod
1256
1257             # NUR EINMAL AUF LCMUK UEBERSETZEN
1258          [[ $remote_host = lcmuk ]]  &&  lcmuk_done=true
1259
1260       fi
1261
1262    fi
1263 done
1264
1265
1266 if [[ $host_found = false ]]
1267 then
1268    if [[ $host = all ]]
1269    then
1270       printf "\n  +++ no hosts found in configuration file"
1271    else
1272       printf "\n  +++ host \"$host\" not found in configuration file"
1273    fi
1274    locat=config_file; exit
1275 fi
1276
1277
1278
1279    # ABSCHLIESSENDE ARBEITEN
1280 rm -f  hosts_found_in_config_file
1281
Note: See TracBrowser for help on using the repository browser.