/linden/indra/newview/linux_tools/register_secondlifeprotocol.sh

https://github.com/WindBasevi/imprudence · Shell · 46 lines · 34 code · 6 blank · 6 comment · 8 complexity · a0024d345f42e717efabda042d57e06f 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`/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. if [ -z "$KDEHOME" ]; then
  20. KDEHOME=~/.kde
  21. fi
  22. LLKDEPROTDIR=${KDEHOME}/share/services
  23. if [ -d "$LLKDEPROTDIR" ]; then
  24. LLKDEPROTFILE=${LLKDEPROTDIR}/secondlife.protocol
  25. cat > ${LLKDEPROTFILE} <<EOF || echo Warning: Did not register secondlife:// handler with KDE: Could not write ${LLKDEPROTFILE}
  26. [Protocol]
  27. exec=${HANDLER} '%u'
  28. protocol=secondlife
  29. input=none
  30. output=none
  31. helper=true
  32. listing=
  33. reading=false
  34. writing=false
  35. makedir=false
  36. deleting=false
  37. EOF
  38. else
  39. echo Warning: Did not register secondlife:// handler with KDE: Directory $LLKDEPROTDIR does not exist.
  40. fi