mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-07-10 07:57:37 +00:00
Refactor (#5876)
This commit is contained in:
19
ct/gitea.sh
19
ct/gitea.sh
@ -23,20 +23,29 @@ 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
|
||||
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
|
||||
mv $FILENAME /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 "Updated $APP Successfully"
|
||||
msg_ok "Started service"
|
||||
|
||||
msg_ok "Update Successful"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
fi
|
||||
exit
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user