From c612e2880512912ec76b414deb8d13fbcc40e190 Mon Sep 17 00:00:00 2001 From: Ian Stakenvicius Date: Thu, 25 Jan 2018 14:18:09 -0500 Subject: mozextension.eclass: initial support for manifest.json exensions Thanks to Sven B. for some initial legwork on this. Work is not complete as the extension installations should somehow also auto-validate themselves, but it will at least prevent bugs such as bug 645636 Bug: http://bugs.gentoo.org/645754 --- eclass/mozextension.eclass | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/eclass/mozextension.eclass b/eclass/mozextension.eclass index 9d22166e9d73..425da7e85bf1 100644 --- a/eclass/mozextension.eclass +++ b/eclass/mozextension.eclass @@ -69,10 +69,18 @@ xpi_install() { [[ ${#} -ne 1 ]] && die "$FUNCNAME takes exactly one argument, please specify an xpi to unpack" x="${1}" - cd ${x} + #cd ${x} # determine id for extension + if [[ -f "${x}"/install.rdf ]]; then emid="$(sed -n -e '/install-manifest/,$ { /em:id/!d; s/.*[\">]\([^\"<>]*\)[\"<].*/\1/; p; q }' "${x}"/install.rdf)" \ - || die "failed to determine extension id" + || die "failed to determine extension id from install.rdf" + elif [[ -f "${x}"/manifest.json ]]; then + emid="$( sed -n 's/.*"id": "\(.*\)",/\1/p' "${x}"/manifest.json )" \ + || die "failed to determine extension id from manifest.json" + else + die "failed to determine extension id" + fi + if [[ -n ${MOZEXTENSION_TARGET} ]]; then insinto "${MOZILLA_FIVE_HOME}"/${MOZEXTENSION_TARGET%/}/${emid} elif $(mozversion_extension_location) ; then -- cgit v1.2.3-65-gdbad