From 5a13a8e673d7ce76d6218f73144f0827b88b2a6f Mon Sep 17 00:00:00 2001 From: boypt <1033514+boypt@users.noreply.github.com> Date: Mon, 19 Jul 2021 15:29:03 +0800 Subject: [PATCH] quickinstall script now supports version --- scripts/quickinstall.sh | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/quickinstall.sh b/scripts/quickinstall.sh index 26e12b733..a476c4087 100644 --- a/scripts/quickinstall.sh +++ b/scripts/quickinstall.sh @@ -15,6 +15,13 @@ if [[ $(id -u) -ne 0 ]]; then exit 1 fi +GHAPI=https://api.github.com/repos/boypt/simple-torrent/releases/latest +VERSION=${1:-latest} +if [[ "$VERSION" != "latest" ]]; then + GHAPI=https://api.github.com/repos/boypt/simple-torrent/releases/tags/${VERSION} + echo "The script is trying to install version ${VERSION}" +fi + HOSTIP=$(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p') CLDBIN=/usr/local/bin/cloud-torrent OSARCH=$(uname -m) @@ -46,8 +53,7 @@ if [[ x${NEEDAUTH^^} == x"Y" ]]; then fi systemctl stop cloud-torrent || true -wget -qO- https://api.github.com/repos/boypt/simple-torrent/releases/latest \ -| grep browser_download_url | grep "$BINTAG" | cut -d '"' -f 4 \ +wget -qO- $GHAPI | grep browser_download_url | grep "$BINTAG" | cut -d '"' -f 4 \ | wget --no-verbose -i- -O- | gzip -d -c > ${CLDBIN} chmod 0755 ${CLDBIN} @@ -60,8 +66,7 @@ else fi systemctl daemon-reload -systemctl start cloud-torrent -systemctl enable cloud-torrent +systemctl enable --now cloud-torrent cat <