(file) Return to installssllinks CVS log (file) (dir) Up to [OMI] / omi / scripts

 1 krisbash 1.1 #!/bin/sh
 2              
 3              verify_ssl_version() {
 4                  SSL_VERSION=`openssl version | awk '{print $2}'`
 5                  case "$SSL_VERSION" in
 6                      0.9.8*)
 7                          LIB_SUFFIX="0.9.8"
 8                          ;;
 9                      1.0.*)
10                          LIB_SUFFIX="1.0.0"
11                          ;;
12                      *)
13                          echo "Error: OpenSSL version '${SSL_VERSION}' is not supported. Only OpenSSL versions 0.9.8* and 1.0.* are supported." >&2
14                          exit 2
15                          ;;
16                  esac
17              }
18              
19              create_ssl_links() {
20                  # If LD_LIBRARY_PATH contains a path to the directory that we're creating
21 krisbash 1.2     # links in (i.e. /opt/omi/lib), it affects the output of ldd such that we
22                  # can create a circular link ... (unset resolves that)
23 krisbash 1.1     unset LD_LIBRARY_PATH
24              
25 krisbash 1.2     LIBRARY_DIR='/opt/omi/lib'
26 krisbash 1.1 
27                  OPENSSL_PATH=`which openssl`
28                  LIBSSL_PATH=`ldd ${OPENSSL_PATH} | grep libssl.so | awk '{print $3}'`
29                  if [ $? -ne 0 ]; then
30                      echo "Error: Unable to determine libssl.so path" >&2
31                      exit 2
32                  fi
33                  LIBCRYPTO_PATH=`ldd ${OPENSSL_PATH} | grep libcrypto.so | awk '{print $3}'`
34                  if [ $? -ne 0 ]; then
35                      echo "Error: Unable to determine libcrypto.so path" >&2
36                      exit 2
37                  fi
38              
39                  [ -e ${LIBRARY_DIR}/libssl.so.${LIB_SUFFIX} ] && rm ${LIBRARY_DIR}/libssl.so.${LIB_SUFFIX}
40                  [ -e ${LIBRARY_DIR}/libcrypto.so.${LIB_SUFFIX} ] && rm ${LIBRARY_DIR}/libcrypto.so.${LIB_SUFFIX}
41              
42                  ln -s ${LIBSSL_PATH} ${LIBRARY_DIR}/libssl.so.${LIB_SUFFIX}
43                  ln -s ${LIBCRYPTO_PATH} ${LIBRARY_DIR}/libcrypto.so.${LIB_SUFFIX}
44              }
45              
46              
47 krisbash 1.1 id=`id | cut -f2 -d'(' | cut -f1 -d')'`
48              
49              if [ "$id" != "root" ]; then
50                  echo >&2
51                  echo "************************************************************" >&2
52                  echo "* Warning: SSL configuration not performed (requires root  *" >&2
53                  echo "* privileges).                                             *" >&2
54                  echo "************************************************************" >&2
55                  echo >&2
56                  exit 3
57              fi
58              
59              verify_ssl_version
60              create_ssl_links
61              exit 0

ViewCVS 0.9.2