blob: 6ad5cb013c5b33fd035ef7410d93fe810142f195 (
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
45
|
# Maintainer: Jerry Xiao <aur@mail.jerryxiao.cc>
# Private key generated with `openssl genrsa 2048| openssl pkcs8 -topk8 -nocrypt -traditional`
pkgname=chromium-extension-ublock-origin-lite
pkgver=2024.11.11.1298
pkgrel=1
pkgdesc="uBO Lite (uBOL), a permission-less MV3 API-based content blocker, for chromium"
arch=('any')
url="https://github.com/uBlockOrigin/uBOL-home"
license=('GPL-3.0-only')
makedepends=('chromium' 'openssl' 'jq' 'unzip')
source=("${pkgname}-${pkgver}.zip::${url}/releases/download/uBOLite_${pkgver}/uBOLite_${pkgver}.chromium.mv3.zip"
"uBlock0.chromium.pem")
provides=('chromium-extension-ublock-origin')
conflicts=('chromium-extension-ublock-origin')
noextract=("${pkgname}-${pkgver}.zip")
sha256sums=('260ea790d2a545ec6bc782816b0b5a843269dcfad3f142c266515f21e319d951'
'804e431b5601a5d0bd9d7e1d27ea8396c6cc87f2523d6d857f1abf368df3a06f')
build() {
pubkey="$(openssl rsa -in uBlock0.chromium.pem -pubout -outform DER |base64 -w0)"
# Create extension json
export _id="$(echo $pubkey |base64 -d |sha256sum |head -c32 |tr '0-9a-f' 'a-p')"
echo "extenson id should be: ${_id}"
cat << EOF > "${_id}".json
{
"external_crx": "/usr/lib/${pkgname}/${pkgname}-${pkgver}.crx",
"external_version": "${pkgver}"
}
EOF
mkdir -p uBlock0.chromium
cd uBlock0.chromium
unzip -q ../"${pkgname}-${pkgver}.zip"
jq --ascii-output --arg key "$pubkey" '. + {key: $key}' manifest.json > manifest.json.new
mv manifest.json.new manifest.json
cd ..
tmpdir="$(mktemp -d chromium-pack-XXXXXX)"
chromium --user-data-dir="$tmpdir" --pack-extension=uBlock0.chromium --pack-extension-key=uBlock0.chromium.pem
mv uBlock0.chromium.crx "${pkgname}-${pkgver}.crx"
}
package() {
install -Dm644 -t "${pkgdir}/usr/share/chromium/extensions/" "${_id}.json"
install -Dm644 -t "${pkgdir}/usr/lib/${pkgname}/" "${pkgname}-${pkgver}.crx"
}
|