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

Contents of /eclass/mozextension.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Thu Dec 20 15:43:14 2007 UTC (6 years, 9 months ago) by armin76
Branch: MAIN
Changes since 1.3: +3 -3 lines
Fix mozextension.eclass wrt bug #202847, patch by Nirbheek Chauhan <nirbheek dot chauhan at gmail dot com>

1 # Copyright 1999-2007 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.3 2007/03/12 11:57:49 armin76 Exp $
4 #
5 # mozextention.eclass: installing firefox extensions and language packs
6
7 inherit eutils
8
9 DEPEND="app-arch/unzip"
10
11 xpi_unpack() {
12 local xpi xpiname srcdir
13
14 # Not gonna use ${A} as we are looking for a specific option being passed to function
15 # You must specify which xpi to use
16 [[ -z "$*" ]] && die "Nothing passed to the $FUNCNAME command. please pass which xpi to unpack"
17
18 for xpi in "$@"; do
19 einfo "Unpacking ${xpi} to ${PWD}"
20 xpiname=$(basename ${xpi%.*})
21
22 if [[ "${xpi:0:2}" != "./" ]] && [[ "${xpi:0:1}" != "/" ]] ; then
23 srcdir="${DISTDIR}/"
24 fi
25
26 [[ -s "${srcdir}${xpi}" ]] || die "${xpi} does not exist"
27
28 case "${xpi##*.}" in
29 ZIP|zip|jar|xpi)
30 mkdir "${WORKDIR}/${xpiname}" && \
31 cd "${WORKDIR}/${xpiname}" && \
32 unzip -qo "${srcdir}${xpi}" || die "failed to unpack ${xpi}"
33 ;;
34 *)
35 einfo "unpack ${xpi}: file format not recognized. Ignoring."
36 ;;
37 esac
38 done
39 }
40
41
42 xpi_install() {
43 local emid
44
45 # You must tell xpi_install which xpi to use
46 [[ ${#} -ne 1 ]] && die "$FUNCNAME takes exactly one argument, please specify an xpi to unpack"
47
48 x="${1}"
49 cd ${x}
50 # determine id for extension
51 emid=$(sed -n -e '/<\?em:id>\?/!d; s/.*\([\"{].*[}\"]\).*/\1/; s/\"//g; p; q' ${x}/install.rdf) || die "failed to determine extension id"
52 insinto "${MOZILLA_FIVE_HOME}"/extensions/${emid}
53 doins -r "${x}"/* || die "failed to copy extension"
54 }

  ViewVC Help
Powered by ViewVC 1.1.20