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

Contents of /eclass/mozextension.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations) (download)
Thu Dec 30 03:06:04 2010 UTC (3 years, 9 months ago) by anarchy
Branch: MAIN
Changes since 1.4: +3 -2 lines
cleanup parsing of install.rdf for extensions, bug #301920

1 armin76 1.3 # Copyright 1999-2007 Gentoo Foundation
2 anarchy 1.1 # Distributed under the terms of the GNU General Public License v2
3 anarchy 1.5 # $Header: /var/cvsroot/gentoo-x86/eclass/mozextension.eclass,v 1.4 2007/12/20 15:43:14 armin76 Exp $
4 anarchy 1.1 #
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 armin76 1.4 xpiname=$(basename ${xpi%.*})
21 anarchy 1.1
22 armin76 1.4 if [[ "${xpi:0:2}" != "./" ]] && [[ "${xpi:0:1}" != "/" ]] ; then
23 anarchy 1.1 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 vivo 1.2 cd ${x}
50 anarchy 1.1 # determine id for extension
51 anarchy 1.5 emid="$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${x}"/install.rdf)" \
52     || die "failed to determine extension id"
53 anarchy 1.1 insinto "${MOZILLA_FIVE_HOME}"/extensions/${emid}
54     doins -r "${x}"/* || die "failed to copy extension"
55     }

  ViewVC Help
Powered by ViewVC 1.1.20