Colors :)
This commit is contained in:
		@ -1,7 +1,7 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
VERSION=1.4.2
 | 
			
		||||
VERSION=1.4.3
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
DIR=/opt/gitea
 | 
			
		||||
@ -9,27 +9,61 @@ ARCH=linux-amd64
 | 
			
		||||
#darwin-10.6.386 darwin-10.6-amd64 linux-386 linux-arm-5,6,7,arm64,mips,mips64,mips64le
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux
 | 
			
		||||
 | 
			
		||||
# Reset
 | 
			
		||||
Color_Off='\033[0m'       # Text Reset
 | 
			
		||||
 | 
			
		||||
# Regular Colors
 | 
			
		||||
Black='\033[0;30m'        # Black
 | 
			
		||||
Red='\033[0;31m'          # Red
 | 
			
		||||
Green='\033[0;32m'        # Green
 | 
			
		||||
Yellow='\033[0;33m'       # Yellow
 | 
			
		||||
Blue='\033[0;34m'         # Blue
 | 
			
		||||
Purple='\033[0;35m'       # Purple
 | 
			
		||||
Cyan='\033[0;36m'         # Cyan
 | 
			
		||||
White='\033[0;37m'        # White
 | 
			
		||||
 | 
			
		||||
# Bold
 | 
			
		||||
BBlack='\033[1;30m'       # Black
 | 
			
		||||
BRed='\033[1;31m'         # Red
 | 
			
		||||
BGreen='\033[1;32m'       # Green
 | 
			
		||||
BYellow='\033[1;33m'      # Yellow
 | 
			
		||||
BBlue='\033[1;34m'        # Blue
 | 
			
		||||
BPurple='\033[1;35m'      # Purple
 | 
			
		||||
BCyan='\033[1;36m'        # Cyan
 | 
			
		||||
BWhite='\033[1;37m'       # White
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
echo -e "${Green}Update of gitea to ${VERSION} is in progress... ${Color_Off}"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if [ -f $DIR/bin/gitea-$VERSION-$ARCH ]; then
 | 
			
		||||
 | 
			
		||||
    echo "Latest version is already downloaded!"
 | 
			
		||||
    echo -e "\n${Green}Latest version ${VERSION} is already downloaded! ${Color_Off}\n"
 | 
			
		||||
 | 
			
		||||
else
 | 
			
		||||
 | 
			
		||||
    echo "Downloading the newest version..."
 | 
			
		||||
    echo -e "\n${Green}Newer version ${VERSION} is available! ${Color_Off}\n"
 | 
			
		||||
 | 
			
		||||
    echo -e "${Green}Downloading the newest version...${Color_Off}"
 | 
			
		||||
    wget -N https://dl.gitea.io/gitea/$VERSION/gitea-$VERSION-$ARCH -P $DIR/bin/
 | 
			
		||||
 | 
			
		||||
    echo "Creating symlinks..."
 | 
			
		||||
    
 | 
			
		||||
    echo -e "\n${Green}Creating symlinks...${Color_Off}"
 | 
			
		||||
    ln -sfv $DIR/bin/gitea-$VERSION-$ARCH $DIR/gitea
 | 
			
		||||
 | 
			
		||||
    echo "Fixing permissions..."
 | 
			
		||||
    
 | 
			
		||||
    echo -e "\n${Green}Fixing permissions...${Color_Off}"
 | 
			
		||||
    chmod -v +x $DIR/bin/gitea-$VERSION-$ARCH
 | 
			
		||||
 | 
			
		||||
    echo "Restarting service..."
 | 
			
		||||
    echo -e "\n${Green}Restarting service...${Color_Off}"
 | 
			
		||||
    service gitea restart
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo -e "\n${Green}Gitea service status:${Color_Off}\n"
 | 
			
		||||
service gitea status
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user