Compare commits

..

No commits in common. "f1b9162b231d337476cb9ec048fa9bac9d43968d" and "79c02a964e4fd7bc9aa0b38aaa446586a0279edd" have entirely different histories.

4 changed files with 47 additions and 113 deletions

View file

@ -1,27 +1,24 @@
pkgbase = discord_arch_electron
pkgdesc = Discord using system provided electron (v29) for increased security and performance
pkgver = 0.0.54
pkgrel = 2
pkgdesc = Discord (popular voice + video app) using the system provided electron for increased security and performance
pkgver = 0.0.46
pkgrel = 1
url = https://discord.com
install = discord_arch_electron.install
arch = any
license = custom
makedepends = asar
depends = electron29
depends = electron
depends = libxss
optdepends = libpulse: Pulseaudio support
optdepends = libappindicator-gtk3: Systray indicator support
optdepends = xdg-utils: Open files
optdepends = rizin: Allow patching Krisp support
provides = discord
conflicts = discord
options = !strip
source = https://dl.discordapp.net/apps/linux/0.0.54/discord-0.0.54.tar.gz
source = https://dl.discordapp.net/apps/linux/0.0.46/discord-0.0.46.tar.gz
source = discord-launcher.sh
source = LICENSE.html::https://discord.com/terms
source = OSS-LICENSES.html::https://discord.com/licenses
sha512sums = ceb6265e846fafd27e3c2941f00f0a2d4e045abe5471a2691b070bedb330ef345edee838a706b27ff65ecce40aec46b1a1dd9c4bb9763dadaa907ec181c1a222
sha512sums = eb5043d09174b3e0dcb899ba5835e863ffdefe5f7e379ce4d01cfb7408a8727e7b0f58e405008f3d35c7675804fb051ee1517aa7ca20efc59610d9b93a664c35
sha512sums = 7f88a1f5281beb5bcdb9741ae4d984ec71c09931f31c4265e15f63b5710baff0124b38421971e45e217e20d7de14e4b5ab9e0b7da6afc3eb8ff3456643f692e8
sha512sums = d398351b209cd89432d8e9cebe9122f152484236d8ca4dd91e5679d3853fe2f082625d35a9ac3f450f1f08250736bf3a23db9926311e8271730d884b57d12dbc
sha512sums = SKIP
sha512sums = SKIP

View file

