#!/bin/sh #C- This program is free software; you can redistribute it and/or #C- modify it under the terms of the GNU General Public License, #C- either Version 2 of the License or (at your option) any later #C- version. The license should have accompanied the program #C- or you may obtain a copy of the license from the Free Software #C- Foundation at http://www.fsf.org. #C- #C- This program is distributed in the hope that it will be useful, #C- but WITHOUT ANY WARRANTY; without even the implied warranty of #C- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #C- GNU General Public License for more details. xdg_mime=XDG_MIME xdg_icon_resource=XDG_ICON_RESOURCE xdg_desktop_menu=XDG_DESKTOP_MENU datadir=DATADIR mydir=MYDIR # test directory if test -d "$mydir" then cd $mydir else echo 1>&2 "Unable to find directory ${mydir}" exit 10 fi # check presence of xdg utils test -n "$xdg_mime" || xdg_mime=`which xdg-mime` test -n "$xdg_icon_resource" || xdg_icon_resource=`which xdg-icon-resource` test -n "$xdg_desktop_menu" || xdg_desktop_menu=`which xdg-desktop-menu` if test -x "$xdg_mime" && test -x "$xdg_icon_resource" && test -x "$xdg_desktop_menu" then true else echo 1>&2 "Unable to find the Xdg Portland utils" echo 1>&2 " These are needed to run $0". echo 1>&2 " Please check http://portland.freedesktop.org." exit 10 fi if test -n "$XDG_DATA_DIRS" ; then XDG_DATA_DIRS="$datadir:$XDG_DATA_DIRS" else XDG_DATA_DIRS="$datadir:/usr/local/share:/usr/share" fi export XDG_DATA_DIRS # proceed case "$1" in install) for n in hi*-djvu.png ; do s=`echo $n | sed -e 's/[a-z]*\([0-9]*\).*/\1/'` "$xdg_icon_resource" install --noupdate --mode system \ --context mimetypes --size $s "$n" image-vnd.djvu done "$xdg_icon_resource" forceupdate ## This is disabled to avoid conflicting with the ## djvu information provided by freedesktop.org ## "$xdg_mime" install ./djvulibre-mime.xml ;; uninstall) for n in hi*-djvu.png ; do s=`echo $n | sed -e 's/[a-z]*\([0-9]*\).*/\1/'` "$xdg_icon_resource" uninstall --noupdate --mode system \ --context mimetypes --size $s "$n" image-vnd.djvu done "$xdg_icon_resource" forceupdate ## This is disabled to avoid conflicting with the ## djvu information provided by freedesktop.org ## "$xdg_mime" uninstall ./djvulibre-mime.xml ;; *) echo 1>&2 "Usage: $0 install" exit 10 ;; esac