Initial add of defaria.com
[clearscm.git] / defaria.com / Computers / code / bin / upgrade
1 #!/bin/bash
2 # Upgrade Clearcase or Clearquest
3 me=$(basename $0)
4 rational_network_install_area="//sons-clearcase/Rational/Clearcase LT/install"
5 rational_network_install_area2="//sons-clearcase/Rational"
6 errorlog="$(cygpath -w $TMP)/error.log"
7
8 function usage {
9   echo "Usage $me [clearcase | clearcaselt | clearquest]"
10   exit 1
11 } # usage
12
13 if [ $# -ne 1 ]; then
14   usage
15 fi
16
17 product=$(echo $1 | tr [:upper:] [:lower:])
18
19 if [ "$product" != "clearcase"  -a \
20      "$product" != "clearquest" -a \
21      "$product" != "clearcaselt" ]; then
22   usage
23 fi
24
25 if [ "$product" = "clearcase" ]; then
26   rational_network_install_area="$rational_network_install_area2"
27 fi
28   
29
30 echo "$product upgrade"
31 echo
32 echo "WARNING: Installation of this software requires a reboot!"
33 echo "Please make sure that you save any data before proceeding!"
34 echo
35
36 response=""
37 while [ "$response" != "y" -a "$response" != "n" ]; do
38   echo -e "Continue with installation (Y/n)? \c"
39   read response
40   response=$(echo $response | tr [:upper:] [:lower:])
41 done
42
43 if [ "$response" = "y" ]; then
44   install_dir="$rational_network_install_area"
45   if [ "$product" != "clearcase" ]; then
46     install_dir="$install_dir/setup"
47   fi
48   if [ ! -d "$install_dir" ]; then
49     echo "Error: Unable to find installation area: $install_dir"
50     exit 1
51   fi
52   cd "$install_dir"
53   echo "Performing silent installation of $product..."
54   if [ "$product" = "clearcase" ]; then
55     setup /noccdoc /s /f1.\\$product.iss /f2"$errorlog"
56   else
57     rssetup -silent -response:.\\$product.ini
58   fi
59 else
60   echo "Installation of $product aborted"
61 fi