blob: b5aca280166d8de608abcdf1dc16d7002dec1a8c (
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
# Maintainer: Patrik Sundberg <patrik.sundberg@gmail.com>
## options
: ${_autoupdate:=true}
: ${_system_electron:=true}
: ${_electron_version:=}
: ${_install_path:=opt}
[ -n "${_electron_version}" ] && _system_electron=true
: ${_pkgtype=-latest-bin}
# basic info
_pkgname='beeper'
pkgname="$_pkgname${_pkgtype:-}"
pkgver=3.108.3
pkgrel=1
pkgdesc="A unified messaging app"
url="https://beeper.com/"
license=('LicenseRef-beeper')
arch=('x86_64')
# main package
_main_package() {
_update_version
provides=("$_pkgname")
conflicts=("$_pkgname")
options=('!strip' '!debug')
source=("$_filename"::"$_dl_url")
sha256sums=('SKIP')
}
# common functions
pkgver() {
printf '%s' "${_pkgver:?}"
}
build() {
# extract appimage
chmod +x "$_filename"
"$srcdir/$_filename" --appimage-extract
# fix apprun script
sed -Ei \
's@^(if \[ -z \"\$APPDIR\" ] ; then)$@APPDIR="/'"$_install_path"'/beeper"\n\1@' \
"$srcdir/squashfs-root/AppRun"
}
_package_beeper() {
# apprun script
install -Dm755 "$srcdir/squashfs-root/AppRun" "$pkgdir/usr/bin/beeper"
# everything else
install -dm755 "$pkgdir/$_install_path"
mv "$srcdir/squashfs-root" "$pkgdir/$_install_path/beeper"
}
_package_asar() {
# script
install -Dm755 /dev/stdin "$pkgdir/usr/bin/$_pkgname" << END
#!/usr/bin/env sh
XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-\$HOME/.config}"
_ELECTRON=/usr/bin/electron${_electron_version:-}
_ASAR="/${_install_path}/$_pkgname/resources/app.asar"
_FLAGS_FILE="\$XDG_CONFIG_HOME/$_pkgname-flags.conf"
if [ -r "\$_FLAGS_FILE" ]; then
_USER_FLAGS="\$(cat "\$_FLAGS_FILE")"
fi
if [[ \$EUID -ne 0 ]] || [[ \$ELECTRON_RUN_AS_NODE ]]; then
exec \${_ELECTRON} \${_ASAR} \$_USER_FLAGS "\$@"
else
exec \${_ELECTRON} \${_ASAR} --no-sandbox \$_USER_FLAGS "\$@"
fi
END
# app.asar
install -dm755 "$pkgdir/$_install_path/$_pkgname"/resources
mv "$srcdir"/squashfs-root/resources/* "$pkgdir/$_install_path/$_pkgname"/resources/
}
package() {
depends+=('hicolor-icon-theme')
# desktop file
install -Dm644 /dev/stdin "$pkgdir/usr/share/applications/beeper.desktop" << END
[Desktop Entry]
Type=Application
Name=${_pkgname^}
GenericName=Unified Messenger
Comment=$pkgdesc
Exec=$_pkgname --no-sandbox %U
Icon=$_pkgname
Terminal=false
StartupWMClass=Beeper
Categories=Utility;
END
# icons
for s in 16 32 48 64 128 256 512 1024; do
install -Dm644 \
"$srcdir/squashfs-root/usr/share/icons/hicolor/${s}x${s}/apps/beeper.png" \
-t "$pkgdir/usr/share/icons/hicolor/${s}x${s}/apps"
done
# license files
install -Dm644 "$srcdir/squashfs-root/LICENSE.electron.txt" -t "$pkgdir/usr/share/licenses/$pkgname/"
install -Dm644 "$srcdir/squashfs-root/LICENSES.chromium.html" -t "$pkgdir/usr/share/licenses/$pkgname/"
if [[ "${_system_electron::1}" == "t" ]]; then
depends+=("electron${_electron_version:-}")
_package_asar
else
_package_beeper
fi
# fix permissions
chmod -R u+rwX,go+rX,go-w "$pkgdir"
}
# update version
_update_version() {
: ${_pkgver:=$pkgver}
if [[ "${_autoupdate::1}" != 't' ]]; then
return
fi
_dl_url="https://download.beeper.com/linux/appImage/x64"
_filename=$(
curl -v --no-progress-meter -r 0-1 "$_dl_url" 2>&1 > /dev/null \
| grep content-disposition \
| sed -E 's@^.*\bcontent-disposition:.*\bfilename="([^"]+)".*$@\1@'
)
_pkgver_new=$(
printf '%s' "$_filename" \
| sed -E 's@^beeper-([0-9]+\.[0-9]+\.[0-9]+)(.*)?.AppImage$@\1@'
)
# update _pkgver
if [ "$_pkgver" != "${_pkgver_new:?}" ]; then
_pkgver="$_pkgver_new"
fi
}
# execute
_main_package
|