腾讯云6折购 大佬有话说 :
wget怎么下载GitHub的latest releases,而不是对应的版本号?想….
本帖最后由 腾讯云6折购 于 2022-6-28 23:09 编辑
想每次都下载最新版
https://docs.github.com/cn/repositories/releasing-projects-on-github/linking-to-releaseshttps://cdn.jsdelivr.net/gh/master-of-forums/master-of-forums/public/images/patch.gif
法外狂徒张三 大佬有话说 :
卵而发现releases文件中包含版本号。。。
minick 大佬有话说 :
去找对应的下就行
nop 大佬有话说 :
如果是生产用途,可以搞个php中转一下
Laa 大佬有话说 :
参考 https://api.github.com/repos/shadowsocks/shadowsocks-rust/releases/latest
你大爷 大佬有话说 :
有些包名就有版本号,所以这种只适用于包名不含版本号的情况。
腿毛飘飘 大佬有话说 :
#!/bin/bash
VER="$(curl -s https://api.github.com/repos/caddyserver/caddy/releases/latest | sed ‘y/,/n/’ | grep tag_name | awk -F ‘"’ ‘{print $4}’)"
CUR_VER="$($HOME/caddy/caddy version | cut -d " " -f1)"
if [[ "$VER" == "$CUR_VER" ]] ; then
echo "Lastest version $VER is already installed,exiting…"
exit
fi
ARCH=$(uname -m)
VDIS="amd64"
if [[ "$ARCH" == "i686" ]] || [[ "$ARCH" == "i386" ]]; then
VDIS="386"
elif [[ "$ARCH" == *"armv8"* ]] || [[ "$ARCH" == "aarch64" ]]; then
VDIS="arm64"
fi
mkdir -p /tmp/caddy
echo "Installing Caddy ${VER} on ${ARCH}"
DOWNLOAD_LINK="https://github.com/caddyserver/caddy/releases/download/${VER}/caddy_${VER##*v}_linux_${VDIS}.tar.gz"
echo "Downloading ${DOWNLOAD_LINK} directly."
curl -L -H "Cache-Control: no-cache" -o "/tmp/caddy/caddy.tar.gz" ${DOWNLOAD_LINK}
echo "Extracting Caddy package to /tmp/caddy/."
tar zxvf "/tmp/caddy/caddy.tar.gz" -C "/tmp/caddy/"
rm $HOME/caddy/caddy
cp "/tmp/caddy/caddy" "$HOME/caddy/caddy"
loveqianool 大佬有话说 :
wget -qO- "https://api.github.com/repos/shadowsocks/shadowsocks-rust/releases" | grep -m 1 ‘"tag_name":’ | sed -E ‘s/.*"([^"]+)".*/1/’