forked from Sophia/thelinuxlist
43 lines
1.7 KiB
Bash
43 lines
1.7 KiB
Bash
#!/bin/bash
|
|
|
|
while true
|
|
do
|
|
read -r -p "Would you like to install Gitea? [Y/n] " input
|
|
|
|
case $input in
|
|
[yY][eE][sS]|[yY])
|
|
break
|
|
;;
|
|
[nN][oO]|[nN])
|
|
break
|
|
;;
|
|
*)
|
|
echo "That wasn't an option..."
|
|
;;
|
|
esac
|
|
done
|
|
GITEA_VER="1.17.3"
|
|
sudo systemctl stop gitea
|
|
sudo apt-get install git -y
|
|
sudo ufw allow 3000
|
|
sudo wget -O /usr/local/bin/gitea https://dl.gitea.io/gitea/$GITEA_VER/gitea-"$GITEA_VER"-linux-amd64
|
|
sudo chmod +x /usr/local/bin/gitea
|
|
sudo adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git
|
|
sudo mkdir -pv /var/lib/gitea/{custom,data,log}
|
|
sudo chown -Rv git:git /var/lib/gitea
|
|
sudo chmod -Rv 750 /var/lib/gitea
|
|
sudo mkdir -v /etc/gitea
|
|
sudo chown -Rv root:git /etc/gitea
|
|
sudo chmod -Rv 770 /etc/gitea
|
|
sudo wget -O /etc/systemd/system/gitea.service https://git.oldgate.org/Sophia/thelinuxlist/raw/branch/main/systemd/gitea.service
|
|
sudo systemctl daemon-reload
|
|
sudo systemctl enable --now gitea
|
|
sudo systemctl start gitea
|
|
|
|
echo -e "=================================================================="
|
|
publicipaddress=$(curl -sS --connect-timeout 10 -m 60 https://ipv4.icanhazip.com/ || curl -sS --connect-timeout 10 -m 60 https://api.ipify.org )
|
|
intenalip=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^127\.|^255\.|^0\." | head -n 1)
|
|
echo "Gitea Should be available at http://${intenalip}:3000"
|
|
echo "Or If you are using a VPS at http://${publicipaddress}:3000"
|
|
echo -e "=================================================================="
|