@ -1,86 +1,60 @@
# Maintainer: Zoddo <archlinux+aur@zoddo.fr>
# Contributor: Thaodan <AUR+me@thaodan.de>
# Contributor: Manuel Hüsers <aur@huesers.de>
# Contributor: huyizheng
# Contributor: johnnyapol <arch@johnnyapol.me>
# Based off the discord community repo PKGBUILD by Filipe Laíns (FFY00) <lains@archlinux.org>
_pkgname=discord
_electronver=29
_electronname="electron${_electronver}"
_electron=electron
pkgname=${_pkgname}_arch_electron
pkgver=0.0.54
pkgrel=2
pkgdesc="Discord using system provided electron (v${_electronver}) for increased security and performance"
pkgver=0.0.46
pkgrel=1
pkgdesc="Discord (popular voice + video app) using the system provided electron for increased security and performance"
arch=('any')
provides=("${_pkgname}")
conflicts=("${_pkgname}")
url='https://discord.com'
license=('custom')
options=('!strip')
install="$pkgname.install"
depends=("${_electronname}" 'libxss')
options=(!strip)
depends=("${_electron}" 'libxss')
makedepends=('asar')
optdepends=('libpulse: Pulseaudio support'
'libappindicator-gtk3: Systray indicator support'
'xdg-utils: Open files'
'rizin: Allow patching Krisp support')
source=("https://dl.discordapp.net/apps/linux/${pkgver}/${_pkgname}-${pkgver}.tar.gz"
'xdg-utils: Open files')
source=("https://dl.discordapp.net/apps/linux/$pkgver/$_pkgname-$pkgver.tar.gz"
'discord-launcher.sh'
'LICENSE.html::https://discord.com/terms'
'OSS-LICENSES.html::https://discord.com/licenses')
sha512sums=('ceb6265e846fafd27e3c2941f00f0a2d4e045abe5471a2691b070bedb330ef345edee838a706b27ff65ecce40aec46b1a1dd9c4bb9763dadaa907ec181c1a222'
'eb5043d09174b3e0dcb899ba5835e863ffdefe5f7e379ce4d01cfb7408a8727e7b0f58e405008f3d35c7675804fb051ee1517aa7ca20efc59610d9b93a664c35'
'SKIP'
'SKIP')
_krisp_b2sum='c4e49b1a0be64cacd23474c5e474130084755f2de36af01686ce94c6eceea67426b6d6aa81889a418f9d08476476e99d63479b6131d1f7eaef987ecf4d779cf9'
sha512sums=('7f88a1f5281beb5bcdb9741ae4d984ec71c09931f31c4265e15f63b5710baff0124b38421971e45e217e20d7de14e4b5ab9e0b7da6afc3eb8ff3456643f692e8'
'd398351b209cd89432d8e9cebe9122f152484236d8ca4dd91e5679d3853fe2f082625d35a9ac3f450f1f08250736bf3a23db9926311e8271730d884b57d12dbc'
SKIP
SKIP)
prepare() {
# prepare launcher script
sed -i -e "s|@PKGNAME@|${_pkgname}|" \
-e "s|@PKGVER@|${pkgver}|" \
-e "s|@ELECTRON@|${_electronname}|" \
-e "s|@KRISPB2@|${_krisp_b2sum}|" \
discord-launcher.sh
sed -i "s|@PKGNAME@|${_pkgname}|;s|@ELECTRON@|${_electron}|" discord-launcher.sh
sed -i "s|Exec=.*|Exec=/usr/bin/$_pkgname|" Discord/discord.desktop
# fix the .desktop file
sed -i -e "s|Exec=.*|Exec=/usr/bin/${_pkgname}|" ${_pkgname^}/$_pkgname.desktop
}
build() {
cd "${srcdir}"/${_pkgname^}
# use system electron
asar e resources/app.asar resources/app
rm resources/app.asar
sed -i -e "s|resourcesPath = _path.*;|resourcesPath = '/usr/share/${_pkgname}/resources';|" resources/app/common/paths.js
sed -i -e "s|process.resourcesPath|'/usr/share/${_pkgname}/resources'|" resources/app/app_bootstrap/buildInfo.js
sed -i -e "/^const appName/d" -e "/^const exePath/d" -e "/^const exeDir/d" -e "/^const iconPath/d" \
-e "s|^Exec=\${exePath}$|Exec=/usr/bin/${_pkgname}|" \
-e "s|^Name=\${appName}$|Name=${_pkgname^}|" \
-e "s|^Icon=\${iconPath}$|Icon=/usr/share/pixmaps/${_pkgname}.png|" \
resources/app/app_bootstrap/autoStart/linux.js
asar p resources/app resources/app.asar
rm -rf resources/app
# HACKS FOR SYSTEM ELECTRON
asar e Discord/resources/app.asar Discord/resources/app
rm Discord/resources/app.asar
sed -i "s|process.resourcesPath|'/usr/share/${_pkgname}/resources'|" Discord/resources/app/app_bootstrap/buildInfo.js
sed -i "s|exeDir,|'/usr/share/pixmaps',|" Discord/resources/app/app_bootstrap/autoStart/linux.js
sed -i -E "s|resourcesPath = _path.+;|resourcesPath = '/usr/share/${_pkgname}/resources';|" Discord/resources/app/common/paths.js
asar p Discord/resources/app Discord/resources/app.asar
rm -rf Discord/resources/app
}
package() {
# create necessary directories
install -d "${pkgdir}"/usr/share/$_pkgname
# Install the app
install -d "${pkgdir}/usr/share/${_pkgname}/resources"
# copy relevant data
cp -r ${_pkgname^}/resources "${pkgdir}"/usr/share/$_pkgname/
# Copy Relevanat data
cp -r Discord/resources/* "${pkgdir}/usr/share/${_pkgname}/resources/"
# intall icon and desktop file
install -Dm 644 ${_pkgname^}/$_pkgname.png "${pkgdir}"/usr/share/pixmaps/$_pkgname.png
install -Dm 644 ${_pkgname^}/$_pkgname.desktop "${pkgdir}"/usr/share/applications/$_pkgname.desktop
install -Dm 755 "${srcdir}/discord-launcher.sh" "${pkgdir}/usr/bin/${_pkgname}"
# install the launch script
install -Dm 755 discord-launcher.sh "${pkgdir}"/usr/bin/$_pkgname
install -Dm 644 Discord/discord.png "${pkgdir}/usr/share/pixmaps/${_pkgname}.png"
install -Dm 644 Discord/discord.desktop "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
# install licenses
install -Dm 644 LICENSE.html "${pkgdir}"/usr/share/licenses/$_pkgname/LICENSE.html
install -Dm 644 OSS-LICENSES.html "${pkgdir}"/usr/share/licenses/$_pkgname/OSS-LICENSES.html
# Licenses
install -Dm 644 LICENSE.html "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.html
install -Dm 644 OSS-LICENSES.html "$pkgdir"/usr/share/licenses/$pkgname/OSS-LICENSES.html
}

View file

@ -1,29 +1,14 @@
#!/usr/bin/env bash
#!/usr/bin/bash
set -euo pipefail
name=@PKGNAME@
ver=@PKGVER@
electron=@ELECTRON@
krisp_b2=@KRISPB2@
flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/${name}-flags.conf"
declare -a flags
declare PATCH_KRISP
[[ -r "${XDG_CONFIG_HOME:-$HOME/.config}/${name}.conf" ]] && source "${XDG_CONFIG_HOME:-$HOME/.config}/${name}.conf"
flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/${name}-flags.conf"
krisp_bin="${DISCORD_USER_DATA_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/${name}}/${ver}/modules/${name}_krisp/${name}_krisp.node"
if hash rizin &> /dev/null && [[ "${PATCH_KRISP}" == true ]]; then
# Patch Krisp binary to ignore signature check
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 [[ -r "${flags_file}" ]]; then
if [[ -f "${flags_file}" ]]; then
mapfile -t < "${flags_file}"
fi
@ -33,7 +18,4 @@ for line in "${MAPFILE[@]}"; do
fi
done
exec /usr/bin/${electron} \
/usr/share/${name}/resources/app.asar \
--ozone-platform-hint=auto \
"${flags[@]}" "$@"
exec /usr/bin/${electron} /usr/share/${name}/resources/app.asar "${flags[@]}" "$@"

View file

@ -1,19 +0,0 @@
post_upgrade() {
# return if old package version is greater than or equal to 0.0.54-2...
(( $(vercmp $2 '0.0.54-2') >= 0 )) && return
cat <<EOF
==> In order to patch Krisp noise suppression support set 'PATCH_KRISP=true'
in '~/.config/discord.conf' in addition to having 'rizin' installed.
EOF
}
post_install() {
cat <<EOF
==> 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
}