home *** CD-ROM | disk | FTP | other *** search
/ ftp.rsa.com / 2014.05.ftp.rsa.com.tar / ftp.rsa.com / pub / agents / old_AuthenticationAgent_534_PAM.tar / uninstall_pam.sh < prev   
Linux/UNIX/POSIX Shell Script  |  2005-06-29  |  6KB  |  190 lines

  1. #!/bin/sh
  2. #
  3. # Installation script for the RSA Authentication Agent 5.3 for PAM.
  4. #
  5. #
  6. #********************************************************************************
  7. #* COPYRIGHT (C) 2003  by RSA Security Inc.
  8. #*      ---ALL RIGHTS RESERVED---
  9. #********************************************************************************
  10. #
  11. echo_no_nl_mode="unknown"
  12. UNAME=`uname`
  13. UNAMER=`uname -r`
  14. MODULE_DIR="/usr/lib/security"
  15. PAM_AGENT_MODULE="pam_securid"
  16.  
  17. ##############################################################################
  18. # Trap
  19. #       this will trap any escape characters, and allow the program to abort normally
  20. #       by calling abort_installation
  21. ##############################################################################
  22. trap 'trap "" 1 2 15; abort_installation' 1 2 15
  23.  
  24. ##############################################################################
  25. # abort_installation()
  26. # This subroutine removes files that were recently installed and restores
  27. # the previous installation files, if they existed.
  28. ##############################################################################
  29. abort_installation()
  30. {
  31. #CP__need to fix this when done. Make sure to set values for each file placed somewhere
  32. echo ""
  33.   echo "Aborting Un-install"
  34.  
  35.   exit 1
  36. }
  37.  
  38. ##############################################################################
  39. # echo_no_nl()
  40. #       Echo a string with no carriage return (if possible).  Must set
  41. #       $echo_no_nl to "unknown" before using for the first time.
  42. ##############################################################################
  43. echo_no_nl()
  44. {
  45.   if [ "$echo_no_nl_mode" = "unknown" ] ; then
  46.      echo_test=`echo \\\c`
  47.      if [ "$echo_test" = "\c" ] ; then
  48.         echo_no_nl_mode="-n"
  49.      else
  50.         echo_no_nl_mode="\c"
  51.      fi
  52.   fi
  53.  
  54.   if [ "$echo_no_nl_mode" = "\c" ] ; then
  55.      echo $* \\c
  56.   else
  57.      echo -n $*
  58.   fi
  59. }
  60.  
  61. ##############################################################################
  62. # getyesorno()
  63. # Gets either a "yes" or a "no" in the traditional (y/n) pattern
  64. #               $1      The default value if user hits <Enter> (TRUE/FALSE)
  65. #               $2      The string to print to prompt the user
  66. # The variable $YESORNO is set in accordance to what the user entered.
  67. ##############################################################################
  68. getyesorno()
  69. {
  70. #####################################################
  71. # Set up line parameters as $1 and $2 are overwritten
  72. #####################################################
  73.   yesornodef=$1
  74.   yesornoprompt=$2
  75.  
  76.   YESORNO=""
  77.   until [ -n "$YESORNO" ] ;
  78.   do
  79.     echo ""
  80.     echo_no_nl $yesornoprompt
  81.     read YESORNO
  82.  
  83.     case "$YESORNO"
  84.     in
  85.       y|Y )  YESORNO=TRUE;;
  86.       n|N )  YESORNO=FALSE;;
  87.       ''  )  YESORNO=$yesornodef;;
  88.       *   )  echo ""
  89.              echo "Please enter 'y', 'n' or '<return>' "
  90.              YESORNO="";;
  91.     esac
  92.   done
  93.  
  94. }
  95.  
  96. check_user()
  97. {
  98. #########################
  99. # make sure user is root
  100. #########################
  101.  
  102.  
  103. if [ "$USER_NAME" != root ]; then
  104.     echo "You Must be ROOT to uninstall this agent"
  105.     abort_installation
  106. fi
  107. }
  108.  
  109. ############################################################
  110. # Check to see if this is a supported platform.
  111. ############################################################
  112. check_platform()
  113. {
  114. case $UNAME
  115.    in
  116.      'SunOS'  )  SUN_VERS=`echo $UNAMER `
  117.                case "$SUN_VERS" in
  118.                * )
  119.                     WHOAMISOL=`/usr/ucb/whoami`
  120.                     OS_DIR="sol"
  121.                     OS_EXT="so"
  122.                     USER_NAME=`echo $WHOAMISOL`;;
  123.         esac;;
  124.  
  125.      'Linux' ) LNX_VERS=`echo $UNAMER `
  126.                 case "$LNX_VERS" in
  127.                 * )
  128.                     WHOAMILNX=`/usr/bin/whoami`
  129.                     OS_DIR="lnxas3"
  130.                     OS_EXT="so"
  131.                     MODULE_DIR="/lib/security"
  132.                     USER_NAME=`echo $WHOAMILNX`;;
  133.                 esac;;
  134.      'HP-UX' ) HP_VERS=`echo $UNAMER`
  135.                case "$HP_VERS" in
  136.                * )
  137.                    WHOAMIHP11=`/bin/whoami`
  138.                    OS_DIR="hp11"
  139.                    OS_EXT="1"
  140.                    USER_NAME=`echo $WHOAMIHP11`;;
  141.                esac;;
  142.      'AIX' ) AIX_VERS=`uname -vr | awk '{print $2 * 1000 + $1}'`
  143.                 case "$AIX_VERS" in
  144.                 *)
  145.                     OS_DIR="aix"
  146.                     OS_EXT="so";
  147.                     USER_NAME=`/usr/bin/whoami`
  148.                 esac;;
  149.      *   )  echo ""
  150.             echo "Sorry, $UNAME is not currently supported."
  151.             echo ""
  152.             abort_installation ;;
  153. esac
  154. }
  155.  
  156. uninstall()
  157. {
  158.     rm -r bin
  159.     rm -r lib
  160.     rm -r doc
  161.     rm /etc/sd_pam.conf
  162. if [ "$OS_DIR" = "sol"  ] ; then
  163.     rm /usr/lib/security/pam_securid.so
  164. elif [ "$OS_DIR" = "lnxas3" ] ; then
  165.     rm /lib/security/pam_securid.so
  166. elif [ "$OS_DIR" = "hp11" ] ; then
  167.     rm /usr/lib/security/pam_securid.1
  168. elif [ "$OS_DIR" = "aix" ] ; then
  169.     rm /usr/lib/security/pam_securid.so
  170. fi
  171. }
  172.  
  173. getyesorno FALSE "Are you sure that you would like to uninstall the RSA Authentication Agent 5.3 for PAM? (y/n) [n]"
  174. if [ "$YESORNO" = FALSE ] ; then
  175.     echo "Exiting without uninstalling the agent"
  176.     abort_installation
  177. else
  178.     check_platform
  179.     check_user
  180.     uninstall
  181.     echo ""
  182.     echo "**********************************************************************"
  183.     echo "* You have successfully uninstalled RSA Authentication Agent 5.3 for PAM"
  184.     echo "* Please make sure to remove this directory to complete the uninstall"
  185.     echo "**********************************************************************"
  186.     echo ""
  187. fi
  188.  
  189.  
  190.