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

Contents of /eclass/mozextension.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (hide annotations) (download)
Tue Dec 27 17:55:12 2011 UTC (2 years, 3 months ago) by fauli
Branch: MAIN
Changes since 1.6: +3 -3 lines
Update copyright years in headers

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

  ViewVC Help
Powered by ViewVC 1.1.20