summaryrefslogtreecommitdiff
path: root/libre/iceweasel-noscript/PKGBUILD
blob: 9cf9339e911f50645ab4d9bc0fd11d36d54ca48a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Maintainer: Andreas Grapentin <andreas@grapentin.org>
# Maintainer (Arch): Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: André Silva <emulatorman@hyperbola.info>
# Contributor: jc_gargma <jc_gargma@iserlohn-fortress.net>
# Contributor (Arch): Eschwartz <eschwartz93@gmail.com>

pkgname=iceweasel-noscript

pkgver=10.1.6
pkgrel=1
arch=(any)

pkgdesc="Extension for iceweasel which disables script"
url="https://noscript.net/"
license=(GPL)

depends=(iceweasel)
makedepends=(unzip)
replaces=(firefox-noscript)
groups=(iceweasel-addons)

source=(https://secure.informaction.com/download/releases/noscript-$pkgver.xpi)
noextract=("noscript-$pkgver.xpi")
sha256sums=('16c34ea0ec3eee05d303ba4fa2744d5cbe0a948325e84d41e5e8568f27a17207')

prepare() {
  unzip -qqo "noscript-$pkgver.xpi" -d "noscript-$pkgver"
}

package() {
  _extension_id="$(sed -n '/.*"id": *"\(.*\)".*/{s//\1/p;q}' noscript-$pkgver/manifest.json)"
  _extension_dest="$pkgdir/usr/lib/iceweasel/browser/extensions/$_extension_id"

  # _extension_id must not be empty
  [ -n "$_extension_id" ] || (echo "error extracting extension_id" >&2 && exit 1)

  if grep '<em:unpack>true</em:unpack>' noscript-$pkgver/install.rdf > /dev/null; then
    install -dm755 "$_extension_dest"
    cp -R noscript-$pkgver/* "$_extension_dest"
    chmod -R ugo+rX "$_extension_dest"
  else
    install -Dm644 noscript-$pkgver.xpi "$_extension_dest.xpi"
  fi
}