Compare commits
1 commit
9fafba484a
...
f1b9162b23
Author | SHA1 | Date | |
---|---|---|---|
f1b9162b23 |
4 changed files with 107 additions and 41 deletions
9
.SRCINFO
9
.SRCINFO
|
@ -1,15 +1,18 @@
|
||||||
pkgbase = discord_arch_electron
|
pkgbase = discord_arch_electron
|
||||||
pkgdesc = Discord (popular voice + video app) using the system provided electron for increased security and performance
|
pkgdesc = Discord using system provided electron (v29) for increased security and performance
|
||||||
pkgver = 0.0.54
|
pkgver = 0.0.54
|
||||||
pkgrel = 1
|
pkgrel = 2
|
||||||
url = https://discord.com
|
url = https://discord.com
|
||||||
|
install = discord_arch_electron.install
|
||||||
arch = any
|
arch = any
|
||||||
license = custom
|
license = custom
|
||||||
makedepends = asar
|
makedepends = asar
|
||||||
depends = electron29
|
depends = electron29
|
||||||
depends = libxss
|
depends = libxss
|
||||||
optdepends = libpulse: Pulseaudio support
|
optdepends = libpulse: Pulseaudio support
|
||||||
|
optdepends = libappindicator-gtk3: Systray indicator support
|
||||||
optdepends = xdg-utils: Open files
|
optdepends = xdg-utils: Open files
|
||||||
|
optdepends = rizin: Allow patching Krisp support
|
||||||
provides = discord
|
provides = discord
|
||||||
conflicts = discord
|
conflicts = discord
|
||||||
options = !strip
|
options = !strip
|
||||||
|
@ -18,7 +21,7 @@ pkgbase = discord_arch_electron
|
||||||
source = LICENSE.html::https://discord.com/terms
|
source = LICENSE.html::https://discord.com/terms
|
||||||
source = OSS-LICENSES.html::https://discord.com/licenses
|
source = OSS-LICENSES.html::https://discord.com/licenses
|
||||||
sha512sums = ceb6265e846fafd27e3c2941f00f0a2d4e045abe5471a2691b070bedb330ef345edee838a706b27ff65ecce40aec46b1a1dd9c4bb9763dadaa907ec181c1a222
|
sha512sums = ceb6265e846fafd27e3c2941f00f0a2d4e045abe5471a2691b070bedb330ef345edee838a706b27ff65ecce40aec46b1a1dd9c4bb9763dadaa907ec181c1a222
|
||||||
sha512sums = d398351b209cd89432d8e9cebe9122f152484236d8ca4dd91e5679d3853fe2f082625d35a9ac3f450f1f08250736bf3a23db9926311e8271730d884b57d12dbc
|
sha512sums = eb5043d09174b3e0dcb899ba5835e863ffdefe5f7e379ce4d01cfb7408a8727e7b0f58e405008f3d35c7675804fb051ee1517aa7ca20efc59610d9b93a664c35
|
||||||
sha512sums = SKIP
|
sha512sums = SKIP
|
||||||
sha512sums = SKIP
|
sha512sums = SKIP
|
||||||
|
|
||||||
|
|
86
PKGBUILD
86
PKGBUILD
|
@ -1,60 +1,86 @@
|
||||||
# Maintainer: Zoddo <archlinux+aur@zoddo.fr>
|
# Maintainer: Zoddo <archlinux+aur@zoddo.fr>
|
||||||
# Contributor: Thaodan <AUR+me@thaodan.de>
|
# Contributor: Thaodan <AUR+me@thaodan.de>
|
||||||
|
# Contributor: Manuel Hüsers <aur@huesers.de>
|
||||||
# Contributor: huyizheng
|
# Contributor: huyizheng
|
||||||
# Contributor: johnnyapol <arch@johnnyapol.me>
|
# Contributor: johnnyapol <arch@johnnyapol.me>
|
||||||
|
|
||||||
# Based off the discord community repo PKGBUILD by Filipe Laíns (FFY00) <lains@archlinux.org>
|
# Based off the discord community repo PKGBUILD by Filipe Laíns (FFY00) <lains@archlinux.org>
|
||||||
|
|
||||||
_pkgname=discord
|
_pkgname=discord
|
||||||
_electron=electron29
|
_electronver=29
|
||||||
|
_electronname="electron${_electronver}"
|
||||||
pkgname=${_pkgname}_arch_electron
|
pkgname=${_pkgname}_arch_electron
|
||||||
pkgver=0.0.54
|
pkgver=0.0.54
|
||||||
pkgrel=1
|
pkgrel=2
|
||||||
pkgdesc="Discord (popular voice + video app) using the system provided electron for increased security and performance"
|
pkgdesc="Discord using system provided electron (v${_electronver}) for increased security and performance"
|
||||||
arch=('any')
|
arch=('any')
|
||||||
provides=("${_pkgname}")
|
provides=("${_pkgname}")
|
||||||
conflicts=("${_pkgname}")
|
conflicts=("${_pkgname}")
|
||||||
url='https://discord.com'
|
url='https://discord.com'
|
||||||
license=('custom')
|
license=('custom')
|
||||||
options=(!strip)
|
options=('!strip')
|
||||||
depends=("${_electron}" 'libxss')
|
install="$pkgname.install"
|
||||||
|
depends=("${_electronname}" 'libxss')
|
||||||
makedepends=('asar')
|
makedepends=('asar')
|
||||||
optdepends=('libpulse: Pulseaudio support'
|
optdepends=('libpulse: Pulseaudio support'
|
||||||
'xdg-utils: Open files')
|
'libappindicator-gtk3: Systray indicator support'
|
||||||
source=("https://dl.discordapp.net/apps/linux/$pkgver/$_pkgname-$pkgver.tar.gz"
|
'xdg-utils: Open files'
|
||||||
|
'rizin: Allow patching Krisp support')
|
||||||
|
source=("https://dl.discordapp.net/apps/linux/${pkgver}/${_pkgname}-${pkgver}.tar.gz"
|
||||||
'discord-launcher.sh'
|
'discord-launcher.sh'
|
||||||
'LICENSE.html::https://discord.com/terms'
|
'LICENSE.html::https://discord.com/terms'
|
||||||
'OSS-LICENSES.html::https://discord.com/licenses')
|
'OSS-LICENSES.html::https://discord.com/licenses')
|
||||||
sha512sums=('ceb6265e846fafd27e3c2941f00f0a2d4e045abe5471a2691b070bedb330ef345edee838a706b27ff65ecce40aec46b1a1dd9c4bb9763dadaa907ec181c1a222'
|
sha512sums=('ceb6265e846fafd27e3c2941f00f0a2d4e045abe5471a2691b070bedb330ef345edee838a706b27ff65ecce40aec46b1a1dd9c4bb9763dadaa907ec181c1a222'
|
||||||
'd398351b209cd89432d8e9cebe9122f152484236d8ca4dd91e5679d3853fe2f082625d35a9ac3f450f1f08250736bf3a23db9926311e8271730d884b57d12dbc'
|
'eb5043d09174b3e0dcb899ba5835e863ffdefe5f7e379ce4d01cfb7408a8727e7b0f58e405008f3d35c7675804fb051ee1517aa7ca20efc59610d9b93a664c35'
|
||||||
SKIP
|
'SKIP'
|
||||||
SKIP)
|
'SKIP')
|
||||||
|
|
||||||
|
_krisp_b2sum='c4e49b1a0be64cacd23474c5e474130084755f2de36af01686ce94c6eceea67426b6d6aa81889a418f9d08476476e99d63479b6131d1f7eaef987ecf4d779cf9'
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
sed -i "s|@PKGNAME@|${_pkgname}|;s|@ELECTRON@|${_electron}|" discord-launcher.sh
|
# prepare launcher script
|
||||||
sed -i "s|Exec=.*|Exec=/usr/bin/$_pkgname|" Discord/discord.desktop
|
sed -i -e "s|@PKGNAME@|${_pkgname}|" \
|
||||||
|
-e "s|@PKGVER@|${pkgver}|" \
|
||||||
|
-e "s|@ELECTRON@|${_electronname}|" \
|
||||||
|
-e "s|@KRISPB2@|${_krisp_b2sum}|" \
|
||||||
|
discord-launcher.sh
|
||||||
|
|
||||||
# HACKS FOR SYSTEM ELECTRON
|
# fix the .desktop file
|
||||||
asar e Discord/resources/app.asar Discord/resources/app
|
sed -i -e "s|Exec=.*|Exec=/usr/bin/${_pkgname}|" ${_pkgname^}/$_pkgname.desktop
|
||||||
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
|
build() {
|
||||||
sed -i -E "s|resourcesPath = _path.+;|resourcesPath = '/usr/share/${_pkgname}/resources';|" Discord/resources/app/common/paths.js
|
cd "${srcdir}"/${_pkgname^}
|
||||||
asar p Discord/resources/app Discord/resources/app.asar
|
|
||||||
rm -rf Discord/resources/app
|
# 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
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
# Install the app
|
# create necessary directories
|
||||||
install -d "${pkgdir}/usr/share/${_pkgname}/resources"
|
install -d "${pkgdir}"/usr/share/$_pkgname
|
||||||
|
|
||||||
# Copy Relevanat data
|
# copy relevant data
|
||||||
cp -r Discord/resources/* "${pkgdir}/usr/share/${_pkgname}/resources/"
|
cp -r ${_pkgname^}/resources "${pkgdir}"/usr/share/$_pkgname/
|
||||||
|
|
||||||
install -Dm 755 "${srcdir}/discord-launcher.sh" "${pkgdir}/usr/bin/${_pkgname}"
|
# 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 644 Discord/discord.png "${pkgdir}/usr/share/pixmaps/${_pkgname}.png"
|
# install the launch script
|
||||||
install -Dm 644 Discord/discord.desktop "${pkgdir}/usr/share/applications/${_pkgname}.desktop"
|
install -Dm 755 discord-launcher.sh "${pkgdir}"/usr/bin/$_pkgname
|
||||||
|
|
||||||
# Licenses
|
# install licenses
|
||||||
install -Dm 644 LICENSE.html "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.html
|
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
|
install -Dm 644 OSS-LICENSES.html "${pkgdir}"/usr/share/licenses/$_pkgname/OSS-LICENSES.html
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,29 @@
|
||||||
#!/usr/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
name=@PKGNAME@
|
name=@PKGNAME@
|
||||||
|
ver=@PKGVER@
|
||||||
electron=@ELECTRON@
|
electron=@ELECTRON@
|
||||||
flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/${name}-flags.conf"
|
krisp_b2=@KRISPB2@
|
||||||
|
|
||||||
declare -a flags
|
declare -a flags
|
||||||
|
declare PATCH_KRISP
|
||||||
|
|
||||||
if [[ -f "${flags_file}" ]]; then
|
[[ -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
|
||||||
mapfile -t < "${flags_file}"
|
mapfile -t < "${flags_file}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -18,4 +33,7 @@ for line in "${MAPFILE[@]}"; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
exec /usr/bin/${electron} /usr/share/${name}/resources/app.asar "${flags[@]}" "$@"
|
exec /usr/bin/${electron} \
|
||||||
|
/usr/share/${name}/resources/app.asar \
|
||||||
|
--ozone-platform-hint=auto \
|
||||||
|
"${flags[@]}" "$@"
|
||||||
|
|
19
discord_arch_electron.install
Normal file
19
discord_arch_electron.install
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
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
|
||||||
|
}
|
Loading…
Reference in a new issue