blob: 92f35fe2698aad578505eeef105860150db314cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# Maintained by Kodehawa <david.alejandro.rubio at gmail.com>
# Contributor: FivePB <admin@fivepb.me>
# Contributor: Auxim <hello@auxim.dev>
# Original discord_arch_electron PKGBUILD:
# Maintained by johnnyapol (arch@johnnyapol.me)
# Original mantainers below:
# Based off the discord community repo PKGBUILD by Filipe LaĆns (FFY00) <lains@archlinux.org>
# Maintainer: Anna <morganamilo@gmail.com>
# Maintainer: E5ten <e5ten.arch@gmail.com>
# Maintainer: Parker Reed <parker.l.reed@gmail.com>
# Maintainer: Stephanie Wilde-Hobbs <steph@rx14.co.uk>
# Contributor: Cayde Dixon <me@cazzar.net>
# Contributor: Anthony Anderson <aantony4122@gmail.com>
pkgname=discord-canary-electron-bin
_pkgname=discord-canary
pkgver=0.0.394
pkgrel=1
pkgdesc="Discord Canary (popular voice + video app) using the system provided electron for increased security and performance"
arch=('x86_64')
provides=('discord-canary')
conflicts=('discord-canary')
url='https://canary.discordapp.com'
license=('custom')
options=(!strip)
depends=('electron29' 'gtk3' 'libnotify' 'libxss' 'glibc' 'alsa-lib' 'nspr' 'nss' 'xdg-utils' 'libcups' 'unzip')
makedepends=('asar')
optdepends=('libpulse: Pulseaudio support'
'xdg-utils: Open files'
'noto-fonts-emoji: Google font for emoji support.'
'ttf-symbola: Font for emoji support.'
'noto-fonts-cjk: Font for special characters such as /shrug face.')
source=("https://dl-canary.discordapp.net/apps/linux/${pkgver}/${_pkgname}-${pkgver}.tar.gz"
'LICENSE.html::https://discordapp.com/terms'
'OSS-LICENSES.html::https://discordapp.com/licenses'
'installed.json'
)
# Skip SHA256 of licenses, it fails always for some reason.
sha256sums=('9d0f33c16dd32d1787ee7517775da33d1ebf70e7d8beade7f9235679ca99e1aa'
'SKIP'
'SKIP'
'5afdfdcb67493946553cad1255e1084add21392171d8ffb79c0ce76865e71f0a'
)
# The tar extracts to a folder called DiscordCanary.
_tarname=DiscordCanary
#installed.json needs to be copied to this folder or the updater breaks
_discordmodules='${DISCORD_USER_DATA_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}}'/discordcanary/$pkgver/modules/
prepare() {
# Extract the downloaded tar.
tar xf ${_pkgname}-${pkgver}.tar.gz
cd $_tarname
sed -i "s|Exec=.*|Exec=/usr/bin/$_pkgname|" $_pkgname.desktop
echo 'Path=/usr/bin' >> $_pkgname.desktop
}
package() {
# Install the app
install -d "$pkgdir"/usr/lib/$_pkgname
# HACKS FOR SYSTEM ELECTRON
# Thanks to the discord_arch_electron guy for this ;)
# Thanks to https://aur.archlinux.org/packages/discord_arch_electron/#comment-776307 for the less-hacky fix.
asar e $_tarname/resources/app.asar $_tarname/resources/app
sed -i "s|process.resourcesPath|'/usr/lib/$_pkgname'|" $_tarname/resources/app/app_bootstrap/buildInfo.js
sed -i "s|exeDir,|'/usr/share/pixmaps',|" $_tarname/resources/app/app_bootstrap/autoStart/linux.js
# Hack for Electron 29+
sed -i -E "s|resourcesPath = _path.+;|resourcesPath = '/usr/share/${_pkgname}/resources';|" $_tarname/resources/app/common/paths.js
sed -i "s|module.paths = \[\]|module.paths = \[process.env.HOME + '/.config/discordcanary/$pkgver/modules'\]|" $_tarname/resources/app/app_bootstrap/requireNative.js
asar p $_tarname/resources/app $_tarname/resources/app.asar --unpack-dir '**'
rm -rf $_tarname/resources/app
# Copy relevant data
cp -r "$_tarname"/resources/* "$pkgdir"/usr/lib/$_pkgname/
#Install the file needed to bootstrap the updater
install -Dm 644 installed.json "$pkgdir"/usr/lib/$_pkgname/
# Create starter script for discord
echo "#!/bin/sh" > "$srcdir"/$_pkgname
echo "if ! [ -f $_discordmodules/installed.json ]; then mkdir -p $_discordmodules && cp /usr/lib/$_pkgname/installed.json $_discordmodules; fi" >> "$srcdir/$_pkgname"
echo "exec electron29 /usr/lib/$_pkgname/app.asar \$@" >> "$srcdir"/$_pkgname
install -d "$pkgdir"/usr/{bin,share/{pixmaps,applications}}
install -Dm 755 $_pkgname "$pkgdir"/usr/bin/$_pkgname
cp $_tarname/discord.png "$pkgdir"/usr/share/pixmaps/$_pkgname.png
cp $_tarname/$_pkgname.desktop "$pkgdir"/usr/share/applications/$_pkgname.desktop
# 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
}
|