From 27a74ff54348e1d9b21a8d10cacd74264f980ac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20H=C3=BCsers?= Date: Thu, 4 Jan 2024 15:07:13 +0100 Subject: [PATCH] upgpkg: discord-electron 0.0.39-2: update electron * Update Electron version to 27 * Update launch script to require config variable set in order to patch Krisp binary --- discord-electron/.SRCINFO | 8 ++++---- discord-electron/PKGBUILD | 6 +++--- discord-electron/discord-electron.install | 17 +++++++++++++---- discord-electron/discord-launcher.sh | 15 ++++++--------- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/discord-electron/.SRCINFO b/discord-electron/.SRCINFO index 25317d8..27ae8eb 100644 --- a/discord-electron/.SRCINFO +++ b/discord-electron/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = discord-electron - pkgdesc = Discord using system provided electron (v24) for increased security and performance + pkgdesc = Discord using system provided electron (v27) for increased security and performance pkgver = 0.0.39 - pkgrel = 1 + pkgrel = 2 url = https://discord.com install = discord-electron.install arch = x86_64 @@ -9,7 +9,7 @@ pkgbase = discord-electron makedepends = asar makedepends = curl makedepends = python-html2text - depends = electron24 + depends = electron27 depends = libxss optdepends = libpulse: Pulseaudio support optdepends = libappindicator-gtk3: Systray indicator support @@ -21,6 +21,6 @@ pkgbase = discord-electron source = https://dl.discordapp.net/apps/linux/0.0.39/discord-0.0.39.tar.gz source = discord-launcher.sh sha512sums = 9f18aea5d82f5db4efa9db9babbc440b24e47dc80df18df5cc58d99d677f1c0863df21ed96d69896785f8fbe0dc0ff1f7317398b8f39606289da79f5a38074f1 - sha512sums = 723250b70c7f5367701675c6581e9eac2143263910c4ffc35957a6ab858492c5febe89ea0d46fce19ac1416c23d9ca3953e48b9db5aa174b4a401fb6efa5daf5 + sha512sums = e68467468e9ebfe7aae873442998bda03212598a87d9af1b9ac976fdbafc81eb376e7770dccca6eb943d579f39717a0473fa4f0a46a0c3e436460688827a2dc7 pkgname = discord-electron diff --git a/discord-electron/PKGBUILD b/discord-electron/PKGBUILD index a9bcffd..b31630a 100644 --- a/discord-electron/PKGBUILD +++ b/discord-electron/PKGBUILD @@ -14,8 +14,8 @@ pkgname=discord-electron _pkgname=discord pkgver=0.0.39 -pkgrel=1 -_electronver=24 +pkgrel=2 +_electronver=27 _electronname="electron${_electronver}" pkgdesc="Discord using system provided electron (v${_electronver}) for increased security and performance" arch=('x86_64') @@ -36,7 +36,7 @@ optdepends=( source=("https://dl.discordapp.net/apps/linux/${pkgver}/${_pkgname}-${pkgver}.tar.gz" 'discord-launcher.sh') sha512sums=('9f18aea5d82f5db4efa9db9babbc440b24e47dc80df18df5cc58d99d677f1c0863df21ed96d69896785f8fbe0dc0ff1f7317398b8f39606289da79f5a38074f1' - '723250b70c7f5367701675c6581e9eac2143263910c4ffc35957a6ab858492c5febe89ea0d46fce19ac1416c23d9ca3953e48b9db5aa174b4a401fb6efa5daf5') + 'e68467468e9ebfe7aae873442998bda03212598a87d9af1b9ac976fdbafc81eb376e7770dccca6eb943d579f39717a0473fa4f0a46a0c3e436460688827a2dc7') _krisp_b2sum='310e3d5ad2311ceace91d20004a677c1a1e49fa1cd5c0458ee5bdb31c01c49df68cac625e66dadcaddf90c67568cde22c2cec3c0b6bca8385225141a8d8d53c1' diff --git a/discord-electron/discord-electron.install b/discord-electron/discord-electron.install index 3d13381..893fcd9 100644 --- a/discord-electron/discord-electron.install +++ b/discord-electron/discord-electron.install @@ -1,4 +1,12 @@ post_upgrade() { + # return if old package version is greater than or equal to 0.0.39-1... + (( $(vercmp $2 '0.0.39-2') >= 0 )) && return + + cat < In order to patch Krisp noise suppression support set 'PATCH_KRISP=true' + in '~/.config/discord.conf' in addition to having 'rizin' installed. +EOF + # return if old package version is greater than or equal to 0.0.27-5... (( $(vercmp $2 '0.0.27-5') >= 0 )) && return @@ -18,9 +26,10 @@ EOF post_install() { cat < For Krisp noise suppression support consider installing 'rizin'. Restart - your Discord client after installation or update to apply the patch. -==> In case of performance problems consider adding or uncommenting Electron - flags in '~/.config/discord-flags.conf'. +==> For Krisp noise suppression support consider installing 'rizin' and + setting 'PATCH_KRISP=true' in '~/.config/discord.conf'. Restart your + Discord client afterwards to apply the patch. +==> In case of performance problems consider setting additional flags + in '~/.config/discord-flags.conf'. EOF } diff --git a/discord-electron/discord-launcher.sh b/discord-electron/discord-launcher.sh index 1d29967..33d525c 100644 --- a/discord-electron/discord-launcher.sh +++ b/discord-electron/discord-launcher.sh @@ -5,29 +5,26 @@ set -euo pipefail declare -a flags +[[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@.conf" ]] && source "${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@.conf" + flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@-flags.conf" krisp_bin="${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@/@PKGVER@/modules/@PKGNAME@_krisp/@PKGNAME@_krisp.node" krisp_b2=@KRISPB2@ -if hash rizin &> /dev/null; then +if hash rizin &> /dev/null && [[ "${PATCH_KRISP}" == true ]]; then # Patch Krisp binary to ignore signature check - if [[ -f "${krisp_bin}" && $(b2sum "${krisp_bin}" | head -c 128) == $krisp_b2 ]]; then + if [[ -w "${krisp_bin}" && $(b2sum "${krisp_bin}" | head -c 128) == $krisp_b2 ]]; then addr=$(rz-find -x '4881ec00010000' "${krisp_bin}" | head -n1) rizin -q -w -c "s $addr + 0x30 ; wao nop" "${krisp_bin}" &> /dev/null fi fi -if [[ -f "${flags_file}" ]]; then +if [[ -w "${flags_file}" ]]; then + # Replacing because old flag does not work if grep -q '\--ignore-gpu-blacklist' "${flags_file}"; then sed -i "s|--ignore-gpu-blacklist|--ignore-gpu-blocklist|" "${flags_file}" fi mapfile -t < "${flags_file}" -else - cat > "${flags_file}" <