# /bin/bash # root 专用 get_github_latest_release() { curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api grep '"tag_name":' | # Get tag line sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value } export all_proxy= export http_proxy= export https_proxy= # 获取最新版本号 tag_name=$(get_github_latest_release "dotnetcore/FastGithub") echo tag_name = $tag_name # 最新版地址: url="https://gh.tj20.top/https://github.com/dotnetcore/FastGithub/releases/download/$tag_name/fastgithub_linux-x64.zip" echo url = $url sudo /usr/fastgithub_linux-x64/fastgithub stop sudo rm -rfv /usr/fastgithub_linux-x64 wget --no-check-certificate --content-disposition $url -O -|sudo busybox unzip -d /usr/ - sudo chmod go-w /usr/fastgithub_linux-x64 sudo chmod a+x /usr/fastgithub_linux-x64/fastgithub sudo /usr/fastgithub_linux-x64/fastgithub start # 公用 sed -i '/^.*fastgithub.*$/d' ~/.zshrc sed -i '/^\s*export\s\s*all_proxy.*$/d' ~/.zshrc sed -i '/^\s*export\s\s*http(s)?_proxy.*$/d' ~/.zshrc echo "export all_proxy=http://127.0.0.1:38457" >>~/.zshrc zsh -l