Debian Codegraph @

install/unix/update1

raw symbols SCIP
1 #! /bin/bash
2 # .COPYRIGHT: Copyright (c) 1988-2011 European Southern Observatory,
3 # all rights reserved
4 # .TYPE command
5 # .NAME update1.sh
6 # .LANGUAGE shell script
7 # .ENVIRONMENT Unix Systems. Executable under SHELL and C-SHELL
8 # .COMMENTS Installation procedure of the MIDAS system starting from
9 # scratch.
10 # Usage: install1 system [options]
11 #
12 # .AUTHOR Carlos Guirao
13 # .VERSION 3.1 910724: New implementation.
14 # 111206 last modif
15
16 echo=echo
17 if [ "`echo -n`" = "-n" ] ; then
18 SV_NONL="\c"
19 else
20 echo="echo -n"
21 fi
22
23 #
24 # First of all, goto the config directory adn
25 # <dirname> & <basename> commands emulated with <sed>
26 # cd `dirname $0`
27 # MIDVERS=`basename $VERSDIR`
28 # MIDASHOME=`dirname $VERSDIR`
29 #
30 if [ -z "$MIDASHOME" -o -z "$MIDVERS" ] ; then
31 cd `echo $0 | sed -e 's/[^\/]*$//' -e 's/^$/./' -e 's/\/$//'`
32 MID_INSTALL=`pwd`
33 VERSDIR=`echo $MID_INSTALL | sed 's/\/install\/unix$//'`
34 MIDVERS=`echo $VERSDIR | sed -e 's/^.*\///'`
35 MIDASHOME=`echo $VERSDIR | sed -e 's/[^\/]*$//' -e 's/^$/./' -e 's/\/$//'`
36 else
37 cd $MIDASHOME/$MIDVERS/install/unix
38 fi
39
40 MID_INSTALL=$MIDASHOME/$MIDVERS/install/unix
41 MID_HOME=$MIDASHOME/$MIDVERS
42
43 cd $MID_INSTALL
44
45 clear
46 if [ ! -f "$MID_HOME/local/default.mk" ] ; then
47 echo "*** ERROR: File <$MID_HOME/local/default.mk> does not exist."
48 echo "*** You need to run <preinstall> before continuing with <update>"
49 exit 1
50 fi
51
52 if [ ! -f "$MID_HOME/local/make_options" ] ; then
53 touch $MID_HOME/local/make_options
54 fi
55
56 echo ""
57 echo "MIDAS UPDATE PROCEDURE"
58 echo "======================"
59 echo "MIDASHOME: $MIDASHOME"
60 echo "MIDVERS: $MIDVERS"
61 echo "MAKE_OPTIONS:"
62 awk -F# '{ if ($1 != "") {printf "\t %s\n",$1} }' $MID_HOME/local/make_options
63 echo ""
64 echo "NOTE: Update will only compile and link those files and"
65 echo " executables not updated in previous installation"
66 echo " It will run in background and the output will be sent to"
67 echo " the file <$MID_HOME/tmp/update.$$>"
68 echo ""
69 $echo "Do you want to continue [yn]? (y): " $SV_NONL
70 read answ
71 if [ -z "$answ" ]; then
72 answ=y
73 fi
74 if [ "$answ" != "y" -a "$answ" != "Y" ]
75 then
76 echo "Bye"
77 exit 0
78 fi
79
80 #
81 # If $MID_HOME/tmp does not exists then creates it.
82 #
83 if [ ! -d $MID_HOME/tmp ]; then
84 mkdir $MID_HOME/tmp
85 fi
86
87 time /bin/bash $MID_INSTALL/update -i > $MID_HOME/tmp/update.$$ 2>&1 &
88 echo "Running update in background"
89 echo "Results are coming in $MID_HOME/tmp/update.$$"