diff options
author | Arkylin | 2022-02-07 22:51:50 +0800 |
---|---|---|
committer | Arkylin | 2022-02-07 22:51:50 +0800 |
commit | b53fa7dcae026f299c8372cb9d4662c2c1793951 (patch) | |
tree | 4f297f56983999fe502cc0eb02f3c508a542345a | |
download | aur-b53fa7dcae026f299c8372cb9d4662c2c1793951.tar.gz |
New
-rw-r--r-- | .SRCINFO | 12 | ||||
-rw-r--r-- | PKGBUILD | 27 | ||||
-rwxr-xr-x | start.sh | 21 |
3 files changed, 60 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..114c4778757d --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,12 @@ +pkgbase = aur-accelerate-cn + pkgdesc = 来自知乎sinux的文章:机智的解决arch/manjaro安装AUR软件时github下载软件包慢或不可获得的问题 + pkgver = 1.0 + pkgrel = 1 + url = https://zhuanlan.zhihu.com/p/176987140 + arch = any + license = unknown + depends = axel + source = start.sh + md5sums = 120215840bdb5fc3ab4fc3f1c1bb1886 + +pkgname = aur-accelerate-cn diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..33243c84a345 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,27 @@ +# Maintainer: Arkylin <x@xyz.blue> +# Contributer: sinux <Unknown> + +pkgname=aur-accelerate-cn +pkgver=1.0 +pkgrel=1 +pkgdesc='来自知乎sinux的文章:机智的解决arch/manjaro安装AUR软件时github下载软件包慢或不可获得的问题' +url="https://zhuanlan.zhihu.com/p/176987140" +arch=('any') +license=('unknown') +depends=('axel') +source=( + 'start.sh') +md5sums=( + '120215840bdb5fc3ab4fc3f1c1bb1886') + +package() { + mkdir -p ${pkgdir}/opt/${pkgname} + cp ${srcdir}/start.sh ${pkgdir}/opt/${pkgname} + msg "请在/etc/makepkg.conf中修改DLAGENTS为以下内容!" + echo "DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u'" + echo " 'ftp::/usr/bin/axel -n 15 -a -o %o %u'" + echo " 'http::/usr/bin/axel -n 15 -a -o %o %u'" + echo " 'https::/opt/${pkgname}/start.sh %o %u'" + echo " 'rsync::/usr/bin/rsync --no-motd -z %u %o'" + echo " 'scp::/usr/bin/scp -C %u %o')" +} diff --git a/start.sh b/start.sh new file mode 100755 index 000000000000..14ac8a512999 --- /dev/null +++ b/start.sh @@ -0,0 +1,21 @@ +#! /bin/bash +# 该脚本用于处理yay安装软件时,由github下载缓慢甚至无法下载的问题 +# 检测域名是不是github,如果是,则替换为镜像网站,依旧使用curl下载 +# 如果不是github则采用axel代替curl进行15线程下载 +# 实验用链接: +# https://download.fastgit.org/beekeeper-studio/beekeeper-studio/releases/download/v1.6.11/beekeeper-studio_1.6.11_amd64.deb +# https://github.com/beekeeper-studio/beekeeper-studio/releases/download/v1.6.11/beekeeper-studio_1.6.11_amd64.deb + +domin=`echo $2 | cut -f3 -d'/'`; +others=`echo $2 | cut -f4- -d'/'`; +case "$domin" in + "github.com") + url="https://download.fastgit.org/"$others; + echo "download from github mirror $url"; + /usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o $1 $url; + ;; + *) + url=$2; + /usr/bin/axel -n 15 -a -o $1 $url; + ;; +esac |