diff options
author | Caleb Maclennan | 2018-09-01 08:37:08 +0300 |
---|---|---|
committer | Caleb Maclennan | 2018-09-01 11:14:32 +0300 |
commit | 0fc5debd900c4a57f6a4a1f8c61edf71778df51f (patch) | |
tree | 87cd18710439b9b4c06955090e1b6e3eed5cae02 | |
parent | 986005eb64a675720d8b7fb80e9515c09d6edb59 (diff) | |
download | aur-0fc5debd900c4a57f6a4a1f8c61edf71778df51f.tar.gz |
Move launcher from heredoc to repository and include relevant warning message
The warning message doesn't do much good in build(), the package may not
be installed on the system that built it, and it's likely to get lost.
Moving it to the launcher (where the same test was being run anyway)
and outputting it on STDERR makes the whole thing a bit less of a monkey
patch. Also this makes reviewing changes to the AUR package a lot
easier, changes to the launcher can be easily reviewed in git.
-rw-r--r-- | .SRCINFO | 4 | ||||
-rw-r--r-- | PKGBUILD | 22 | ||||
-rw-r--r-- | brave.sh | 8 |
3 files changed, 15 insertions, 19 deletions
@@ -1,7 +1,7 @@ pkgbase = brave pkgdesc = Web browser that blocks ads and trackers by default. pkgver = 0.23.105 - pkgrel = 1 + pkgrel = 2 url = https://www.brave.com arch = x86_64 license = custom @@ -18,8 +18,10 @@ pkgbase = brave optdepends = pepper-flash: Adobe Flash support provides = brave-browser source = brave-0.23.105.tar.gz::https://github.com/brave/browser-laptop/archive/v0.23.105dev.tar.gz + source = brave.sh source = brave.desktop sha512sums = 30e11974d15df5a2c3b30f373542f214ac9f4c3ddbeed667a46036149f9f88828ab32fe98fcd3d37ad6d68fba379d1b69d6f1649f2f54836a1accc17199efceb + sha512sums = 985bc2ad94c20e9cc34bb65bc18d56d21f44e1df184a832c809dedb1814919b6396b85488a8cbe29bd312ef6d3553a96c13a59e34ca34a079686a25163d565e8 sha512sums = 400d345271a3c98be668e4aa08743d707647c92ee35951e937238ac07074119cfdb9601e1934cdf46014bd181b26ab0b568e4cab67c790efe53d029d8b0f9c55 pkgname = brave @@ -3,7 +3,7 @@ pkgname=brave pkgver=0.23.105 -pkgrel=1 +pkgrel=2 pkgdesc='Web browser that blocks ads and trackers by default.' arch=('x86_64') url='https://www.brave.com' @@ -14,8 +14,10 @@ optdepends=('cups: Printer support' 'pepper-flash: Adobe Flash support') provides=('brave-browser') source=("$pkgname-$pkgver.tar.gz::https://github.com/brave/browser-laptop/archive/v${pkgver}dev.tar.gz" + "$pkgname.sh" "$pkgname.desktop") sha512sums=('30e11974d15df5a2c3b30f373542f214ac9f4c3ddbeed667a46036149f9f88828ab32fe98fcd3d37ad6d68fba379d1b69d6f1649f2f54836a1accc17199efceb' + '985bc2ad94c20e9cc34bb65bc18d56d21f44e1df184a832c809dedb1814919b6396b85488a8cbe29bd312ef6d3553a96c13a59e34ca34a079686a25163d565e8' '400d345271a3c98be668e4aa08743d707647c92ee35951e937238ac07074119cfdb9601e1934cdf46014bd181b26ab0b568e4cab67c790efe53d029d8b0f9c55') _bdir=brave-linux-x64 @@ -30,10 +32,6 @@ build() { sed -i "s/require('git-rev-sync').long()/'${pkgver}dev'/" tools/buildPackage.js CHANNEL=dev npm run build-package - - if [[ ! (-r /proc/sys/kernel/unprivileged_userns_clone && $(< /proc/sys/kernel/unprivileged_userns_clone) == 1 && -n $(zcat /proc/config.gz | grep CONFIG_USER_NS=y) ) ]]; then - echo "User namespaces are not detected as enabled on your system, brave will run with the sandbox disabled" - fi } package() { @@ -42,19 +40,7 @@ package() { install -dm0755 "$pkgdir/usr/lib" cp -a --reflink=auto "$_bdir" "$pkgdir/usr/lib/$pkgname" - _launcher="$pkgdir/usr/bin/$pkgname" - install -Dm0755 /dev/stdin "$_launcher"<<END -#!/usr/bin/sh - -FLAG="--no-sandbox" - -if [[ -r /proc/sys/kernel/unprivileged_userns_clone && \$(< /proc/sys/kernel/unprivileged_userns_clone) == 1 && -n \$(zcat /proc/config.gz | grep CONFIG_USER_NS=y) ]]; then - FLAG="" -fi - -exec /usr/lib/$pkgname/brave "\$FLAG" -- "\$@" -END - + install -Dm0755 "$pkgname.sh" "$pkgdir/usr/bin/$pkgname" install -Dm0644 -t "$pkgdir/usr/share/applications/" "$pkgname.desktop" install -Dm0644 res/dev/app.png "$pkgdir/usr/share/pixmaps/$pkgname.png" install -Dm0644 LICENSE.txt "$pkgdir/usr/share/licenses/$pkgname/MPL2" diff --git a/brave.sh b/brave.sh new file mode 100644 index 000000000000..61a984503c24 --- /dev/null +++ b/brave.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +if [[ ! (-r /proc/sys/kernel/unprivileged_userns_clone && $(< /proc/sys/kernel/unprivileged_userns_clone) == 1 && -n $(zcat /proc/config.gz | grep CONFIG_USER_NS=y) ) ]]; then + >&2 echo "User namespaces are not detected as enabled on your system, brave will run with the sandbox disabled" + FLAG="--no-sandbox" +fi + +exec /usr/lib/brave/brave "$FLAG" -- "$@" |