/[gentoo-x86]/eclass/fdo-mime.eclass
Gentoo

Contents of /eclass/fdo-mime.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (hide annotations) (download)
Thu Apr 21 20:59:59 2011 UTC (3 years, 8 months ago) by eva
Branch: MAIN
Changes since 1.8: +62 -9 lines
Fix SCROLLKEEPER_UPDATE variable documentation.

1 pva 1.7 # Copyright 1999-2008 Gentoo Foundation
2 foser 1.1 # Distributed under the terms of the GNU General Public License v2
3 eva 1.9 # $Header: /var/cvsroot/gentoo-x86/eclass/fdo-mime.eclass,v 1.8 2008/12/23 01:28:49 solar Exp $
4 foser 1.1
5 pva 1.7 # @ECLASS: fdo-mime.eclass
6     # @MAINTAINER: freedesktop-bugs@gentoo.org
7 solar 1.8 #
8     #
9 pva 1.7 # Original author: foser <foser@gentoo.org>
10     # @BLURB: Utility eclass to update the desktop mime info as laid out in the freedesktop specs & implementations
11 foser 1.1
12 eva 1.9 # @ECLASS-VARIABLE: FDO_MIME_UPDATE_DESKTOP_BIN
13     # @DESCRIPTION:
14     # Path to update-desktop-database
15     : ${FDO_MIME_UPDATE_DESKTOP_BIN:="/usr/bin/update-desktop-database"}
16    
17     # @ECLASS-VARIABLE: FDO_MIME_UPDATE_MIME_BIN
18     # @DESCRIPTION:
19     # Path to update-mime-database
20     : ${FDO_MIME_UPDATE_MIME_BIN:="/usr/bin/update-mime-database"}
21    
22     # @FUNCTION: fdo_mime_desktop_savelist
23     # @DESCRIPTION:
24     # Find the .desktop files that are about to be installed and save their location
25     # in the FDO_MIME_DESKTOP_FILES environment variable
26     fdo_mime_desktop_savelist() {
27     has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
28     pushd "${ED}" &> /dev/null
29     export FDO_MIME_DESKTOP_FILES=$(find 'usr/share/applications' -type f -name '*.desktop' 2> /dev/null)
30     popd &> /dev/null
31     }
32    
33     # @FUNCTION: fdo_mime_mime_savelist
34     # @DESCRIPTION:
35     # Find the .desktop files that are about to be installed and save their location
36     # in the FDO_MIME_MIME_FILES environment variable
37     fdo_mime_mime_savelist() {
38     has ${EAPI:-0} 0 1 2 && ! use prefix && ED="${D}"
39     pushd "${ED}" &> /dev/null
40     export FDO_MIME_MIME_FILES=$(find 'usr/share/mime' -type f -name '*.xml' 2> /dev/null)
41     popd &> /dev/null
42     }
43 foser 1.1
44 pva 1.7 # @FUNCTION: fdo-mime_desktop_database_update
45     # @DESCRIPTION:
46     # Updates the desktop database.
47 foser 1.1 # Generates a list of mimetypes linked to applications that can handle them
48     fdo-mime_desktop_database_update() {
49 eva 1.9 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
50     local updater="${EROOT}${FDO_MIME_UPDATE_DESKTOP_BIN}"
51    
52     if [ ! -x "${updater}" ]; then
53     debug-print "${updater} is not executable"
54     return
55     fi
56    
57     if [ -z "${FDO_MIME_DESKTOP_FILES}" ]; then
58     debug-print "No desktop file to install"
59     return
60 foser 1.1 fi
61 eva 1.9
62     ebegin "Updating desktop mime database ..."
63     "${updater}" -q "${EROOT}/usr/share/applications"
64     eend $?
65 foser 1.1 }
66    
67 pva 1.7 # @FUNCTION: fdo-mime_mime_database_update
68     # @DESCRIPTION:
69     # Update the mime database.
70 foser 1.1 # Creates a general list of mime types from several sources
71     fdo-mime_mime_database_update() {
72 eva 1.9 has ${EAPI:-0} 0 1 2 && ! use prefix && EROOT="${ROOT}"
73     local updater="${EROOT}${FDO_MIME_UPDATE_MIME_BIN}"
74    
75     if [ ! -x "${updater}" ]; then
76     debug-print "${updater} is not executable"
77     return
78     fi
79    
80     if [ -z "${FDO_MIME_MIME_FILES}" ]; then
81     debug-print "No desktop file to install"
82     return
83 foser 1.1 fi
84 eva 1.9
85     ebegin "Updating shared mime info database ..."
86     "${updater}" "${EROOT}/usr/share/mime"
87     eend $?
88 foser 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20