ldap-agent.in 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/sh
  2. ###############################################################################
  3. ## (1) Specify variables used by this script. ##
  4. ###############################################################################
  5. BIN_DIR=@sbindir@
  6. COMMAND=ldap-agent-bin
  7. # We don't need to load any mibs, so set MIBS to nothing.
  8. MIBS=
  9. export MIBS
  10. ###############################################################################
  11. ## (2) Set the LD_LIBRARY_PATH environment variable to determine the ##
  12. ## search order this command wrapper uses to find shared libraries. ##
  13. ###############################################################################
  14. libpath_add() {
  15. [ -z "$1" ] && return
  16. LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}$1
  17. }
  18. libpath_add "@nss_libdir@"
  19. libpath_add "@nspr_libdir@"
  20. libpath_add "@ldapsdk_libdir@"
  21. libpath_add "@netsnmp_libdir@"
  22. export LD_LIBRARY_PATH
  23. ###############################################################################
  24. ## (3) Set the PATH environment variable to determine the search ##
  25. ## order this command wrapper uses to find binary executables. ##
  26. ## ##
  27. ## NOTE: Since the wrappers themselves are ALWAYS located in ##
  28. ## "/usr/bin", this directory will always be excluded ##
  29. ## from the search path. Since "/bin" is nothing more ##
  30. ## than a symbolic link to "/usr/bin" on Solaris, this ##
  31. ## directory will also always be excluded from the search ##
  32. ## path on this platform. ##
  33. ###############################################################################
  34. PATH=${BIN_DIR}
  35. export PATH
  36. ###############################################################################
  37. ## (4) Execute the binary executable specified by this command wrapper ##
  38. ## based upon the preset LD_LIBRARY_PATH and PATH environment variables.##
  39. ###############################################################################
  40. ORIGINAL_IFS=${IFS}
  41. IFS=:
  42. for dir in ${PATH}
  43. do
  44. if [ -x ${dir}/${COMMAND} ]
  45. then
  46. IFS=${ORIGINAL_IFS}
  47. ${dir}/${COMMAND} "$@"
  48. exit $?
  49. fi
  50. done
  51. echo "Unable to find \"${COMMAND}\" in \"${PATH}\"!"
  52. exit 255