#!/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) "$xdg_icon_resource" install --context apps \ --size 32 ./hi32-djview3.png djvulibre-djview3 "$xdg_icon_resource" install --context apps \ --size 64 ./hi64-djview3.png djvulibre-djview3 "$xdg_desktop_menu" install ./djvulibre-djview3.desktop ;; uninstall) "$xdg_icon_resource" uninstall --context apps \ --size 32 djvulibre-djview3 "$xdg_icon_resource" uninstall --context apps \ --size 64 djvulibre-djview3 "$xdg_desktop_menu" uninstall djvulibre-djview3.desktop ;; *) echo 1>&2 "Usage: $0 {install|uninstall}" exit 10 ;; esac