upgpkg: discord-electron 0.0.27-2

Update Discord launcher script (Original by Zoddo)
Add libxss as dependency to fix Discord corruption warning
Add install script to notify user about discord-flags.conf
Remove duplicate Path variable in .desktop file
Update contributor list
This commit is contained in:
Manuel 2023-05-27 20:10:10 +02:00
parent 3a61d93bdc
commit 8e5c1e134d
4 changed files with 63 additions and 36 deletions

View file

@ -1,20 +1,24 @@
pkgbase = discord-electron
pkgdesc = Discord using system provided electron (v22) for increased security and performance
pkgver = 0.0.27
pkgrel = 1
pkgrel = 2
url = https://discord.com
install = discord-electron.install
arch = x86_64
license = custom
makedepends = asar
makedepends = curl
makedepends = python-html2text
depends = electron22
depends = libxss
optdepends = libpulse: Pulseaudio support
optdepends = xdg-utils: Open files
provides = discord
conflicts = discord
options = !strip
source = https://dl.discordapp.net/apps/linux/0.0.27/discord-0.0.27.tar.gz
source = discord-launcher.sh
sha512sums = 285a0119b4740402a3fa94d3679a52bc8d883413ee32187e90087960a4d34aaf316788d2708bbccafe3f995c2b99767b45bc4b7c731704ef887a8de1b3d3926f
sha512sums = d8c531d23014611b1e9dfa2d268747ba601f647c2cbfc26c15c9eebcec6f9feb454d10c6f603b9938e8da568da3080372b14309e966e0d00c0e1284a14591a83
pkgname = discord-electron

View file

@ -1,4 +1,6 @@
# Maintainer: Manuel Hüsers <aur@huesers.de>
# Contributor: Zoddo <archlinux+aur@zoddo.fr>
# Contributor: Thaodan <AUR+me@thaodan.de>
# Contributor: Stick <stick@stma.is>
# Contributor: johnnyapol <arch@johnnyapol.me>
# Contributor: huyizheng <huyizheng@hotmail.com>
@ -6,14 +8,14 @@
# Contributor: Morgan <morganamilo@archlinux.org>
# Based off the discord_arch_electron_wayland PKGBUILD from Stick
# Based off the discord_arch_electron PKGBUILD from johnnyapol and huyizheng
# Based off the discord_arch_electron PKGBUILD from johnnyapol, huyizheng, Thaodan and Zoddo
# Based off the discord community repo PKGBUILD by Filipe Laíns (FFY00)
pkgname=discord-electron
_pkgname=discord
_electron=22
pkgver=0.0.27
pkgrel=1
pkgrel=2
pkgdesc="Discord using system provided electron (v${_electron}) for increased security and performance"
arch=('x86_64')
provides=("${_pkgname}")
@ -21,49 +23,24 @@ conflicts=("${_pkgname}")
url='https://discord.com'
license=('custom')
options=('!strip')
depends=("electron${_electron}")
install="$pkgname.install"
depends=("electron${_electron}" 'libxss')
makedepends=('asar' 'curl' 'python-html2text')
optdepends=(
'libpulse: Pulseaudio support'
'xdg-utils: Open files'
)
source=("https://dl.discordapp.net/apps/linux/${pkgver}/discord-${pkgver}.tar.gz")
sha512sums=('285a0119b4740402a3fa94d3679a52bc8d883413ee32187e90087960a4d34aaf316788d2708bbccafe3f995c2b99767b45bc4b7c731704ef887a8de1b3d3926f')
source=("https://dl.discordapp.net/apps/linux/${pkgver}/discord-${pkgver}.tar.gz"
'discord-launcher.sh')
sha512sums=('285a0119b4740402a3fa94d3679a52bc8d883413ee32187e90087960a4d34aaf316788d2708bbccafe3f995c2b99767b45bc4b7c731704ef887a8de1b3d3926f'
'd8c531d23014611b1e9dfa2d268747ba601f647c2cbfc26c15c9eebcec6f9feb454d10c6f603b9938e8da568da3080372b14309e966e0d00c0e1284a14591a83')
prepare() {
# create launcher script
cat >> "${srcdir}"/discord-launcher.sh <<EOF
#!/bin/sh
if [ "\$XDG_SESSION_TYPE" = wayland ]; then
# Using wayland
exec electron${_electron} \\
--enable-features=UseOzonePlatform \\
--ozone-platform=wayland \\
--enable-accelerated-mjpeg-decode \\
--enable-accelerated-video \\
--ignore-gpu-blacklist \\
--enable-native-gpu-memory-buffers \\
--enable-gpu-rasterization \\
--enable-gpu \\
--enable-features=WebRTCPipeWireCapturer \\
/usr/lib/discord/app.asar \$@
else
# Using x11
exec electron${_electron} \\
--enable-accelerated-mjpeg-decode \\
--enable-accelerated-video \\
--ignore-gpu-blacklist \\
--enable-native-gpu-memory-buffers \\
--enable-gpu-rasterization \\
--enable-gpu \\
/usr/lib/discord/app.asar \$@
fi
EOF
# prepare launcher and install script
sed -i "s|@PKGNAME@|${_pkgname}|;s|@ELECTRON@|${_electron}|" discord-launcher.sh
# fix the .desktop file
sed -i "s|Exec=.*|Exec=/usr/bin/${_pkgname}|" Discord/$_pkgname.desktop
echo 'Path=/usr/bin' >> Discord/$_pkgname.desktop
# create the license files
curl https://discord.com/terms | html2text >"${srcdir}"/LICENSE.md

18
discord-electron.install Normal file
View file

@ -0,0 +1,18 @@
post_upgrade() {
# return if old package version is greater than or equal to 0.0.27-2...
(( $(vercmp $2 '0.0.27-2') >= 0 )) && return
cat <<EOF
==> You can now add or uncomment additional Electron flags in
'~/.config/discord-flags.conf' (if XDG_CONFIG_HOME is not set)
EOF
}
post_install() {
cat <<EOF
==> In case of performance problems consider adding or uncommenting Electron
flags in '~/.config/discord-flags.conf' (if XDG_CONFIG_HOME is not set)
EOF
}

28
discord-launcher.sh Normal file
View file

@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail
flags_file="${XDG_CONFIG_HOME:-$HOME/.config}/@PKGNAME@-flags.conf"
declare -a flags
if [[ -f "${flags_file}" ]]; then
mapfile -t < "${flags_file}"
else
cat > "${flags_file}" <<EOF
#--ignore-gpu-blacklist
#--enable-gpu-rasterization
#--enable-zero-copy
EOF
fi
for line in "${MAPFILE[@]}"; do
if [[ ! "${line}" =~ ^[[:space:]]*#.* ]]; then
flags+=("${line}")
fi
done
exec /usr/bin/electron@ELECTRON@ \
/usr/lib/@PKGNAME@/app.asar \
--ozone-platform-hint=auto \
"${flags[@]}" "$@"