diff options
author | zxp19821005 | 2024-10-22 12:34:29 +0800 |
---|---|---|
committer | zxp19821005 | 2024-10-22 12:34:29 +0800 |
commit | 7548c07c00b74169d1121134a0c737643b04dd9f (patch) | |
tree | ebbe0291826fa1823656a2e50043483265b29087 /PKGBUILD | |
parent | 563263e55eda00dd5c001cf05973f568350e69fd (diff) | |
download | aur-7548c07c00b74169d1121134a0c737643b04dd9f.tar.gz |
update shellscripts
Diffstat (limited to 'PKGBUILD')
-rw-r--r-- | PKGBUILD | 69 |
1 files changed, 41 insertions, 28 deletions
@@ -7,7 +7,7 @@ pkgver=0.11.0.r22.gbcabb5b _electronversion=20 _nodeversion=16 pkgrel=1 -pkgdesc='An open-source launcher to improve your productivity and efficiency' +pkgdesc='An open-source launcher to improve your productivity and efficiency.Use system-wide electron.' arch=('any') url='https://www.cerebroapp.com/' _ghurl="https://github.com/cerebroapp/cerebro" @@ -26,53 +26,66 @@ makedepends=( ) source=( "${pkgname%-git}.git::git+${_ghurl}.git" - "${pkgname%-git}.sh") + "${pkgname%-git}.sh" +) sha256sums=('SKIP' - '2b2e8aeed33fd71c521e49fd54fb2fa81218d16aef8bccb88d77909055ab8051') + '291f50480f5a61bc9c68db7d44cd0412071128706baa868a9cb854f8779a1980') pkgver() { - cd "${srcdir}/${pkgname%-git}.git" - git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/v//g' + cd "${srcdir}/${pkgname//-/.}" + set -o pipefail + git describe --long --tags --abbrev=7 | sed 's/\([^-]*-g\)/r\1/;s/-/./g;s/v//g' || + printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short=7 HEAD)" } _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%-git}|g" \ - -e "s|@runname@|app.asar|g" \ - -e "s|@cfgdirname@|${_pkgname}|g" \ - -e "s|@options@||g" \ - -i "${srcdir}/${pkgname%-git}.sh" + sed -e " + s/@electronversion@/${_electronversion}/g + s/@appname@/${pkgname%-git}/g + s/@runname@/app.asar/g + s/@cfgdirname@/${_pkgname}/g + s/@options@//g + " -i "${srcdir}/${pkgname%-git}.sh" _ensure_local_nvm gendesk -q -f -n --pkgname="${pkgname%-git}" --pkgdesc="${pkgdesc}" --categories="Utility" --name="${_pkgname}" --exec="${pkgname%-git} %U" cd "${srcdir}/${pkgname%-git}.git" - export npm_config_build_from_source=true + 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" mkdir -p "${srcdir}/.electron-gyp" - touch "${srcdir}/.electron-gyp/.yarnrc" - 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." + if [[ "$(curl -s ipinfo.io/country)" == *"CN"* ]]; then + { + echo -e '\n' + 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/"' + echo "cacheFolder "${srcdir}"/.yarn/cache" + echo "pluginsFolder "${srcdir}"/.yarn/plugins" + echo "globalFolder "${srcdir}"/.yarn/global" + echo 'useHardlinks true' + #echo 'buildFromSource true' + echo 'linkWorkspacePackages true' + echo 'fetchRetries 3' + echo 'fetchRetryTimeout 10000' + } >> .yarnrc + sed -i "s/registry.yarnpkg.com/registry.npmmirror.com/g" yarn.lock fi - sed 's|electron-builder",|electron-builder -l --dir",|g' -i package.json - NODE_ENV=development yarn install --cache-folder "${srcdir}/.yarn_cache" - NODE_ENV=production yarn run package + sed -i "s/\"electron\": \"[^\"]*\"/\"electron\": \"${SYSTEM_ELECTRON_VERSION}\"/g" package.json + NODE_ENV=development yarn install --cache-folder "${srcdir}/.yarn_cache" + NODE_ENV=production yarn run build + NODE_ENV=production npm exec -c "electron-builder --linux dir -c.electronDist=${electronDist}" } package() { install -Dm755 "${srcdir}/${pkgname%-git}.sh" "${pkgdir}/usr/bin/${pkgname%-git}" install -Dm644 "${srcdir}/${pkgname%-git}.git/release/linux-"*/resources/app.asar -t "${pkgdir}/usr/lib/${pkgname%-git}" - for _icons in 16x16 32x32 48x48 128x128 256x256 512x512 1024x1024;do + _icon_sizes=(16x16 32x32 48x48 128x128 256x256 512x512 1024x1024) + for _icons in "${_icon_sizes[@]}";do install -Dm644 "${srcdir}/${pkgname%-git}.git/build/icons/${_icons}.png" \ "${pkgdir}/usr/share/icons/hicolor/${_icons}/apps/${pkgname%-git}.png" done |