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

Contents of /eclass/mozextension.eclass

Parent Directory Parent Directory | Revision Log Revision Log


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

1 # Copyright 1999-2011 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/mozextension.eclass,v 1.6 2011/10/31 12:28:14 anarchy Exp $
4 #
5 # @ECLASS: mozextension.eclass
6 # @MAINTAINER:
7 # Mozilla team <mozilla@gentoo.org>
8 # @DESCRIPTION:
9 # Install extensions for use in mozilla products.
10
11
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 xpiname=$(basename ${xpi%.*})
26
27 if [[ "${xpi:0:2}" != "./" ]] && [[ "${xpi:0:1}" != "/" ]] ; then
28 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 unzip -qo "${srcdir}${xpi}" -d "${WORKDIR}/${xpiname}" || die "failed to unpack ${xpi}"
37 ;;
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 cd ${x}
54 # determine id for extension
55 emid="$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${x}"/install.rdf)" \
56 || die "failed to determine extension id"
57 insinto "${MOZILLA_FIVE_HOME}"/extensions/${emid}
58 doins -r "${x}"/* || die "failed to copy extension"
59 }

  ViewVC Help
Powered by ViewVC 1.1.20