home *** CD-ROM | disk | FTP | other *** search
/ ftp.sberbank.sumy.ua / 2014.11.ftp.sberbank.sumy.ua.tar / ftp.sberbank.sumy.ua / incoming / sxtech / eq_update.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2014-08-29  |  4KB  |  174 lines

  1. #!/bin/sh
  2.  
  3. # Copyright 1999-2003 Coyote Point Systems Inc.
  4. # All Rights reserved.
  5.  
  6. # $Revision: #4 $
  7.  
  8. # eq_update.sh
  9. # Update Equalizer firmware
  10. #
  11.  
  12. dosnmp=""
  13. reboot=""
  14. batch=""
  15. keys=""
  16. clear=""
  17. lic=""
  18. dash_b=0
  19. gui=""
  20. dash_G=0
  21. upgrade_fw=""
  22.  
  23. args=$(getopt 'bkCGl' $*)
  24. errcode=$?
  25. set -- $args
  26. for i; do
  27.     case "$i" in
  28.     -b)
  29.         batch='-b'
  30.         dash_b=1
  31.         ;;
  32.     -k)
  33.         keys='-k'
  34.         ;;
  35.     -C)
  36.         clear='-C'
  37.         ;;
  38.     -l)
  39.         lic='-l'
  40.         ;;
  41.     -G)
  42.         gui='-G'
  43.         dash_G=1
  44.             echo 'x' > /var/tmp/eq_upgrade.in
  45.         exec 1>>/var/log/eq_upgrade.log
  46.         ;;
  47.     esac
  48. done
  49.  
  50. case $(id -u) in
  51.    0)
  52.     ;;
  53.    *)
  54.     echo This script must be run as root.
  55.     exit 1
  56.     ;;
  57. esac
  58.  
  59. echo
  60. echo Equalizer upgrade - Product: *combined* Version: 8.6.0 
  61. echo
  62. echo This script will upgrade the Equalizer software on this platform
  63. echo to the above revision.
  64. echo
  65. echo
  66. echo Do not interrupt while in progress. Upon completion the
  67. echo Equalizer must be rebooted.
  68. echo
  69. echo "************* Note: SSH v1 has login support has been disabled"
  70. echo "************* beginning with Equalizer software version 8.5."
  71. echo
  72. echo "************* Note: All FDISK slices other than the current"
  73. echo "************* active ones will be deleted."
  74. echo 
  75.  
  76. /usr/bin/perl -w -mCarp ./check_sw_fw.pl $gui
  77. if [ $? != 0 ] ; then
  78.     upgrade_fw='-F'
  79. fi
  80.  
  81. if [ $dash_b != 0 ] ; then
  82.     echo -n 'Proceed? [y/n] '
  83.     echo ' YES'
  84.     ans="y"
  85. else
  86.     if [ $dash_G != 0 ] ; then
  87.         echo 'Proceed? [y/n]'
  88.         ans='x'
  89.         while [ "$ans" = "x" ]; do
  90.         sleep 1
  91.             read ans < /var/tmp/eq_upgrade.in
  92.     done
  93.         echo 'x' > /var/tmp/eq_upgrade.in
  94.     else
  95.         echo -n 'Proceed? [y/n] '
  96.         read ans
  97.     fi
  98. fi
  99.  
  100. if [ "$ans" = "Y" ]; then    # smash case so we take either 'Y' or 'y'
  101.     ans="y"
  102. fi
  103.  
  104. if [ "$ans" != "y" ]; then
  105.     echo Aborting upgrade. 
  106.     if [ $dash_G = 0 ] ; then
  107.         echo Run this script from this directory
  108.         echo at a later time to update Equalizer
  109.     fi    
  110.         echo abort >> /var/log/eq_update.log
  111.     exit 1
  112. fi
  113.  
  114. reboot="";
  115. plat=$(lm -p)
  116. hw=$(lm -h | awk '{ print substr($0, 0, 6) }')
  117.  
  118. if [ "$plat" = "e450" -o "$plat" = "e550" -o "$plat" = "e650" ]; then
  119.     dosnmp="-S"
  120. fi
  121.  
  122. # The 350gx gets an SNMP license
  123. if [ "$hw" = "e350gx" ]; then 
  124.     dosnmp="-S"
  125. fi
  126.  
  127. #
  128. # Likewise, if SNMP is already installed then we automatically
  129. # install it.  This is for some special case customers who have
  130. # licensed SNMP but are not using e450s.
  131. #
  132.  
  133. if [ -e /var/eq/snmpd.cnf ]; then
  134.     dosnmp="-S"
  135. fi
  136.  
  137. if [ "$ans" = "SNMP" ]; then
  138.  
  139.     echo "WARNING: You have specified installation of the SNMP agent and"
  140.     echo "subagent. Please be aware that these components are provided"
  141.     echo "only to authorized licensees. If you are uncertain about your"
  142.     echo "license status, please contact Coyote Point at +1(408)291-5240"
  143.     echo "or email info@coyotepoint.com. If you are licensed to install"
  144.     echo "SNMP, type 'y' below, otherwise please type 'n'."
  145.     if [ $dash_G != 0 ] ; then
  146.         echo "Continue installing SNMP? [y/n]"
  147.         ans='x'
  148.         while [ "$ans" = "x" ]; do
  149.         sleep 1
  150.             read ans < /var/tmp/eq_upgrade.in
  151.     done
  152.         echo 'x' > /var/tmp/eq_upgrade.in
  153.     else
  154.         echo -n "Continue installing SNMP? [y/n]"
  155.         read ans
  156.     fi    
  157.  
  158.     if [ "$ans" = "y" -o "$ans" = "Y" ]; then
  159.       dosnmp="-S"
  160.     fi
  161. fi
  162.  
  163. #
  164. # If we're not installing snmp, then remove the tarball from the system right now.
  165. #
  166.  
  167. if [ ! "$dosnmp" ]; then
  168.     [ -e ./snmp.tgz ] && rm ./snmp.tgz
  169. fi
  170.  
  171. /usr/bin/perl -w -mCarp /usr/l7up/l7up.pl -X
  172. /usr/bin/perl -w -mCarp /usr/l7up/l7up.pl $batch $keys $dosnmp $reboot $clear $gui $upgrade_fw $lic
  173.  
  174.