Add 'scripts/gogsinstall.sh'

This commit is contained in:
Sophia Atkinson 2022-10-21 02:59:13 -07:00
parent 79ccd6a1e8
commit 1f473b929e
1 changed files with 39 additions and 0 deletions

39
scripts/gogsinstall.sh Normal file
View File

@ -0,0 +1,39 @@
#!/bin/bash
while true
do
read -r -p "Would you like to install Gogs? [Y/n] " input
case $input in
[yY][eE][sS]|[yY])
break
;;
[nN][oO]|[nN])
break
;;
*)
echo "That wasn't an option..."
;;
esac
done
sudo apt install wget -y
export VER=0.12.10
sudo wget https://dl.gogs.io/0.12.10/gogs_{VER}_linux_amd64.tar.gz
tar xvf linux_amd64.tar.gz
sudo apt install git -y
sudo adduser git
sudo mkdir /var/log/gogs
sudo chown -R git:git /var/log/gogs/
sudo wget -O /etc/systemd/system/gogs.service https://git.oldgate.org/Sophia/thelinuxlist/raw/branch/main/systemd/gogs.service
sudo rsync -avz gogs/* /home/git/
sudo chown -R git:git /home/git/
sudo systemctl daemon-reload
sudo systemctl enable gogs
sudo systemctl start gogs
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 "Gogs Should be available at http://${intenalip}:3000"
echo "Or If you are using a VPS at http://${publicipaddress}:3000"
echo -e "=================================================================="