home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 December / Chip_2000-12_cd1.bin / tema / starof / f_0000 / sopatchlevel.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  2000-05-10  |  2KB  |  109 lines

  1. #!/bin/sh
  2. #
  3. # StarOffice patch checking script
  4. # (c) 2000, Sun Microsystems Inc.
  5.  
  6. sd_inst="`dirname "$0"`"
  7. sd_platform=`uname -s`
  8.  
  9. if [ "$sd_platform"="SunOS" ]; then
  10.     #
  11.     # check required patchid
  12.     #
  13.  
  14.  
  15.     sd_hardware=`uname -p`
  16.     sd_release=`uname -r`
  17.     required_patch=
  18.  
  19.     case $sd_hardware in
  20.     i386)
  21.         case $sd_release in
  22.             5.5.1)
  23.             required_patch=106530
  24.             required_minor=5
  25.             ;;
  26.             5.6)
  27.             required_patch=104678
  28.             required_minor=5
  29.             ;;
  30.             5.7)
  31.             required_patch=106328
  32.             required_minor=6
  33.             ;;
  34.             5.8)
  35.             required_patch=
  36.         ;;
  37.         esac
  38.         ;;
  39.     sparc)
  40.         case $sd_release in
  41.             5.5.1)
  42.             required_patch=106529
  43.             required_minor=5
  44.             ;;
  45.             5.6)
  46.             required_patch=105591
  47.             required_minor=6
  48.             ;;
  49.             5.7)
  50.             required_patch=106327
  51.             required_minor=5
  52.             ;;
  53.             5.8)
  54.             required_patch=
  55.         ;;
  56.         esac
  57.     esac
  58.  
  59.     #
  60.     # if no patch is required we are done
  61.     #
  62.  
  63.  
  64.     if [ "$required_patch" = "" ]; then
  65.         exit 0
  66.     fi
  67.  
  68.     #
  69.     # check prerequesites
  70.     #
  71.  
  72.     if [ ! -x /usr/bin/awk ]; then
  73.         exit 0
  74.     fi
  75.  
  76.     #
  77.     # check installed patches
  78.     #
  79.  
  80.     patch_installed=`"$sd_inst"/sorev -l SUNWlibC | /usr/bin/awk \
  81.         '{ \
  82.             if ($1 == "Patch:") { \
  83.                 split($2, inst_patch, "-"); \
  84.                 if (inst_patch[1] == required_patch) { \
  85.                     if ((inst_patch[2]+1) >= (1+required_minor)){ \
  86.                         print "done"; exit 0; \
  87.                     } \
  88.                 } \
  89.              } \
  90.             if ($3 == "Obsoletes:") { \
  91.                 split($4, inst_patch, "-"); \
  92.                 if (inst_patch[1] == required_patch) { \
  93.                     if ((inst_patch[2]+1) >= (1+required_minor)){ \
  94.                         print "done"; exit 0; \
  95.                     } \
  96.                 } \
  97.              } \
  98.         }' required_patch=$required_patch required_minor=$required_minor `
  99.  
  100.     if [ "$patch_installed" = "done" ]; then
  101.         exit 0
  102.     else
  103.         echo "Please install the patch 'Shared library patch for C++ (Version 5)' or contact your system administrator"
  104.         exit 1
  105.     fi
  106. fi
  107.  
  108. exit 0
  109.