Debian Codegraph @

install/unix/update

raw symbols SCIP
1 #! /bin/sh
2 #% @(#)update.sh 19.1 (ESO-IPG) 02/25/03 13:51:12
3 # .COPYRIGHT: Copyright (c) 1988 European Southern Observatory,
4 # all rights reserved
5 # .TYPE command
6 # .NAME update.sh
7 # .LANGUAGE shell script
8 # .ENVIRONMENT Unix Systems. Executable under SHELL and C-SHELL
9 # .COMMENTS Updating procedure of the MIDAS system.
10 # The MIDAS system is installed with the "install"
11 # command and is executed just once. Henceforth, the
12 # system will be updated for any modification with the
13 # "update" command.
14 #
15 # Usage: update [options]
16 #
17 # options: are options for the "make" command. This option
18 # will be exported to all the directories of the
19 # update procedure.
20 # Multiple definitions for keywords must be:
21 # e.g. CFLAGS=\"-O -g -I/usr/include\"
22 # to avoid quotes to be interpreted by the shell.
23 #
24 # The command executes the following steps:
25 #
26 # - $MIDASHOME/$MIDVERS/local/make_options is read if exists.# It contains local options for "make" commands.a
27 #
28 #
29 # - MIDAS is structured in "core" (all directories
30 # in file "core.cnf" are included in the installation).
31 # and "packages" (optional, they are clasified in
32 # "applic", "stdred" and "contrib".) A package is
33 # selected for installation if it is marked with file
34 # "SELECTED".
35 #
36 # - Running "make options" in all the directories updating
37 # only those files involved in the update.
38 #
39 # .AUTHOR Carlos Guirao
40 # .VERSION 3.1 910725: New implementation.
41
42 umask 002
43 #
44 # First of all, goto the config directory adn
45 # <dirname> & <basename> commands emulated with <sed>
46 # cd `dirname $0`
47 # MIDVERS=`basename $VERSDIR`
48 # MIDASHOME=`dirname $VERSDIR`
49 #
50 if [ -z "$MIDASHOME" -o -z "$MIDVERS" ] ; then
51 cd `echo $0 | sed -e 's/[^\/]*$//' -e 's/^$/./' -e 's/\/$//'`
52 MID_INSTALL=`pwd`
53 VERSDIR=`echo $MID_INSTALL | sed 's/\/install\/unix$//'`
54 MIDVERS=`echo $VERSDIR | sed -e 's/^.*\///'`
55 MIDASHOME=`echo $VERSDIR | sed -e 's/[^\/]*$//' -e 's/^$/./' -e 's/\/$//'`
56 else
57 cd $MIDASHOME/$MIDVERS/install/unix
58 fi
59
60 MID_INSTALL=$MIDASHOME/$MIDVERS/install/unix
61 MID_HOME=$MIDASHOME/$MIDVERS
62
63 #
64 # Local options for makes commands will be read if they exits in the
65 # make_options file, from the local directory.
66 # Other options can be set in the command line of this script as the
67 # second parameter: $2. These option will replace those local option with
68 # the same name
69 #
70 if [ -r $MID_HOME/local/make_options ]
71 then
72 echo ""
73 echo "*************************************************"
74 echo "********* READING YOUR LOCAL OPTIONS ************"
75 echo "*************************************************"
76 echo ""
77 cat $MID_HOME/local/make_options | awk -F# '{print $1}'
78 echo ""
79 fi
80
81 echo "*********************************************************************"
82 echo "******************** MIDAS UPDATING PROCEDURE ***********************"
83 echo "*********************************************************************"
84 echo "******************** MIDASHOME: $MIDASHOME VERSION: $MIDVERS"
85 echo "******************** DATE: `date`"
86 echo "******************** COMMAND: $0 $*"
87
88 for dir in `awk -F# '{ print $1 }' $MID_INSTALL/core.cnf`
89 do
90 echo ""
91 echo "**********************************************"
92 echo "****** UPDATING IN $dir"
93 echo "**********************************************"
94 echo "****** DATE: `date`"
95 if [ ! -d $MID_HOME/$dir ]; then
96 echo "Warning. $dir .No such directory."
97 continue
98 fi
99 cd $MID_HOME/$dir
100 eval make "$@" all
101 done
102
103 for categ in applic stdred contrib gui
104 do
105 if [ ! -d $MID_HOME/$categ ]; then
106 continue
107 fi
108 cd $MID_HOME/$categ
109 first_packages=`(ls */SELECTED_BY* | awk -F/ '{print $1}' | sort -u) 2>/dev/null`
110 if [ -n "$first_packages" ]; then
111 excluded=`echo $first_packages | sed -e 's/^/\^/' -e 's/$/\$/' -e 's/ /\$|\^/g'`
112 packages=`(ls */SELECTED | awk -F/ '{print $1}' | grep -E -v "$excluded") 2>/dev/null`
113 else
114 packages=`(ls */SELECTED | awk -F/ '{print $1}') 2>/dev/null`
115 fi
116 for pack in $first_packages $packages
117 do
118 for dir in etc libsrc src proc help
119 do
120 if [ -f $pack/$dir/makefile ]; then
121 echo ""
122 echo "**********************************************"
123 echo "****** UPDATING IN ./$categ/$pack/$dir"
124 echo "**********************************************"
125 cd $pack/$dir
126 eval make "$@" all
127 cd $MID_HOME/$categ
128 fi
129 done
130 done
131 done
132 cd $MID_HOME
133
134 echo ""
135 echo "*********************************************************************"
136 echo "************************ END UPDATING PROCEDURE *********************"
137 echo "*********************************************************************"
138 echo "********** END DATE: `date`"