Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
quickinstall script now supports version
Browse files Browse the repository at this point in the history
  • Loading branch information
boypt committed Jul 19, 2021
1 parent c55f491 commit 5a13a8e
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions scripts/quickinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}

Expand All @@ -60,8 +66,7 @@ else
fi

systemctl daemon-reload
systemctl start cloud-torrent
systemctl enable cloud-torrent
systemctl enable --now cloud-torrent

cat <<EOF
#################################################################
Expand Down

0 comments on commit 5a13a8e

Please sign in to comment.