Checking if the requested version is already downloaded.

This commit is contained in:
Deni 2018-06-11 09:10:22 +02:00
parent d4425dd2c7
commit 4e6afd5fc1

View File

@ -8,21 +8,28 @@ DIR=/opt/gitea
ARCH=linux-amd64
#darwin-10.6.386 darwin-10.6-amd64 linux-386 linux-arm-5,6,7,arm64,mips,mips64,mips64le
echo "Downloading the newest version..."
wget -N https://dl.gitea.io/gitea/$VERSION/gitea-$VERSION-$ARCH -P $DIR/bin/
echo "Creating symlinks..."
ln -sfv $DIR/bin/gitea-$VERSION-$ARCH $DIR/gitea
if [ -f $DIR/bin/gitea-$VERSION-$ARCH ]; then
echo "Fixing permissions..."
chmod -v +x $DIR/bin/gitea-$VERSION-$ARCH
echo "Latest version is already downloaded!"
else
echo "Downloading the newest version..."
wget -N https://dl.gitea.io/gitea/$VERSION/gitea-$VERSION-$ARCH -P $DIR/bin/
echo "Creating symlinks..."
ln -sfv $DIR/bin/gitea-$VERSION-$ARCH $DIR/gitea
echo "Fixing permissions..."
chmod -v +x $DIR/bin/gitea-$VERSION-$ARCH
echo "Restarting service..."
service gitea restart
fi
echo "Restarting service..."
service gitea restart
service gitea status
# check if $DIR/bin exists otherwise create it
# try to download new version
# if you have the latest, break and exit
# else do other things