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:
45
ct/gitea.sh
45
ct/gitea.sh
@ -20,24 +20,33 @@ color
|
|||||||
catch_errors
|
catch_errors
|
||||||
|
|
||||||
function update_script() {
|
function update_script() {
|
||||||
header_info
|
header_info
|
||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
check_container_resources
|
||||||
if [[ ! -f /usr/local/bin/gitea ]]; then
|
|
||||||
msg_error "No ${APP} Installation Found!"
|
if [[ ! -f /usr/local/bin/gitea ]]; then
|
||||||
exit
|
msg_error "No ${APP} Installation Found!"
|
||||||
fi
|
exit
|
||||||
RELEASE=$(curl -fsSL https://github.com/go-gitea/gitea/releases/latest | grep "title>Release" | cut -d " " -f 4 | sed 's/^v//')
|
fi
|
||||||
msg_info "Updating $APP to ${RELEASE}"
|
RELEASE=$(curl -fsSL https://github.com/go-gitea/gitea/releases/latest | grep "title>Release" | cut -d " " -f 4 | sed 's/^v//')
|
||||||
FILENAME="gitea-$RELEASE-linux-amd64"
|
if [[ "${RELEASE}" != "$(cat ~/.gitea 2>/dev/null)" ]] || [[ ! -f ~/.gitea ]]; then
|
||||||
curl -fsSL "https://github.com/go-gitea/gitea/releases/download/v$RELEASE/gitea-$RELEASE-linux-amd64" -o $FILENAME
|
msg_info "Stopping service"
|
||||||
systemctl stop gitea
|
systemctl stop gitea
|
||||||
rm -rf /usr/local/bin/gitea
|
msg_ok "Service stopped"
|
||||||
mv $FILENAME /usr/local/bin/gitea
|
|
||||||
chmod +x /usr/local/bin/gitea
|
rm -rf /usr/local/bin/gitea
|
||||||
systemctl start gitea
|
fetch_and_deploy_gh_release "gitea" "go-gitea/gitea" "singlefile" "latest" "/usr/local/bin" "gitea-*-linux-amd64"
|
||||||
msg_ok "Updated $APP Successfully"
|
chmod +x /usr/local/bin/gitea
|
||||||
exit
|
|
||||||
|
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
|
start
|
||||||
|
@ -19,10 +19,9 @@ $STD apt-get install -y git
|
|||||||
$STD apt-get install -y sqlite3
|
$STD apt-get install -y sqlite3
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Installing Gitea"
|
fetch_and_deploy_gh_release "gitea" "go-gitea/gitea" "singlefile" "latest" "/usr/local/bin" "gitea-*-linux-amd64"
|
||||||
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"
|
msg_info "Configuring Gitea"
|
||||||
mv gitea* /usr/local/bin/gitea
|
|
||||||
chmod +x /usr/local/bin/gitea
|
chmod +x /usr/local/bin/gitea
|
||||||
adduser --system --group --disabled-password --shell /bin/bash --home /etc/gitea gitea >/dev/null
|
adduser --system --group --disabled-password --shell /bin/bash --home /etc/gitea gitea >/dev/null
|
||||||
mkdir -p /var/lib/gitea/{custom,data,log}
|
mkdir -p /var/lib/gitea/{custom,data,log}
|
||||||
@ -31,7 +30,7 @@ chmod -R 750 /var/lib/gitea/
|
|||||||
chown root:gitea /etc/gitea
|
chown root:gitea /etc/gitea
|
||||||
chmod 770 /etc/gitea
|
chmod 770 /etc/gitea
|
||||||
sudo -u gitea ln -s /var/lib/gitea/data/.ssh/ /etc/gitea/.ssh
|
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"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/systemd/system/gitea.service
|
cat <<EOF >/etc/systemd/system/gitea.service
|
||||||
|
Reference in New Issue
Block a user