Updated the gitea script
This commit is contained in:
@ -18,42 +18,48 @@ do
|
|||||||
done
|
done
|
||||||
set -b
|
set -b
|
||||||
ping -c1 "github.com" &>"/dev/null"
|
ping -c1 "github.com" &>"/dev/null"
|
||||||
|
ping -c1 "api.github.com" &>"/dev/null"
|
||||||
|
ping -c1 "dl.gitea.io" &>"/dev/null"
|
||||||
|
ping -c1 "raw.githubusercontent.com" &>"/dev/null"
|
||||||
if [[ "${?}" -ne 0 ]]; then
|
if [[ "${?}" -ne 0 ]]; then
|
||||||
echo "I am unable to access Github.com, that is needed to continue this Install."
|
echo "I am unable to access one of the necessary domains that are needed to continue this Install."
|
||||||
elif [[ "${#args[@]}" -eq 0 ]]; then
|
elif [[ "${#args[@]}" -eq 0 ]]; then
|
||||||
GITEA_VER="1.19.1"
|
# Check if curl is installed
|
||||||
|
if [ ! -x /usr/bin/curl ] ; then
|
||||||
|
CURL_NOT_EXIST=1
|
||||||
|
apt install -y curl
|
||||||
|
else
|
||||||
|
CURL_NOT_EXIST=0
|
||||||
|
fi
|
||||||
|
VER=$(curl --silent "https://api.github.com/repos/go-gitea/gitea/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g' )
|
||||||
sudo systemctl stop gitea
|
sudo systemctl stop gitea
|
||||||
sudo apt-get install git -y
|
sudo apt-get install git -y
|
||||||
sudo wget -O /usr/local/bin/gitea htt://github.com/go-gitea/gitea/releases/download/v"$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 adduser --system --shell /bin/bash --gecos 'Git Version Control' --group --disabled-password --home /home/git git
|
||||||
sudo mkdir -p /var/lib/gitea/{custom,data,log}
|
if [ -n "$(uname -a | grep i386)" ]; then
|
||||||
sudo chown -R git:git /var/lib/gitea
|
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-386"
|
||||||
sudo chmod -R 750 /var/lib/gitea
|
fi
|
||||||
sudo mkdir -v /etc/gitea
|
|
||||||
sudo chown -R root:git /etc/gitea
|
|
||||||
sudo chmod -R 770 /etc/gitea
|
|
||||||
sudo echo "
|
|
||||||
[Unit]
|
|
||||||
Description=Gitea
|
|
||||||
After=syslog.target
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
if [ -n "$(uname -a | grep x86_64)" ]; then
|
||||||
RestartSec=3s
|
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-amd64"
|
||||||
Type=simple
|
fi
|
||||||
User=git
|
|
||||||
Group=git
|
|
||||||
WorkingDirectory=/var/lib/gitea/
|
|
||||||
|
|
||||||
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini
|
if [ -n "$(uname -a | grep armv6l)" ]; then
|
||||||
Restart=always
|
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-arm-6"
|
||||||
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
|
fi
|
||||||
|
|
||||||
[Install]
|
if [ -n "$(uname -a | grep armv7l)" ]; then
|
||||||
WantedBy=multi-user.target
|
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-arm-7"
|
||||||
" >> /etc/systemd/system/gitea.service
|
fi
|
||||||
|
|
||||||
|
sudo mv /tmp/gitea /usr/local/bin
|
||||||
|
sudo chmod +x /usr/local/bin/gitea
|
||||||
|
sudo mkdir -p /var/lib/gitea/{custom,data,indexers,public,log}
|
||||||
|
sudo chown git: /var/lib/gitea/{data,indexers,log}
|
||||||
|
sudo chmod 750 /var/lib/gitea/{data,indexers,log}
|
||||||
|
sudo mkdir /etc/gitea
|
||||||
|
sudo chown root:git /etc/gitea
|
||||||
|
sudo chmod 770 /etc/gitea
|
||||||
|
curl -fsSL -o /etc/systemd/system/gitea.service https://raw.githubusercontent.com/go-gitea/gitea/master/contrib/systemd/gitea.service
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl enable --now gitea
|
sudo systemctl enable --now gitea
|
||||||
sudo systemctl start gitea
|
sudo systemctl start gitea
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
read -r -p "Would you like to Update Gitea? [Y/n] " input
|
read -r -p "Would you like to update Gitea? [Y/n] " input
|
||||||
|
|
||||||
case $input in
|
case $input in
|
||||||
[yY][eE][sS]|[yY])
|
[yY][eE][sS]|[yY])
|
||||||
@ -15,20 +16,50 @@ do
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
set -b
|
||||||
ping -c1 "github.com" &>"/dev/null"
|
ping -c1 "github.com" &>"/dev/null"
|
||||||
|
ping -c1 "api.github.com" &>"/dev/null"
|
||||||
|
ping -c1 "dl.gitea.io" &>"/dev/null"
|
||||||
|
ping -c1 "raw.githubusercontent.com" &>"/dev/null"
|
||||||
if [[ "${?}" -ne 0 ]]; then
|
if [[ "${?}" -ne 0 ]]; then
|
||||||
echo "I am unable to access Github.com, that is needed to continue this Install."
|
echo "I am unable to access one of the necessary domains that are needed to continue this Install."
|
||||||
elif [[ "${#args[@]}" -eq 0 ]]; then
|
elif [[ "${#args[@]}" -eq 0 ]]; then
|
||||||
GITEA_VER="1.19.1"
|
# Check if curl is installed
|
||||||
|
if [ ! -x /usr/bin/curl ] ; then
|
||||||
|
CURL_NOT_EXIST=1
|
||||||
|
apt install -y curl
|
||||||
|
else
|
||||||
|
CURL_NOT_EXIST=0
|
||||||
|
fi
|
||||||
|
VER=$(curl --silent "https://api.github.com/repos/go-gitea/gitea/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' | sed 's|[v,]||g' )
|
||||||
sudo systemctl stop gitea
|
sudo systemctl stop gitea
|
||||||
sudo wget -O /usr/local/bin/gitea https://github.com/go-gitea/gitea/releases/download/v"$GITEA_VER"/gitea-"$GITEA_VER"-linux-amd64
|
if [ -n "$(uname -a | grep i386)" ]; then
|
||||||
sudo chmod +x /usr/local/bin/gitea
|
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-386"
|
||||||
sudo chown -R git:git /var/lib/gitea
|
|
||||||
sudo chmod -R 750 /var/lib/gitea
|
|
||||||
sudo chown -R root:git /etc/gitea
|
|
||||||
sudo chmod -R 770 /etc/gitea
|
|
||||||
sudo systemctl start gitea
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Gitea has been updated!"
|
if [ -n "$(uname -a | grep x86_64)" ]; then
|
||||||
|
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-amd64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$(uname -a | grep armv6l)" ]; then
|
||||||
|
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-arm-6"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$(uname -a | grep armv7l)" ]; then
|
||||||
|
curl -fsSL -o "/tmp/gitea" "https://dl.gitea.io/gitea/$VER/gitea-$VER-linux-arm-7"
|
||||||
|
fi
|
||||||
|
sudo mv /tmp/gitea /usr/local/bin
|
||||||
|
sudo chmod +x /usr/local/bin/gitea
|
||||||
|
sudo chown git: /var/lib/gitea/{data,indexers,log}
|
||||||
|
sudo chmod 750 /var/lib/gitea/{data,indexers,log}
|
||||||
|
sudo chown root:git /etc/gitea
|
||||||
|
sudo chmod 770 /etc/gitea
|
||||||
|
sudo systemctl start gitea
|
||||||
|
sudo ufw allow 3000
|
||||||
|
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 "=================================================================="
|
||||||
|
fi
|
Reference in New Issue
Block a user