diff options
author | zhullyb | 2021-11-15 21:04:18 +0800 |
---|---|---|
committer | zhullyb | 2021-11-15 21:06:46 +0800 |
commit | 70c6db672581fc2996afd7de7d52bbc2ae864fcf (patch) | |
tree | 19383779dfc61f42e2d30da0229ad9b092719060 | |
parent | 7c174dc111d997f8ef52fb8e98ca538f448f0754 (diff) | |
download | aur-70c6db672581fc2996afd7de7d52bbc2ae864fcf.tar.gz |
Take over the package and apply a fix
- use yarn
- build pack
- use the electron from system
- use aria2-fast, not the prebuilt one from upstream
Co-Authored-By: sukanka <su975853527@gmail.com>
-rw-r--r-- | .SRCINFO | 14 | ||||
-rw-r--r-- | PKGBUILD | 117 | ||||
-rw-r--r--[-rwxr-xr-x] | motrix | 9 | ||||
-rw-r--r-- | motrix.desktop (renamed from Motrix.desktop) | 2 |
4 files changed, 65 insertions, 77 deletions
@@ -1,21 +1,23 @@ pkgbase = motrix pkgdesc = A full-featured download manager (release version) pkgver = 1.6.11 - pkgrel = 1 + pkgrel = 4 url = https://github.com/agalwood/Motrix arch = x86_64 license = MIT - makedepends = curl + makedepends = aria2-fast makedepends = npm + makedepends = yarn + makedepends = nodejs<17 depends = gtk3 depends = libxcb + depends = electron conflicts = motrix-git - source = Motrix.desktop + source = motrix.desktop source = motrix source = Motrix.tar.gz::https://github.com/agalwood/Motrix/archive/v1.6.11.tar.gz - sha256sums = 1b799d1b1e280a27ff625cceb429b1e00c6691eb0256ded44f6a1a0310a899d4 - sha256sums = c89824e80769b0b19c66da12168f9e91fc15088d1324d6760ddad960eb006cba + sha256sums = af5092a2a599bd23c13303ad1e7b745992a7af141278d13abe4297ca50a77bd8 + sha256sums = 52a8f1ae5916a91aa1c9f1749e06777b4457bd9f5a03749c9fcd97e7d0801a71 sha256sums = 9a1558063d32dd100aa289db601f01497d518c070f0ba570efd446830697089e pkgname = motrix - @@ -1,22 +1,18 @@ -#Maintainer: weearc <q19981121@163.com> +# Maintainer: zhullyb <zhullyb [at] outlook dot com> +# Contributor: sukanka <su975853527 [AT] gmail dot com> +# Contributor: weearc <q19981121 [at] 163 dot com> pkgname=motrix _pkgname=Motrix pkgver=1.6.11 -_pkgver=1.6.11 -pkgrel=1 +pkgrel=4 epoch= pkgdesc="A full-featured download manager (release version)" arch=("x86_64") url="https://github.com/agalwood/Motrix" license=('MIT') groups=() -depends=( - 'gtk3' - 'libxcb' - ) -makedepends=('curl' - 'npm' - ) +depends=('gtk3' 'libxcb' 'electron') +makedepends=('aria2-fast' 'npm' 'yarn' "nodejs<17") checkdepends=() optdepends=() provides=() @@ -26,66 +22,61 @@ backup=() options=() install= changelog= -source=("Motrix.desktop" - "motrix" - "Motrix.tar.gz"::"https://github.com/agalwood/Motrix/archive/v$_pkgver.tar.gz") +source=("motrix.desktop" + "motrix" + "Motrix.tar.gz"::"https://github.com/agalwood/Motrix/archive/v${pkgver}.tar.gz" + ) noextract=() -sha256sums=('1b799d1b1e280a27ff625cceb429b1e00c6691eb0256ded44f6a1a0310a899d4' - 'c89824e80769b0b19c66da12168f9e91fc15088d1324d6760ddad960eb006cba' - '9a1558063d32dd100aa289db601f01497d518c070f0ba570efd446830697089e') +sha256sums=('af5092a2a599bd23c13303ad1e7b745992a7af141278d13abe4297ca50a77bd8' + '52a8f1ae5916a91aa1c9f1749e06777b4457bd9f5a03749c9fcd97e7d0801a71' + '9a1558063d32dd100aa289db601f01497d518c070f0ba570efd446830697089e') validpgpkeys=() prepare() { - tar -xvf $_pkgname.tar.gz - rm $_pkgname.tar.gz - mv $_pkgname-$_pkgver $_pkgname -# npm config set ELECTRON_BUILDER_BINARIES_MIRROR=https://pan.yasking.org/electron-builder/ -# echo "=====================================" -# echo "Finding if you are in China..." -# curl https://myip.ipip.net | grep -i "中国" -# if [ $? -eq 0 ] -# then -# echo "Yes,I'm sure you are in China." -# echo "To speed up installation I'll change npm mirrors to Taobao." -# npm config set registry 'https://registry.npm.taobao.org' -# export ELECTRON_MIRROR='https://npm.taobao.org/mirrors/electron/' -# export SASS_BINARY_SITE='https://npm.taobao.org/mirrors/node-sass' -# else -# curl https://myip.ipip.net | grep -i "China" -# if [ $? -eq 0 ] -# then -# echo "Yes,I'm sure you are in China." -# echo "To speed up installation I'll change npm mirrors to Taobao." -# npm config set registry 'https://registry.npm.taobao.org' -# export ELECTRON_MIRROR='https://npm.taobao.org/mirrors/electron/' -# export SASS_BINARY_SITE='https://npm.taobao.org/mirrors/node-sass' -# fi -# fi -# echo "======================================" -# sed -i '/"dmg"/,/"linux"/{//!d}' $_pkgname/package.json -# sed -i '/"dmg"/d' $_pkgname/package.json -# sed -i '/"deb"/d' $_pkgname/package.json -# sed -i '/"snap"/d' $_pkgname/package.json -# sed -i '/"pacman"/d' $_pkgname/package.json -# sed -i '/"rpm"/d' $_pkgname/package.json -# sed -i 's/"AppImage"/"dir"/g' $_pkgname/package.json - + cd $srcdir/${_pkgname}-${pkgver} + # Fix pack error + sed -i "s|--colors||g" package.json } build() { - cd $_pkgname/ - npm install && npm run build:dir + cd $srcdir/${_pkgname}-${pkgver} + export YARN_CACHE_FOLDER="${srcdir}/yarn_cache" + yarn install + install -Dm 644 package.json apps/package.json + + # start pack + yarn run pack + cp -r dist apps + cd apps + + # remove post install & install deps + sed -i "s|\"postinstall\".\+|\"postinstall\":\"\"|g" package.json + yarn install --production + + # remove useless file + rm -rf node_modules/{.bin,.yarn-integrity} + rm -rf yarn.lock + + # pack asar + cd ../ + asar p apps app.asar + rm -rf apps/ } + package() { - install -d ${pkgdir}/opt - install -d ${pkgdir}/usr/bin - install -d ${pkgdir}/usr/share/icons - install -d ${pkgdir}/usr/share/applications - mv ${srcdir}/$_pkgname/release/linux-unpacked/ ${pkgdir}/opt/motrix - install -Dm644 ${srcdir}/$_pkgname/build/256x256.png ${pkgdir}/usr/share/icons/$pkgname.png - install -Dm 777 ${srcdir}/motrix ${pkgdir}/usr/bin - install -Dm 644 ${srcdir}/Motrix.desktop ${pkgdir}/usr/share/applications -# rm ${pkgdir}/opt/motrix/resources/engine/aria2.conf -# cp -p ${srcdir}/aria2.conf ${pkgdir}/opt/motrix/resources/engine/aria2.conf - rm -rf ${srcdir} + cd $srcdir/${_pkgname}-${pkgver} + install -Dm 644 app.asar ${pkgdir}/usr/lib/${pkgname}/app.asar + install -Dm 644 extra/linux/engine/aria2.conf ${pkgdir}/usr/lib/${pkgname}/engine/aria2.conf + + # Copy aria2-fast from system. Motrix set 64 download threads as default, so if use original aria2c will get error. + install -Dm 775 /usr/bin/aria2c ${pkgdir}/usr/lib/${pkgname}/engine/aria2c + + # binary wrapper + install -Dm 775 ${srcdir}/motrix ${pkgdir}/usr/bin/${pkgname} + + # desktop enrty + install -Dm 644 ${srcdir}/motrix.desktop ${pkgdir}/usr/share/applications/${pkgname}.desktop + + # icons + install -Dm 644 build/256x256.png ${pkgdir}/usr/share/icons/${pkgname}.png } @@ -1,8 +1,3 @@ #!/bin/bash -SESSION="$HOME/.cache/aria2.session" -if [[ ! -f $SESSION ]] -then - touch $SESSION; - chmod 666 $SESSION; -fi -exec /opt/motrix/motrix +export ELECTRON_IS_DEV=0 +exec /usr/bin/electron /usr/lib/motrix/app.asar diff --git a/Motrix.desktop b/motrix.desktop index 03dc1cb45e4b..9bde9e1b6173 100644 --- a/Motrix.desktop +++ b/motrix.desktop @@ -2,7 +2,7 @@ Name=Motrix Comment=download manager Keywords= -Exec=/usr/bin/motrix +Exec=motrix &U TryExec= Terminal=false Icon=/usr/share/icons/motrix.png |