Skip to content

Commit

Permalink
add botgem-bin
Browse files Browse the repository at this point in the history
  • Loading branch information
zxp19821005 committed Oct 14, 2024
1 parent 4009d7e commit 497e394
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
|**bot.dev**|[bot.dev](https://github.com/zxp19821005/My_AUR_Files/tree/main/bot.dev)|[bot.dev](https://aur.archlinux.org/packages/bot.dev)||
|**botclient**|[botclient-bin](https://github.com/zxp19821005/My_AUR_Files/tree/main/botclient-bin)|[botclient-bin](https://aur.archlinux.org/packages/botclient-bin)||
|**botframework-emulator**|[botframework-emulator-bin](https://github.com/zxp19821005/My_AUR_Files/tree/main/botframework-emulator-bin)|[botframework-emulator-bin](https://aur.archlinux.org/packages/botframework-emulator-bin)||
|**botgem**|[botgem-bin](https://github.com/zxp19821005/My_AUR_Files/tree/main/botgem-bin)|[botgem-bin](https://aur.archlinux.org/packages/botgem-bin)||
|**brisk**|[brisk-bin](https://github.com/zxp19821005/My_AUR_Files/tree/main/brisk-bin)|[brisk-bin](https://aur.archlinux.org/packages/brisk-bin)||
|**brisqi**|[brisqi-bin](https://github.com/zxp19821005/My_AUR_Files/tree/main/brisqi-bin)|[brisqi-bin](https://aur.archlinux.org/packages/brisqi-bin)||
|**broadcast**|[broadcast-bin](https://github.com/zxp19821005/My_AUR_Files/tree/main/broadcast-bin)|[broadcast-bin](https://aur.archlinux.org/packages/broadcast-bin)||
Expand Down
54 changes: 54 additions & 0 deletions botgem-bin/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Maintainer: zxp19821005 <zxp19821005 at 163 dot com>
pkgname=botgem-bin
_pkgname=BotGem
pkgver=1.5.1
_electronversion=22
pkgrel=1
pkgdesc="Your Al-Powered Toolbox for Tomorrow.Prebuilt version.Use system-wide electron."
arch=('x86_64')
url="https://botgem.com/"
_ghurl="https://github.com/gaodeng/ama-discussions"
license=('MIT')
conflicts=("${pkgname%-bin}")
prodives=("${pkgname%-bin}=${pkgver}")
depends=(
"electron${_electronversion}"
)
makedepends=(
'asar'
'gendesk'
)
source=(
"${pkgname%-bin}-${pkgver}.appx::${_ghurl}/releases/download/v${pkgver}/${_pkgname}.${pkgver}.appx"
"sqlite3-x86_64.tar.gz::https://github.com/TryGhost/node-sqlite3/releases/download/v5.1.7/sqlite3-v5.1.7-napi-v6-linux-x64.tar.gz"
"${pkgname%-bin}.sh"
)
sha256sums=('2c2caaeac6642f2c4cecaccb6915cce3174a47431605c05fd565a6acf764409c'
'6d1f7a95e5aca90db1fd6a2839380a021d5ee23d46f2d7c520ded094da813fed'
'291f50480f5a61bc9c68db7d44cd0412071128706baa868a9cb854f8779a1980')
build() {
sed -e "
s/@electronversion@/${_electronversion}/g
s/@appname@/${pkgname%-bin}/g
s/@runname@/app.asar/g
s/@cfgdirname@/com.${pkgname}.ama/g
s/@options@//g
" -i "${srcdir}/${pkgname%-bin}.sh"
gendesk -q -f -n --pkgname="${pkgname%-bin}" --pkgdesc="${pkgdesc}" --categories="Office" --name="${_pkgname}" --exec="${pkgname%-bin} %U"
asar e "${srcdir}/app/resources/app.asar" "${srcdir}/app.asar.unpacked"
find "${srcdir}/app.asar.unpacked/dist" -type f -exec sed -i "s/process.resourcesPath/\'\/usr\/lib\/${pkgname%-bin}\'/g" {} +
install -Dm644 "${srcdir}/build/Release/node_sqlite3.node" -t "${srcdir}/app.asar.unpacked/node_modules/sqlite3/build/Release"
asar p "${srcdir}/app.asar.unpacked" "${srcdir}/app.asar"
}
package() {
install -Dm755 "${srcdir}/${pkgname%-bin}.sh" "${pkgdir}/usr/bin/${pkgname%-bin}"
install -Dm644 "${srcdir}/app.asar" -t "${pkgdir}/usr/lib/${pkgname%-bin}"
install -Dm644 "${srcdir}/build/Release/node_sqlite3.node" -t "${pkgdir}/usr/lib/${pkgname%-bin}/app.asar.unpacked/node_modules/sqlite3/build/Release"
_icon_sizes=(16x16 24x24 32x32 48x48 64x64 96x96 128x128 256x256 512x512 1024x1024)
for _icons in "${_icon_sizes[@]}";do
install -Dm644 "${srcdir}/app/resources/assets/icons/${_icons}.png" \
"${pkgdir}/usr/share/icons/hicolor/${_icons}/apps/${pkgname%-bin}.png"
done
install -Dm644 "${srcdir}/${pkgname%-bin}.desktop" -t "${pkgdir}/usr/share/applications"
install -Dm644 "${srcdir}/app.asar.unpacked/dist/main/main.js.LICENSE.txt" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
29 changes: 29 additions & 0 deletions botgem-bin/botgem.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
set -o pipefail
_APPDIR="/usr/lib/@appname@"
_RUNNAME="${_APPDIR}/@runname@"
_CFGDIR="@cfgdirname@/"
_OPTIONS="@options@"
export PATH="${_APPDIR}:${PATH}"
export LD_LIBRARY_PATH="${_APPDIR}/swiftshader:${_APPDIR}/lib:${LD_LIBRARY_PATH}"
export ELECTRON_IS_DEV=0
export ELECTRON_FORCE_IS_PACKAGED=true
export ELECTRON_DISABLE_SECURITY_WARNINGS=true
export ELECTRON_OVERRIDE_DIST_PATH="/usr/bin/electron@electronversion@"
export NODE_ENV=production
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
export _FLAGS_FILE="${XDG_CONFIG_HOME}/${_CFGDIR}@[email protected]"
declare -a _USER_FLAGS
if [[ -f "${_FLAGS_FILE}" ]]; then
while read -r line; do
if [[ ! "${line}" =~ ^[[:space:]]*#.* ]]; then
_USER_FLAGS+=("${line}")
fi
done < "${_FLAGS_FILE}"
fi
cd "${_APPDIR}" || { echo "Failed to change directory to ${_APPDIR}"; exit 1; }
if [[ "${EUID}" -ne 0 ]] || [[ "${ELECTRON_RUN_AS_NODE}" ]]; then
exec electron@electronversion@ "${_RUNNAME}" ${_OPTIONS} "${_USER_FLAGS[@]}" "$@"
else
exec electron@electronversion@ "${_RUNNAME}" ${_OPTIONS} --no-sandbox "${_USER_FLAGS[@]}" "$@"
fi

0 comments on commit 497e394

Please sign in to comment.