/[gentoo-x86]/eclass/mozextension.eclass
Gentoo

Contents of /eclass/mozextension.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (hide annotations) (download)
Fri Apr 5 15:27:40 2013 UTC (16 months, 2 weeks ago) by floppym
Branch: MAIN
Changes since 1.7: +3 -4 lines
Fix eclass docs.

1 floppym 1.8 # Copyright 1999-2013 Gentoo Foundation
2 anarchy 1.1 # Distributed under the terms of the GNU General Public License v2
3 floppym 1.8 # $Header: /var/cvsroot/gentoo-x86/eclass/mozextension.eclass,v 1.7 2011/12/27 17:55:12 fauli Exp $
4 anarchy 1.1 #
5 anarchy 1.6 # @ECLASS: mozextension.eclass
6     # @MAINTAINER:
7     # Mozilla team <mozilla@gentoo.org>
8 floppym 1.8 # @BLURB: Install extensions for use in mozilla products.
9 anarchy 1.6
10 anarchy 1.1
11     inherit eutils
12    
13     DEPEND="app-arch/unzip"
14    
15     xpi_unpack() {
16     local xpi xpiname srcdir
17    
18     # Not gonna use ${A} as we are looking for a specific option being passed to function
19     # You must specify which xpi to use
20     [[ -z "$*" ]] && die "Nothing passed to the $FUNCNAME command. please pass which xpi to unpack"
21    
22     for xpi in "$@"; do
23     einfo "Unpacking ${xpi} to ${PWD}"
24 armin76 1.4 xpiname=$(basename ${xpi%.*})
25 anarchy 1.1
26 armin76 1.4 if [[ "${xpi:0:2}" != "./" ]] && [[ "${xpi:0:1}" != "/" ]] ; then
27 anarchy 1.1 srcdir="${DISTDIR}/"
28     fi
29    
30     [[ -s "${srcdir}${xpi}" ]] || die "${xpi} does not exist"
31    
32     case "${xpi##*.}" in
33     ZIP|zip|jar|xpi)
34     mkdir "${WORKDIR}/${xpiname}" && \
35 fauli 1.7 unzip -qo "${srcdir}${xpi}" -d "${WORKDIR}/${xpiname}" || die "failed to unpack ${xpi}"
36 anarchy 1.1 ;;
37     *)
38     einfo "unpack ${xpi}: file format not recognized. Ignoring."
39     ;;
40     esac
41     done
42     }
43    
44    
45     xpi_install() {
46     local emid
47    
48     # You must tell xpi_install which xpi to use
49     [[ ${#} -ne 1 ]] && die "$FUNCNAME takes exactly one argument, please specify an xpi to unpack"
50    
51     x="${1}"
52 vivo 1.2 cd ${x}
53 anarchy 1.1 # determine id for extension
54 anarchy 1.5 emid="$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${x}"/install.rdf)" \
55     || die "failed to determine extension id"
56 anarchy 1.1 insinto "${MOZILLA_FIVE_HOME}"/extensions/${emid}
57     doins -r "${x}"/* || die "failed to copy extension"
58     }

  ViewVC Help
Powered by ViewVC 1.1.20