salt.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. # Set up Salt-specific environment variables
  2. #
  3. # Drop this into /etc/profile.d to add the neede /opt paths to your environment
  4. # on login
  5. #
  6. export PATH=$PATH:/opt/bin
  7. # Hard-code the python version (major and minor, i.e. 2.6 or 2.7) here if you
  8. # don't trust the logic below.
  9. #
  10. #pyver=2.6
  11. #
  12. if test -z "$pyver"; then
  13. # Detect RHEL 5 and Arch, operating systems for which "/usr/bin/env python"
  14. # refers to a python version <2.6 or >=3.0.
  15. if test -f /etc/redhat-release; then
  16. osmajor=`egrep -o '[0-9]+\.[0-9]+' /etc/redhat-release | cut -f1 -d.`
  17. test "$osmajor" -eq 5 && pyver=2.6
  18. elif test -f /etc/arch-release; then
  19. python=python2
  20. fi
  21. if test -z "$pyver"; then
  22. test -z "$python" && python=python
  23. pyver=`/usr/bin/env $python -V 2>&1 | cut -f2 -d' ' | cut -f1,2 -d.`
  24. fi
  25. fi
  26. # Only add directories to PYTHONPATH if we were able to determine the python
  27. # version.
  28. test -n "$pyver" && export PYTHONPATH=$PYTHONPATH:/opt/lib/python${pyver}/site-packages:/opt/lib64/python${pyver}/site-packages
  29. # Make MAN pages installed within /opt/share/man accessible
  30. export MANPATH=$MANPATH:/opt/share/man