PageRenderTime 56ms CodeModel.GetById 44ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

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