-
-
Save TopperBG/819defe31db0eaccb7f0c8a10d349699 to your computer and use it in GitHub Desktop.
TorrServer update file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#TorrServer don't have docker image at least not often updated so I create script to build one from latest github tag | |
REPO="YouROK/TorrServer" | |
WORKDIR="/root/Docker/TorrServer/" | |
cd $WORKDIR | |
TARGETVER=$(curl -s "https://api.github.com/repos/$REPO/releases/latest" | awk -F '"' '/tag_name/{print $4}') | |
CURRENTVER=$(< current.ver) | |
echo "$TARGETVER" > target.ver | |
if [[ "$TARGETVER" != "$CURRENTVER" ]]; then | |
docker stop TorrServer | |
echo "Updating ..." | |
sed -i "s/^\(ENV TS_VERSION\s*=\s*\).*$/\1$TARGETVER/" Dockerfile | |
docker rm TorrServer | |
echo "$TARGETVER" > current.ver | |
docker build -t torrserver:$TARGETVER . | |
docker run -d --name TorrServer --restart=always -v /torrserver/db:/torrserver/db -p 8090:8090 torrserver:$TARGETVER | |
docker start TorrServer | |
else | |
echo "Already have latest TorrServer $CURRENTVER" | |
fi | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment