/indra/newview/linux_tools/register_secondlifeprotocol.sh

https://bitbucket.org/lindenlab/viewer-beta/ · Shell · 48 lines · 35 code · 7 blank · 6 comment · 9 complexity · b3eaf68724b6585adeb2d9f7752f3fe4 MD5 · raw file

  1. #!/bin/bash
  2. # Register a protocol handler (default: handle_secondlifeprotocol.sh) for
  3. # URLs of the form secondlife://...
  4. #
  5. HANDLER="$1"
  6. RUN_PATH=`dirname "$0" || echo .`
  7. cd "${RUN_PATH}/.."
  8. if [ -z "$HANDLER" ]; then
  9. HANDLER=`pwd`/etc/handle_secondlifeprotocol.sh
  10. fi
  11. # Register handler for GNOME-aware apps
  12. LLGCONFTOOL2=gconftool-2
  13. if which ${LLGCONFTOOL2} >/dev/null; then
  14. (${LLGCONFTOOL2} -s -t string /desktop/gnome/url-handlers/secondlife/command "${HANDLER} \"%s\"" && ${LLGCONFTOOL2} -s -t bool /desktop/gnome/url-handlers/secondlife/enabled true) || echo Warning: Did not register secondlife:// handler with GNOME: ${LLGCONFTOOL2} failed.
  15. else
  16. echo Warning: Did not register secondlife:// handler with GNOME: ${LLGCONFTOOL2} not found.
  17. fi
  18. # Register handler for KDE-aware apps
  19. for LLKDECONFIG in kde-config kde4-config; do
  20. if [ `which $LLKDECONFIG` ]; then
  21. LLKDEPROTODIR=`$LLKDECONFIG --path services | cut -d ':' -f 1`
  22. if [ -d "$LLKDEPROTODIR" ]; then
  23. LLKDEPROTOFILE=${LLKDEPROTODIR}/secondlife.protocol
  24. cat > ${LLKDEPROTOFILE} <<EOF || echo Warning: Did not register secondlife:// handler with KDE: Could not write ${LLKDEPROTOFILE}
  25. [Protocol]
  26. exec=${HANDLER} '%u'
  27. protocol=secondlife
  28. input=none
  29. output=none
  30. helper=true
  31. listing=
  32. reading=false
  33. writing=false
  34. makedir=false
  35. deleting=false
  36. EOF
  37. else
  38. echo Warning: Did not register secondlife:// handler with KDE: Directory $LLKDEPROTODIR does not exist.
  39. fi
  40. fi
  41. done