blob: ca22d1a481e67fd4cee60a855f15ea0e21aee9e6 (
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=apifox-bin
_pkgname=Apifox
# 从以下网址确定版本 https://docs.apifox.com/changelog
pkgver=2.8.46
_electronversion=37
pkgrel=1
pkgdesc="Apifox=Postman+Swagger+Mock+JMeter(Prebuilt version.Use system-wide electron).API 文档、API 调试、API Mock、API 自动化测试"
arch=(
'aarch64'
'x86_64'
)
url="https://apifox.com/"
_ghurl="https://github.com/apifox/apifox"
license=('LicenseRef-custom')
conflicts=("${pkgname%-bin}")
provides=("${pkgname%-bin}=${pkgver}")
depends=(
"electron${_electronversion}"
'java-runtime'
'nodejs'
'dbus-glib'
)
options=(
'!strip'
)
source=(
#"${pkgname%-bin}.sh"
"LICENSE.html"
)
source_aarch64=("${pkgname%-bin}-${pkgver}-aarch64.zip::https://file-assets.apifox.com/download/${_pkgname}-linux-arm64-latest.zip")
source_x86_64=("${pkgname%-bin}-${pkgver}-x86_64.zip::https://file-assets.apifox.com/download/${_pkgname}-linux-latest.zip")
sha256sums=('3884df6451dd5aaadc867c2b6882a7feabccb10c7e1df98e48e9fe2414c9fe19')
sha256sums_aarch64=('9de3a5497a11cfdf6cac2837fa63272d2c4f5f0d8b16b41e3211dfbd9ed3135f')
sha256sums_x86_64=('05c6baabc30ecf593730ca5ba248324dc600a137903f8c82747821a2a6804471')
pkgver() {
cd "${srcdir}/squashfs-root"
grep "X-AppImage-Version" "${pkgname%-bin}.desktop" | sed "s/X-AppImage-Version=//g"
}
_get_app_dir() {
find "${srcdir}" -type f -name "resources.pak" -exec dirname {} + | head -n 1
}
_check_electron_version() {
echo "Verifying Electron version..."
local _main_exe=$(find "$(_get_app_dir)" -maxdepth 1 -type f -executable -printf '%s %p\n' | sort -nr | head -1 | cut -d' ' -f2-)
[[ -z "${_main_exe}" ]] && echo -e "\033[1;33mNote: Could not find Electron binary.\033[0m" && return
local _elec_ver=$(strings "${_main_exe}" | grep -oP 'Electron/\K[0-9]+' | head -1)
[[ -z "${_elec_ver}" ]] && echo -e "\033[1;33mNote: Could not determine Electron version.\033[0m" && return
[[ "${_elec_ver}" != "${_electronversion}" ]] &&
echo -e "\033[1;31mWarning: Electron version mismatch! Detected: ${_elec_ver}, Expected: ${_electronversion}\033[0m" ||
echo -e "Electron version verified: \033[1;31m${_elec_ver}\033[0m"
}
prepare() {
#sed -i -e "
# s/@electronversion@/${_electronversion}/g
# s/@appname@/${pkgname%-bin}/g
# s/@runname@/app.asar/g
# s/@cfgdirname@/${pkgname%-bin}/g
#" "${srcdir}/${pkgname%-bin}.sh"
if [ ! -x "${srcdir}/${_pkgname}"*.AppImage ];then
chmod +x "${srcdir}/${_pkgname}"*.AppImage
fi
if [ -d "${srcdir}/squashfs-root" ];then
rm -rf "${srcdir}/squashfs-root"
fi
"${srcdir}/${_pkgname}"*.AppImage --appimage-extract > /dev/null
_check_electron_version
sed -i "s/AppRun --no-sandbox/${pkgname%-bin}/g" "${srcdir}/squashfs-root/${pkgname%-bin}.desktop"
#find "${srcdir}/squashfs-root/resources/app.asar.unpacked/node_modules" -type d -name ".github" -exec rm -rf {} +
rm -rf "${srcdir}/squashfs-root/resources/app.asar.unpacked/node_modules/oracledb/build/Release/"{*darwin*,*win32*}
find "${srcdir}/squashfs-root" -type d -perm 700 -exec chmod 755 {} +
_file_list=(chrome_100_percent.pak chrome_200_percent.pak chrome-sandbox icudtl.dat libEGL.so libffmpeg.so \
libGLESv2.so libvk_swiftshader.so libvulkan.so.1 resources.pak vk_swiftshader_icd.json)
for _files in "${_file_list[@]}";do
ln -sf "/usr/lib/electron${_electronversion}/${_files}" "${srcdir}/squashfs-root/${_files}"
done
}
package() {
#install -Dm755 "${srcdir}/${pkgname%-bin}.sh" "${pkgdir}/usr/bin/${pkgname%-bin}"
#install -Dm644 "${srcdir}/squashfs-root/resources/app.asar" -t "${pkgdir}/usr/lib/${pkgname%-bin}"
#cp -Pr --no-preserve=ownership "${srcdir}/squashfs-root/resources/app.asar.unpacked" "${pkgdir}/usr/lib/${pkgname%-bin}"
install -Dm755 -d "${pkgdir}/usr/"{bin,lib/"${pkgname%-bin}"}
cp -a "${srcdir}/squashfs-root/"* "${pkgdir}/usr/lib/${pkgname%-bin}"
ln -sf "/usr/lib/${pkgname%-bin}/${pkgname%-bin}" "${pkgdir}/usr/bin/${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.html" -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
|