1- #! /bin/tcsh -f
2- #
1+ #! /bin/sh
2+
33#
4- # This script attempts to register RV as the protocol hander for
5- # links that look like rvlink://blah.
4+ # This script attempts to register RV as the protocol hander for
5+ # links that look like rvlink://blah.
66#
7- # It should be sufficient for gnome apps like pidgin and kde apps
8- # like konqueror. Firefox seems to pay attention to the gnome
9- # settings at least to the degree that it recognizes links of the
10- # form rvlink://blah as hot-links, but it may still ask you to
11- # select the application the first time you click on one.
7+ # It should be sufficient for gnome apps like pidgin and kde apps
8+ # like konqueror. Firefox seems to pay attention to the gnome
9+ # settings at least to the degree that it recognizes links of the
10+ # form rvlink://blah as hot-links, but it may still ask you to
11+ # select the application the first time you click on one.
1212#
13- # We (tweak) are not expert on this stuff, so if you have ideas
14- # about how to do this better or more completely, please let us
15- 13+ # We (tweak) are not expert on this stuff, so if you have ideas
14+ # about how to do this better or more completely, please let us
15+ 1616#
1717
18- if (! $? RV_HOME) then
19- pushd ` dirname $0 ` >& /dev/null
20- setenv RV_HOME ` dirname ${cwd} `
21- popd >& /dev/null
22- endif
18+ if [ -z " $RV_HOME " ]; then
19+ canonicalName=$( readlink -f " $0 " )
20+ binName=$( dirname " $canonicalName " )
21+ homeName=$( dirname " $binName " )
22+ export RV_HOME=" $homeName "
23+ fi
2324
24- set rvpush = " $RV_HOME /bin/rvpush"
25+ export rvpush= " $RV_HOME /bin/rvpush"
2526
26- #
27- # Gnome: register rv as rvlink protocol handler
28- #
2927echo " Installing rvlink protocol handler for Gnome."
3028
31- set gconfTool = " ` which gconftool-2` "
32-
33- if ($status == 0) then
34- gconftool-2 --set --type=string /desktop/gnome/url-handlers/rvlink/command $rvpush ' -tag rvlink url "%s"'
29+ if which gconftool-2; then
30+ gconftool-2 --set --type=string /desktop/gnome/url-handlers/rvlink/command $rv ' "%s"'
3531 gconftool-2 --set --type=bool /desktop/gnome/url-handlers/rvlink/enabled true
3632 gconftool-2 --set --type=bool /desktop/gnome/url-handlers/rvlink/need-terminal false
3733else
3834 echo " WARNING: gconftool-2 not found: skipping gnome url-handler registration."
39- endif
35+ fi
4036
41- #
42- # KDE: register rv as rvlink protocol handler
43- # If you want to install this system wide copy the rvlink.protocol file to /usr/share/kde4/services/
44- #
37+ # If you want to install this system wide copy the rvlink.protocol file to /usr/share/kde4/services/
4538echo " Installing rvlink protocol handler for KDE."
4639
47- set kdeProtoDir = ~ /.kde/share/services
48- if ( -e ~ /.kde4/share/services ) then
49- set kdeProtoDir = ~ /.kde4/share/services
50- endif
51- if ( ${? KDEDIR} ) then
52- set kdeProtoDir = ${ KDEDIR} /share/services
53- endif
40+ kdeProtoDir= " $HOME /.kde/share/services"
41+ if [ -e " $HOME /.kde4/share/services" ] ; then
42+ kdeProtoDir= " $HOME /.kde4/share/services"
43+ fi
44+ if [ -n " $ KDEDIR" ] ; then
45+ kdeProtoDir= " $ KDEDIR /share/services"
46+ fi
5447
55- if ( ! -e $kdeProtoDir ) then
56- mkdir -p $kdeProtoDir
57- endif
48+ if [ ! -e " $kdeProtoDir " ] ; then
49+ mkdir -p " $kdeProtoDir "
50+ fi
5851
59- if ( -e $kdeProtoDir ) then
60- set kdeProtoFile = $kdeProtoDir /rvlink.protocol
61- rm -f $kdeProtoFile
62- cat > $kdeProtoFile << EOF
52+ if [ -e " $kdeProtoDir " ] ; then
53+ kdeProtoFile= " $kdeProtoDir /rvlink.protocol"
54+ rm -f " $kdeProtoFile "
55+ cat > " $kdeProtoFile " << EOF
6356[Protocol]
6457exec=$rvpush -tag rvlink url "%u"
6558protocol=rvlink
@@ -72,30 +65,25 @@ writing=false
7265makedir=false
7366deleting=false
7467EOF
75- echo " Successfully created ${ kdeProtoFile} "
68+ echo " Successfully created $kdeProtoFile "
7669else
77- echo " WARNING: can 't find or create KDE protocol directory: ${ kdeProtoDir} : skipping KDE url-handler registration."
78- endif
70+ echo " WARNING: Can 't find or create KDE protocol directory: $kdeProtoDir . Skipping KDE url-handler registration."
71+ fi
7972
80- #
81- # Gnome part 2 for xdg/Chrome: register rv as rvlink protocol handler
82- # If you want to install this system wide run the desktop-file-install as sudo/root
83- # and remove the --dir= bit.
84- #
73+ # If you want to install this system wide run the desktop-file-install as sudo/root
74+ # and remove the --dir= bit.
8575echo " Installing rvlink protocol handler for XDG"
8676
87- set desktopInstall = " ` which desktop-file-install` "
88-
89- if ($status == 0) then
90- set xdgDir = $HOME /.local/share/applications
91- if ( ! -e $xdgDir ) then
92- mkdir -p $xdgDir
93- endif
77+ if which desktop-file-install; then
78+ xdgDir=$HOME /.local/share/applications
79+ if [ ! -e " $xdgDir " ]; then
80+ mkdir -p " $xdgDir "
81+ fi
9482
95- if ( -e $xdgDir ) then
96- set xdgFile = $xdgDir /rv.desktop
97- rm -f $xdgFile
98- cat > $xdgFile << EOF
83+ if [ ! -e " $xdgDir " ] ; then
84+ xdgFile= " $xdgDir /rv.desktop"
85+ rm -f " $xdgFile "
86+ cat > " $xdgFile " << EOF
9987[Desktop Entry]
10088Name=RVLink
10189Type=Application
@@ -105,14 +93,14 @@ Categories=AudioVideo;Viewer;Player;
10593MimeType=x-scheme-handler/rvlink;
10694NoDisplay=true
10795EOF
108- echo " Successfully created ${ xdgFile} "
96+ echo " Successfully created $xdgFile "
10997 else
110- echo " WARNING: can 't find or create XDG directory: ${ xdgDir} : skipping XDG url-handler registration."
111- endif
98+ echo " WARNING: Can 't find or create XDG directory: $xdgDir . Skipping XDG url-handler registration."
99+ fi
112100
113- desktop-file-install $xdgFile --rebuild-mime-info-cache --dir=$xdgDir
101+ desktop-file-install " $xdgFile " --rebuild-mime-info-cache --dir=" $xdgDir "
114102else
115- echo " WARNING: desktop-file-install not found: skipping xdg-handler registration."
116- endif
103+ echo " WARNING: desktop-file-install not found: Skipping xdg-handler registration."
104+ fi
117105
118106echo " Done."
0 commit comments