This commit is contained in:
Slaviša Arežina
2025-07-09 16:03:57 +02:00
committed by GitHub
parent acc500fe9d
commit 661a58ae29
2 changed files with 31 additions and 23 deletions

View File

@ -20,24 +20,33 @@ color
catch_errors
function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -f /usr/local/bin/gitea ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -fsSL https://github.com/go-gitea/gitea/releases/latest | grep "title>Release" | cut -d " " -f 4 | sed 's/^v//')
msg_info "Updating $APP to ${RELEASE}"
FILENAME="gitea-$RELEASE-linux-amd64"
curl -fsSL "https://github.com/go-gitea/gitea/releases/download/v$RELEASE/gitea-$RELEASE-linux-amd64" -o $FILENAME
systemctl stop gitea
rm -rf /usr/local/bin/gitea
mv $FILENAME /usr/local/bin/gitea
chmod +x /usr/local/bin/gitea
systemctl start gitea
msg_ok "Updated $APP Successfully"
exit
header_info
check_container_storage
check_container_resources
if [[ ! -f /usr/local/bin/gitea ]]; then
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -fsSL https://github.com/go-gitea/gitea/releases/latest | grep "title>Release" | cut -d " " -f 4 | sed 's/^v//')
if [[ "${RELEASE}" != "$(cat ~/.gitea 2>/dev/null)" ]] || [[ ! -f ~/.gitea ]]; then
msg_info "Stopping service"
systemctl stop gitea
msg_ok "Service stopped"
rm -rf /usr/local/bin/gitea
fetch_and_deploy_gh_release "gitea" "go-gitea/gitea" "singlefile" "latest" "/usr/local/bin" "gitea-*-linux-amd64"
chmod +x /usr/local/bin/gitea
msg_info "Starting service"
systemctl start gitea
msg_ok "Started service"
msg_ok "Update Successful"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit
}
start

View File

@ -19,10 +19,9 @@ $STD apt-get install -y git
$STD apt-get install -y sqlite3
msg_ok "Installed Dependencies"
msg_info "Installing Gitea"
RELEASE=$(curl -fsSL https://github.com/go-gitea/gitea/releases/latest | grep "title>Release" | cut -d " " -f 4 | sed 's/^v//')
curl -fsSL "https://github.com/go-gitea/gitea/releases/download/v$RELEASE/gitea-$RELEASE-linux-amd64" -o "gitea-$RELEASE-linux-amd64"
mv gitea* /usr/local/bin/gitea
fetch_and_deploy_gh_release "gitea" "go-gitea/gitea" "singlefile" "latest" "/usr/local/bin" "gitea-*-linux-amd64"
msg_info "Configuring Gitea"
chmod +x /usr/local/bin/gitea
adduser --system --group --disabled-password --shell /bin/bash --home /etc/gitea gitea >/dev/null
mkdir -p /var/lib/gitea/{custom,data,log}
@ -31,7 +30,7 @@ chmod -R 750 /var/lib/gitea/
chown root:gitea /etc/gitea
chmod 770 /etc/gitea
sudo -u gitea ln -s /var/lib/gitea/data/.ssh/ /etc/gitea/.ssh
msg_ok "Installed Gitea"
msg_ok "Configured Gitea"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/gitea.service