diff options
author | zxp19821005 | 2024-10-25 13:40:17 +0800 |
---|---|---|
committer | zxp19821005 | 2024-10-25 13:40:17 +0800 |
commit | 2e4a36f0b269dfde55e8686722d153389aebc24f (patch) | |
tree | 60717cffcbf6307875491d5fa40873bb410cc9c2 | |
parent | 9412caf34195f1b94b0fe6f23b3a7390c122cf32 (diff) | |
download | aur-2e4a36f0b269dfde55e8686722d153389aebc24f.tar.gz |
update shellscripts
-rw-r--r-- | .SRCINFO | 10 | ||||
-rw-r--r-- | PKGBUILD | 68 | ||||
-rw-r--r-- | jlivertool.sh | 2 |
3 files changed, 43 insertions, 37 deletions
@@ -1,7 +1,7 @@ pkgbase = jlivertool - pkgdesc = Bilibili 弹幕机 + pkgdesc = Simple Bilibili Danmaku Tool.Use system-wide electron.Bilibili 弹幕机. pkgver = 2.2.0 - pkgrel = 1 + pkgrel = 2 url = https://github.com/Xinrea/JLiverTool arch = x86_64 license = MIT @@ -14,9 +14,9 @@ pkgbase = jlivertool depends = java-runtime provides = jlivertool conflicts = jlivertool - source = jlivertool.git::git+https://github.com/Xinrea/JLiverTool.git#tag=v2.2.0 + source = jlivertool-2.2.0.tar.gz::https://github.com/Xinrea/JLiverTool/archive/refs/tags/v2.2.0.tar.gz source = jlivertool.sh - sha256sums = e91a84b44356214d761926988b0b4bb38dc055d297aaa87d320bd82b80445ef3 - sha256sums = 2b2e8aeed33fd71c521e49fd54fb2fa81218d16aef8bccb88d77909055ab8051 + sha256sums = a862ac202ae0162c6b4d03b0da14eb3f54a19d86cfcbf5288ecea9e49bc7ba43 + sha256sums = 291f50480f5a61bc9c68db7d44cd0412071128706baa868a9cb854f8779a1980 pkgname = jlivertool @@ -4,8 +4,8 @@ _pkgname=JLiverTool pkgver=2.2.0 _electronversion=26 _nodeversion=20 -pkgrel=1 -pkgdesc="Bilibili 弹幕机" +pkgrel=2 +pkgdesc="Simple Bilibili Danmaku Tool.Use system-wide electron.Bilibili 弹幕机." arch=('x86_64') url="https://github.com/Xinrea/JLiverTool" license=('MIT') @@ -23,50 +23,56 @@ makedepends=( 'git' ) source=( - "${pkgname}.git::git+${url}.git#tag=v${pkgver}" + "${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz" "${pkgname}.sh" ) -sha256sums=('e91a84b44356214d761926988b0b4bb38dc055d297aaa87d320bd82b80445ef3' - '2b2e8aeed33fd71c521e49fd54fb2fa81218d16aef8bccb88d77909055ab8051') +sha256sums=('a862ac202ae0162c6b4d03b0da14eb3f54a19d86cfcbf5288ecea9e49bc7ba43' + '291f50480f5a61bc9c68db7d44cd0412071128706baa868a9cb854f8779a1980') _ensure_local_nvm() { - export NVM_DIR="${srcdir}/.nvm" + local NVM_DIR="${srcdir}/.nvm" source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]] nvm install "${_nodeversion}" nvm use "${_nodeversion}" } build() { - sed -e "s|@electronversion@|${_electronversion}|" \ - -e "s|@appname@|${pkgname}|g" \ - -e "s|@runname@|app.asar|g" \ - -e "s|@cfgdirname@|${pkgname}|g" \ - -e "s|@options@||g" \ - -i "${srcdir}/${pkgname}.sh" + sed -e " + s/@electronversion@/${_electronversion}/g + s/@appname@/${pkgname}/g + s/@runname@/app.asar/g + s/@cfgdirname@/${pkgname}/g + s/@options@//g + " -i "${srcdir}/${pkgname}.sh" gendesk -q -f -n --pkgname="${pkgname}" --pkgdesc="${pkgdesc}" --categories="Utility" --name="${_pkgname}" --exec="${pkgname} %U" _ensure_local_nvm - cd "${srcdir}/${pkgname}.git" - export npm_config_build_from_source=true - export npm_config_cache="${srcdir}/.npm_cache" + cd "${srcdir}/${_pkgname}-${pkgver}" + electronDist="/usr/lib/electron${_electronversion}" export ELECTRON_SKIP_BINARY_DOWNLOAD=1 - #export SYSTEM_ELECTRON_VERSION="$(electron${_electronversion} -v | sed 's/v//g')" - #export npm_config_target="${SYSTEM_ELECTRON_VERSION}" - #export ELECTRONVERSION="${_electronversion}" + export SYSTEM_ELECTRON_VERSION="$(electron${_electronversion} -v | sed 's/v//g')" HOME="${srcdir}/.electron-gyp" - if [ `curl -s ipinfo.io/country | grep CN | wc -l ` -ge 1 ];then - export npm_config_registry=https://registry.npmmirror.com - export npm_config_disturl=https://registry.npmmirror.com/-/binary/node/ - export npm_config_electron_mirror=https://registry.npmmirror.com/-/binary/electron/ - export npm_config_electron_builder_binaries_mirror=https://registry.npmmirror.com/-/binary/electron-builder-binaries/ - else - echo "Your network is OK." + { + echo -e '\n' + #echo 'build_from_source=true' + echo "cache=${srcdir}/.npm_cache" + } >> .npmrc + if [[ "$(curl -s ipinfo.io/country)" == *"CN"* ]]; then + { + echo 'registry=https://registry.npmmirror.com' + echo 'disturl=https://registry.npmmirror.com/-/binary/node/' + echo 'electron_mirror=https://registry.npmmirror.com/-/binary/electron/' + echo 'electron_builder_binaries_mirror=https://registry.npmmirror.com/-/binary/electron-builder-binaries/' + } >> .npmrc + find ./ -type f -name "package-lock.json" -exec sed -i "s/registry.npmjs.org/registry.npmmirror.com/g" {} + fi - sed "s|--linux|-l --dir|g;s|develop|${pkgver}|g" -i package.json + sed -i "s/\"electron\": \"[^\"]*\"/\"electron\": \"${SYSTEM_ELECTRON_VERSION}\"/g;s/develop/${pkgver}/g" package.json NODE_ENV=development npm install - NODE_ENV=production npm run build-linux + NODE_ENV=production npx webpack + NODE_ENV=production npm exec -c "electron-builder build --linux dir -c.electronDist=${electronDist}" } package() { install -Dm755 "${srcdir}/${pkgname}.sh" "${pkgdir}/usr/bin/${pkgname}" - install -Dm644 "${srcdir}/${pkgname}.git/dist/linux-"*/resources/app.asar -t "${pkgdir}/usr/lib/${pkgname}" - cp -r "${srcdir}/${pkgname}.git/dist/linux-"*/resources/app.asar.unpacked "${pkgdir}/usr/lib/${pkgname}" + install -Dm644 "${srcdir}/${_pkgname}-${pkgver}/dist/linux-"*/resources/app.asar -t "${pkgdir}/usr/lib/${pkgname}" + cp -Pr --no-preserve=ownership "${srcdir}/${_pkgname}-${pkgver}/dist/linux-"*/resources/app.asar.unpacked "${pkgdir}/usr/lib/${pkgname}" + install -Dm644 "${srcdir}/${_pkgname}-${pkgver}/src/assets/icons/512x512.png" "${pkgdir}/usr/share/pixmaps/${pkgname}.png" install -Dm644 "${srcdir}/${pkgname}.desktop" -t "${pkgdir}/usr/share/applications" - install -Dm644 "${srcdir}/${pkgname}.git/LICENSE.md" -t "${pkgdir}/usr/share/licenses/${pkgname}" -}
\ No newline at end of file + install -Dm644 "${srcdir}/${_pkgname}-${pkgver}/LICENSE.md" -t "${pkgdir}/usr/share/licenses/${pkgname}" +} diff --git a/jlivertool.sh b/jlivertool.sh index 4cfe3ac09dd8..40e422ca2ee7 100644 --- a/jlivertool.sh +++ b/jlivertool.sh @@ -21,7 +21,7 @@ if [[ -f "${_FLAGS_FILE}" ]]; then fi done < "${_FLAGS_FILE}" fi -cd "${_APPDIR}" +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 |