upgpkg: discord-electron-openasar 0.0.27+809-2

Update to latest OpenAsar commit
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:31 +02:00
parent 1bef331b50
commit c09839e474
4 changed files with 63 additions and 38 deletions

View file

@ -1,8 +1,9 @@
pkgbase = discord-electron-openasar
pkgdesc = Discord packaged with OpenAsar using system provided electron (v22) for increased security and performance
pkgver = 0.0.27+808
pkgrel = 1
pkgver = 0.0.27+809
pkgrel = 2
url = https://discord.com
install = discord-electron-openasar.install
arch = x86_64
license = custom
makedepends = git
@ -11,14 +12,17 @@ pkgbase = discord-electron-openasar
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 = git+https://github.com/goosemod/openasar.git#commit=99cd4f53bf910f5f6ce5234905126f261a35fefa
source = discord-launcher.sh
source = git+https://github.com/goosemod/openasar.git#commit=a8b07392808032f95ac3a7c5856e76d2619c91ae
sha512sums = 285a0119b4740402a3fa94d3679a52bc8d883413ee32187e90087960a4d34aaf316788d2708bbccafe3f995c2b99767b45bc4b7c731704ef887a8de1b3d3926f
sha512sums = d8c531d23014611b1e9dfa2d268747ba601f647c2cbfc26c15c9eebcec6f9feb454d10c6f603b9938e8da568da3080372b14309e966e0d00c0e1284a14591a83
sha512sums = SKIP
pkgname = discord-electron-openasar

View file

@ -1,15 +1,15 @@
# Maintainer: Manuel Hüsers <aur@huesers.de>
# 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-openasar
_pkgname=discord
_electron=22
pkgver=0.0.27+808
pkgver=0.0.27+809
_pkgver=${pkgver%%+*}
pkgrel=1
pkgrel=2
pkgdesc="Discord packaged with OpenAsar using system provided electron (v${_electron}) for increased security and performance"
arch=('x86_64')
provides=("${_pkgname}")
@ -17,15 +17,18 @@ conflicts=("${_pkgname}")
url='https://discord.com'
license=('custom')
options=('!strip')
depends=("electron${_electron}")
install="$pkgname.install"
depends=("electron${_electron}" 'libxss')
makedepends=('git' 'asar' 'nodejs' 'curl' 'python-html2text')
optdepends=(
'libpulse: Pulseaudio support'
'xdg-utils: Open files'
)
source=("https://dl.discordapp.net/apps/linux/${_pkgver}/discord-${_pkgver}.tar.gz"
"git+https://github.com/goosemod/openasar.git#commit=99cd4f53bf910f5f6ce5234905126f261a35fefa")
'discord-launcher.sh'
"git+https://github.com/goosemod/openasar.git#commit=a8b07392808032f95ac3a7c5856e76d2619c91ae")
sha512sums=('285a0119b4740402a3fa94d3679a52bc8d883413ee32187e90087960a4d34aaf316788d2708bbccafe3f995c2b99767b45bc4b7c731704ef887a8de1b3d3926f'
'd8c531d23014611b1e9dfa2d268747ba601f647c2cbfc26c15c9eebcec6f9feb454d10c6f603b9938e8da568da3080372b14309e966e0d00c0e1284a14591a83'
'SKIP')
# just in case I get the version wrong
@ -35,39 +38,11 @@ pkgver() {
}
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

View file

@ -0,0 +1,18 @@
post_upgrade() {
# return if old package version is greater than or equal to 0.0.27+809-2...
(( $(vercmp $2 '0.0.27+809-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[@]}" "$@"