blob: 864e1fca92d8d4b2eb858e3dc363cf2d28d1264e (
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
|
# Maintainer: zxp19821005 <zxp19821005 at 163 dot com>
pkgname=actual-bin
_pkgname=Actual
pkgver=26.6.0
_electronversion=39
pkgrel=1
pkgdesc="A local-first personal finance tool. It is 100% free and open-source, written in NodeJS, it has a synchronization element so that all your changes can move between devices without any heavy lifting.(Prebuilt version.Use system-wide electron)"
arch=(
'aarch64'
'x86_64'
)
url="https://actualbudget.org/"
_ghurl="https://github.com/actualbudget/actual"
license=('MIT')
provides=("${pkgname%-bin}=${pkgver}")
conflicts=(
"${pkgname%-bin}"
"${pkgname%-bin}-appimage"
)
depends=(
"electron${_electronversion}"
)
source=(
"LICENSE-${pkgver}.txt::https://raw.githubusercontent.com/actualbudget/actual/v${pkgver}/LICENSE.txt"
"${pkgname%-bin}.sh"
)
source_aarch64=("${pkgname%-bin}-${pkgver}-aarch64.AppImage::${_ghurl}/releases/download/v${pkgver}/${_pkgname}-linux-arm64.AppImage")
source_x86_64=("${pkgname%-bin}-${pkgver}-x86_64.AppImage::${_ghurl}/releases/download/v${pkgver}/${_pkgname}-linux-x86_64.AppImage")
sha256sums=('71e4b3053e4622e1f5fc5d8aa5336350de32ead39247924c596d659b89b47b6f'
'a774c2f54fbbeeaac3cefc0f7250796d30c86d27f0fd40b7eaf9c0fdb021623d')
sha256sums_aarch64=('6d02424a139f76ec86e383594440bcf8f94b061a08f4e55b340a4c394efae64a')
sha256sums_x86_64=('6acff69b6d8bcdc06bcbbe8c580cc6e918856e6081ce2b8efa815740d62ffd19')
_check_electron_version() {
echo "Verifying Electron version..."
local _app_dir=$(find "${srcdir}" -type f -name "resources.pak" -exec dirname {} + | head -n 1)
local _main_exe=""
if [[ -n "${_app_dir}" ]]; then
_main_exe=$(find "${_app_dir}" -maxdepth 1 -type f -executable -printf '%s %p\n' | sort -nr | head -n 1 | cut -d' ' -f2-)
fi
if [[ -n "${_main_exe}" ]]; then
local _elec_ver=$(strings "${_main_exe}" | grep '^Chrome/[0-9.]* Electron/[0-9]' | cut -d'/' -f3 | cut -d'.' -f1 | head -n 1)
if [[ -n "${_elec_ver}" ]]; then
if [[ "${_elec_ver}" != "${_electronversion}" ]]; then
echo -e "\033[1;31mWarning: Electron version mismatch! Detected: ${_elec_ver}, Expected: ${_electronversion}\033[0m"
else
echo -e "Electron version verified: \033[1;31m${_elec_ver}\033[0m"
fi
fi
else
echo -e "\033[1;33mNote: Could not find Electron binary for version verification.\033[0m"
fi
}
prepare() {
sed -i -e "
s/@electronversion@/${_electronversion}/g
s/@appname@/${pkgname%-bin}/g
s/@runname@/app.asar/g
s/@cfgdirname@/${_pkgname}/g
" "${srcdir}/${pkgname%-bin}.sh"
if [ ! -x "${srcdir}/${pkgname%-bin}-${pkgver}-${CARCH}.AppImage" ];then
chmod +x "${srcdir}/${pkgname%-bin}-${pkgver}-${CARCH}.AppImage"
fi
if [ -d "${srcdir}/squashfs-root" ];then
rm -rf "${srcdir}/squashfs-root"
fi
"${srcdir}/${pkgname%-bin}-${pkgver}-${CARCH}.AppImage" --appimage-extract > /dev/null
_check_electron_version
sed -i "s/AppRun --no-sandbox/${pkgname%-bin}/g" "${srcdir}/squashfs-root/${pkgname%-bin}.desktop"
rm -rf "${srcdir}/squashfs-root/resources/app.asar.unpacked/node_modules/bcrypt/prebuilds/"{darwin-*,win32-*,linux-arm}
case "${CARCH}" in
aarch64)
rm -rf "${srcdir}/squashfs-root/resources/app.asar.unpacked/node_modules/bcrypt/prebuilds/linux-x64"
;;
x86_64)
rm -rf "${srcdir}/squashfs-root/resources/app.asar.unpacked/node_modules/bcrypt/prebuilds/linux-arm64"
;;
esac
find "${srcdir}/squashfs-root/resources" -type d -exec chmod 755 {} +
}
package() {
install -Dm755 "${srcdir}/${pkgname%-bin}.sh" "${pkgdir}/usr/bin/${pkgname%-bin}"
install -Dm755 -d "${pkgdir}/usr/lib/${pkgname%-bin}"
local _app_dir=$(find "${srcdir}" -type f -name "resources.pak" -exec dirname {} + | head -n 1)
cp -a "${_app_dir}/resources/". "${pkgdir}/usr/lib/${pkgname%-bin}/"
find "${srcdir}" -type f \( -name "*.png" -o -name "*.svg" \) -path "*share/icons/*" | while read -r _i; do
_extension="${_i##*.}"
_icon_path="${_i#*share/icons/}"
_target_dir="/usr/share/icons/$(dirname "${_icon_path}")"
install -Dm644 "${_i}" "${pkgdir}${_target_dir}/${pkgname%-bin}.${_extension}"
done
install -Dm644 "${srcdir}/squashfs-root/${pkgname%-bin}.desktop" -t "${pkgdir}/usr/share/applications"
install -Dm644 "${srcdir}/LICENSE-${pkgver}.txt" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.txt"
}
|