blob: 64d0d56d4da08c57d805e5dcbe21d921b4ba87fc (
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
|
# Based on the template from https://daveparrish.net/posts/2019-11-16-Better-AppImage-PKGBUILD-template.html
# Maintainer : Sergey Kostrukov <sergey at kostrukov dot com>
# Contributor : Tianrui Wei <archlinux_aur at mail dot tianrui-wei dot com>
# Contributor : Marcio Silva <marcionps at gmail dot com>
_pkgname=todoist
pkgname="${_pkgname}"-appimage
pkgver=9.36.2
pkgrel=1
pkgdesc="The to-do list to organize work & life."
arch=('x86_64')
url="https://todoist.com/"
license=('custom:Commercial')
depends=('zlib' 'fuse2' 'appimagelauncher')
options=('!strip' '!debug')
_appimage="${pkgname}-${pkgver}.AppImage"
source_x86_64=("${_appimage}::https://electron-dl.todoist.net/linux/Todoist-linux-${pkgver}-x86_64-latest.AppImage")
noextract=("${_appimage}")
sha256sums_x86_64=('288e9bd275ff6ff36ea3b8aff3585c8e30691550c273a2bf056dc029b08a4c7b')
prepare() {
chmod +x "${_appimage}"
./"${_appimage}" --appimage-extract
}
build() {
local _desktop="squashfs-root/${_pkgname}.desktop"
# Adjust .desktop so it will work outside of AppImage container.
# Upstream's Exec already ends in "--no-sandbox %U", so the replacement must
# not add a field code of its own: the spec allows at most one per Exec line
# and GLib (uwsm, gio launch) rejects the entry outright when there are two.
sed -i -E "s|^Exec=AppRun|Exec=env DESKTOPINTEGRATION=false /usr/bin/${_pkgname}|" "${_desktop}"
# Same environment for the desktop action, and an absolute path instead of $PATH
sed -i -E "s|^Exec=${_pkgname} |Exec=env DESKTOPINTEGRATION=false /usr/bin/${_pkgname} |" "${_desktop}"
# Upstream ships a [Desktop Action new-window] group without declaring it
grep -q '^Actions=' "${_desktop}" || \
sed -i -E "/^\[Desktop Entry\]/a Actions=new-window;" "${_desktop}"
# Upstream lists image/jpeg twice
sed -i -E "s|image/jpeg;image/jpeg;|image/jpeg;|" "${_desktop}"
# Guard: fail the build if the main Exec ever ends up with >1 field code again
local _codes
_codes=$(grep -m1 '^Exec=env' "${_desktop}" | grep -o -- '%[fFuU]' | wc -l)
if (( _codes > 1 )); then
echo "error: Exec line has ${_codes} field codes, expected at most 1" >&2
return 1
fi
# Fix permissions; .AppImage permissions are 700 for all directories
chmod -R a-x+rX squashfs-root/usr
}
package() {
# AppImage
install -Dm755 "${srcdir}/${_appimage}" "${pkgdir}/opt/${pkgname}/${pkgname}.AppImage"
# Desktop file
install -Dm644 "${srcdir}/squashfs-root/${_pkgname}.desktop" \
"${pkgdir}/usr/share/applications/${_pkgname}.desktop"
# Icon
install -dm755 "${pkgdir}/usr/share/"
cp -a "${srcdir}/squashfs-root/usr/share/icons" "${pkgdir}/usr/share/"
mkdir -p "${pkgdir}/usr/share/pixmaps/"
install -Dm644 "${srcdir}/squashfs-root/usr/share/icons/hicolor/512x512/apps/todoist.png" "${pkgdir}/usr/share/pixmaps"
# Symlink executable
install -dm755 "${pkgdir}/usr/bin"
ln -s "/opt/${pkgname}/${pkgname}.AppImage" "${pkgdir}/usr/bin/${_pkgname}"
}
|