summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorzxp198210052024-05-31 15:25:18 +0800
committerzxp198210052024-05-31 15:25:18 +0800
commitd703a775f406e9b149b3097cdf8d0438e87da0af (patch)
tree09c36646d8262340243f05e176d9e9b38910442a
parentae2320cffdba382f9236ffd290c4edeab6960ba1 (diff)
downloadaur-d703a775f406e9b149b3097cdf8d0438e87da0af.tar.gz
fix errors
-rw-r--r--.SRCINFO6
-rw-r--r--PKGBUILD13
-rw-r--r--copytranslator.sh21
3 files changed, 26 insertions, 14 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e5a401132677..ed99187cf1e7 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,17 +1,17 @@
pkgbase = copytranslator-bin
pkgdesc = Foreign language reading and translation assistant based on copy and translate.
pkgver = 9.1.0
- pkgrel = 5
+ pkgrel = 6
url = https://copytranslator.gitee.io/
arch = x86_64
license = GPL-2.0-only
makedepends = asar
- depends = electron6-bin
+ depends = electron6
provides = copytranslator=9.1.0
conflicts = copytranslator
source = copytranslator-9.1.0.deb::https://github.com/CopyTranslator/CopyTranslator/releases/download/v9.1.0/copytranslator_9.1.0_amd64.deb
source = copytranslator.sh
sha256sums = 426f706acc80610731116b2317540fd10e844f597ca0489c83934f8ac3c0527a
- sha256sums = dc0c5ca385ad81a08315a91655c7c064b5bf110eada55e61265633ae198b39f8
+ sha256sums = 2b2e8aeed33fd71c521e49fd54fb2fa81218d16aef8bccb88d77909055ab8051
pkgname = copytranslator-bin
diff --git a/PKGBUILD b/PKGBUILD
index be3c85a0348b..6fe4725723a0 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@
pkgname=copytranslator-bin
pkgver=9.1.0
_electronversion=6
-pkgrel=5
+pkgrel=6
pkgdesc="Foreign language reading and translation assistant based on copy and translate."
arch=('x86_64')
url="https://copytranslator.gitee.io/"
@@ -11,7 +11,7 @@ license=('GPL-2.0-only')
conflicts=("${pkgname%-bin}")
provides=("${pkgname%-bin}=${pkgver}")
depends=(
- "electron${_electronversion}-bin"
+ "electron${_electronversion}"
)
makedepends=(
'asar'
@@ -21,19 +21,18 @@ source=(
"${pkgname%-bin}.sh"
)
sha256sums=('426f706acc80610731116b2317540fd10e844f597ca0489c83934f8ac3c0527a'
- 'dc0c5ca385ad81a08315a91655c7c064b5bf110eada55e61265633ae198b39f8')
+ '2b2e8aeed33fd71c521e49fd54fb2fa81218d16aef8bccb88d77909055ab8051')
build() {
sed -e "s|@electronversion@|${_electronversion}|g" \
-e "s|@appname@|${pkgname%-bin}|g" \
-e "s|@runname@|app.asar|g" \
+ -e "s|@cfgdirname@|${pkgname%-bin}|g" \
-e "s|@options@||g" \
-i "${srcdir}/${pkgname%-bin}.sh"
bsdtar -xf "${srcdir}/data."*
asar e "${srcdir}/opt/${pkgname%-bin}/resources/app.asar" "${srcdir}/app.asar.unpacked"
- sed -e "s|process.resourcesPath,\"locales|process.resourcesPath,\"../.././${pkgname%-bin}/locales|g" \
- -e "s|tray@2x.png|../.././${pkgname%-bin}/tray@2x.png|g" \
- -e "s|return !0 === this.app.isPackaged|return 0 === this.app.isPackaged|g" \
- -i "${srcdir}/app.asar.unpacked/background.js"
+ sed "s|process.resourcesPath|\"\/usr\/lib\/${pkgname%-bin}\"|g" -i "${srcdir}/app.asar.unpacked/background.js"
+ touch "${srcdir}/app.asar.unpacked/dev-app-update.yml"
asar p "${srcdir}/app.asar.unpacked" "${srcdir}/app.asar"
sed "s|/opt/${pkgname%-bin}/${pkgname%-bin}|${pkgname%-bin}|g;s|/opt/${pkgname%-bin}/resources/linux-icon/icon.png|${pkgname%-bin}|g" \
-i "${srcdir}/usr/share/applications/${pkgname%-bin}.desktop"
diff --git a/copytranslator.sh b/copytranslator.sh
index 7ddcaab8d734..4cfe3ac09dd8 100644
--- a/copytranslator.sh
+++ b/copytranslator.sh
@@ -1,16 +1,29 @@
#!/bin/bash
-set -e
+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}@appname@-flags.conf"
+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}"
-if [[ $EUID -ne 0 ]] || [[ $ELECTRON_RUN_AS_NODE ]]; then
- exec electron@electronversion@ "${_RUNNAME}" "${_OPTIONS}" "$@" || exit $?
+if [[ "${EUID}" -ne 0 ]] || [[ "${ELECTRON_RUN_AS_NODE}" ]]; then
+ exec electron@electronversion@ "${_RUNNAME}" ${_OPTIONS} "${_USER_FLAGS[@]}" "$@"
else
- exec electron@electronversion@ "${_RUNNAME}" "${_OPTIONS}" --no-sandbox "$@" || exit $?
+ exec electron@electronversion@ "${_RUNNAME}" ${_OPTIONS} --no-sandbox "${_USER_FLAGS[@]}" "$@"
fi \ No newline at end of file