Solution of Arch/Manjaro/Endeavor update/install AUR software timeout/fail issue

1.modify hosts file to accelerate github web page access.

sudo kate /etc/hosts

windows hosts path:  C:Windows/System32/drivers/etc/hosts
# for github access acceleration
199.232.69.194 github.global.ssl.fastly.net
#140.82.114.4 github.com
hub.njuu.cf github.com
#hub.nuaa.cf github.com
#hub.yzuu.cf github.com
#kgithub.com github.com

hint: ip test list
209.141.36.186 214 毫秒
104.21.20.54 275 毫秒
172.67.177.91 468 毫秒

2.Use alternative script for github related packages download acceleration.

2.1 system yay/pacman makepkg.conf file modify:
kate /etc/makepkg.conf
#DLAGENTS=('file::/usr/bin/curl -qgC - -o %o %u'
# 'ftp::/usr/bin/curl -qgfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
# 'http::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
# 'https::/usr/bin/curl -qgb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
# 'rsync::/usr/bin/rsync --no-motd -z %u %o'
# 'scp::/usr/bin/scp -C %u %o')

# modified by cmm
DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u'
'ftp::/usr/bin/axel -n 15 -a -o %o %u'
'http::/usr/bin/axel -n 15 -a -o %o %u'
'https::/home/cmm/fake_axel_for_makepkg %o %u'
'rsync::/usr/bin/rsync --no-motd -z %u %o'
'scp::/usr/bin/scp -C %u %o')

2.2 alternative script
content of shell script '/home/cmm/fake_axel_for_makepkg'

#! /bin/bash
# 该脚本用于处理yay安装软件时,由github下载缓慢甚至无法下载的问题
# 检测域名是不是github,如果是,则替换为镜像网站,依旧使用curl下载
# 如果不是github则采用axel代替curl进行15线程下载
# 实验用链接:
#axel -n 15 https://ghproxy.com/https://github.com/Fndroid/clash_for_windows_pkg/releases/download/0.20.16/Clash.for.Windows-0.20.16-x64-linux.tar.gz

domin=`echo $2 | cut -f3 -d'/'`;
others=`echo $2 | cut -f4- -d'/'`;

# https://ghproxy.com/https://github.com/Fndroid/clash_for_windows_pkg/releases/download/0.20.16/Clash.for.Windows-0.20.16-x64-linux.tar.gz
case "$domin" in
"github.com")
url="https://ghproxy.com/https://github.com/"$others;
echo "download from github mirror $url";
/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o $1 $url;
;;

# https://ghproxy.com/https://raw.githubusercontent.com/Dreamacro/clash/master/docs/logo.png
"raw.githubusercontent.com")
url="https://ghproxy.com/https://raw.githubusercontent.com/"$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

3. after bothe 1,2 steps, you can download aur soft which come from github fluently! have fun.
yay -Syyu

refs:
GitHub - mirrors and accelerate site:
https://www.ooopn.com/tool/github/

github accelerate down:
#very fast
https://ghproxy.com/

# slow
https://gh.api.99988866.xyz/

posted @ 2023-02-25 22:32  petercao  阅读(144)  评论(1编辑  收藏  举报