~ubuntu-branches/ubuntu/raring/djvulibre/raring

« back to all changes in this revision

Viewing changes to desktopfiles/register-djvu-mime.in

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-18 11:21:21 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070518112121-rt7fum0zi0xoepm6
Tags: 3.5.19-2ubuntu1
* debian/control: Maintainer: Ubuntu Core Developers
  <ubuntu-devel-discuss@lists.ubuntu.com>.
* debian/rules: call dh_iconcache. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
#C- This program is free software; you can redistribute it and/or
 
4
#C- modify it under the terms of the GNU General Public License,
 
5
#C- either Version 2 of the License or (at your option) any later
 
6
#C- version.  The license should have accompanied the program 
 
7
#C- or you may obtain a copy of the license from the Free Software
 
8
#C- Foundation at http://www.fsf.org.
 
9
#C-
 
10
#C- This program is distributed in the hope that it will be useful,
 
11
#C- but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
#C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
#C- GNU General Public License for more details.
 
14
#C-
 
15
#C- $Id: register-djvu-mime.in,v 1.8 2007/03/25 20:48:22 leonb Exp $
 
16
 
 
17
 
 
18
xdg_mime=XDG_MIME
 
19
xdg_icon_resource=XDG_ICON_RESOURCE
 
20
xdg_desktop_menu=XDG_DESKTOP_MENU
 
21
datadir=DATADIR
 
22
mydir=MYDIR
 
23
 
 
24
# test directory
 
25
if test -d "$mydir" 
 
26
then
 
27
  cd $mydir
 
28
else
 
29
  echo 1>&2 "Unable to find directory ${mydir}"
 
30
  exit 10
 
31
fi
 
32
 
 
33
 
 
34
# check presence of xdg utils
 
35
test -n "$xdg_mime" || xdg_mime=`which xdg-mime`
 
36
test -n "$xdg_icon_resource" || xdg_icon_resource=`which xdg-icon-resource`
 
37
test -n "$xdg_desktop_menu" || xdg_desktop_menu=`which xdg-desktop-menu`
 
38
 
 
39
if test -x "$xdg_mime" &&
 
40
   test -x "$xdg_icon_resource" &&
 
41
   test -x "$xdg_desktop_menu" 
 
42
then
 
43
   true
 
44
else
 
45
   echo 1>&2 "Unable to find the Xdg Portland utils"
 
46
   echo 1>&2 " These are needed to run $0".
 
47
   echo 1>&2 " Please check http://portland.freedesktop.org."
 
48
   exit 10
 
49
fi
 
50
 
 
51
if test -n "$XDG_DATA_DIRS" ; then
 
52
    XDG_DATA_DIRS="$datadir:$XDG_DATA_DIRS"
 
53
else
 
54
    XDG_DATA_DIRS="$datadir:/usr/local/share:/usr/share"
 
55
fi
 
56
export XDG_DATA_DIRS
 
57
 
 
58
# proceed
 
59
case "$1" in
 
60
install)
 
61
   "$xdg_icon_resource" install --noupdate --context mimetypes \
 
62
       --size 22 ./hi22-djvu.png image-vnd.djvu
 
63
   "$xdg_icon_resource" install --noupdate --context mimetypes \
 
64
       --size 32 ./hi32-djvu.png image-vnd.djvu
 
65
   "$xdg_icon_resource" install --noupdate --context mimetypes \
 
66
       --size 48 ./hi48-djvu.png image-vnd.djvu
 
67
   "$xdg_icon_resource" forceupdate
 
68
   "$xdg_mime" install ./djvulibre-mime.xml
 
69
   ;;
 
70
uninstall)
 
71
   "$xdg_icon_resource" uninstall --noupdate --context mimetypes \
 
72
       --size 22 image-vnd.djvu
 
73
   "$xdg_icon_resource" uninstall --noupdate --context mimetypes \
 
74
       --size 32 image-vnd.djvu
 
75
   "$xdg_icon_resource" uninstall --noupdate --context mimetypes \
 
76
       --size 48 image-vnd.djvu
 
77
   "$xdg_icon_resource" forceupdate
 
78
   "$xdg_mime" uninstall ./djvulibre-mime.xml
 
79
   ;;
 
80
*)
 
81
   echo 1>&2 "Usage: $0 {install|uninstall}"
 
82
   exit 10
 
83
   ;;
 
84
esac