From a0e8ee21306cbeac0238bbab7b07de0f6fd08bb7 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Fri, 5 Dec 2025 22:16:42 +0100 Subject: [PATCH] Refactor: OneDev (#9597) * Refactor: OneDev * Update onedev.sh --------- Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com> --- ct/onedev.sh | 19 +++++++++---------- install/onedev-install.sh | 9 +++++---- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/ct/onedev.sh b/ct/onedev.sh index e8694abba3..092fcf74ae 100644 --- a/ct/onedev.sh +++ b/ct/onedev.sh @@ -27,31 +27,30 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - GITHUB_RELEASE=$(curl -fsSL https://api.github.com/repos/theonedev/onedev/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') - if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${GITHUB_RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + + if check_for_gh_release "onedev" "theonedev/onedev"; then + JAVA_VERSION="21" setup_java + msg_info "Stopping Service" systemctl stop onedev msg_ok "Stopped Service" - msg_info "Updating ${APP} to v${GITHUB_RELEASE}" + msg_info "Updating OneDev" cd /opt - curl -fsSL "https://code.onedev.io/onedev/server/~site/onedev-latest.tar.gz" -o $(basename "https://code.onedev.io/onedev/server/~site/onedev-latest.tar.gz") + curl -fsSL "https://code.onedev.io/onedev/server/~site/onedev-latest.tar.gz" -o onedev-latest.tar.gz tar -xzf onedev-latest.tar.gz $STD /opt/onedev-latest/bin/upgrade.sh /opt/onedev - RELEASE=$(cat /opt/onedev/release.properties | grep "version" | cut -d'=' -f2) rm -rf /opt/onedev-latest rm -rf /opt/onedev-latest.tar.gz - echo "${RELEASE}" >"/opt/${APP}_version.txt" - msg_ok "Updated ${APP} to v${RELEASE}" + echo "${CHECK_UPDATE_RELEASE}" >~/.onedev + msg_ok "Updated OneDev" msg_info "Starting Service" systemctl start onedev msg_ok "Started Service" msg_ok "Updated successfully!" - else - msg_ok "No update required. ${APP} is already at v${RELEASE}." + exit fi - exit } start diff --git a/install/onedev-install.sh b/install/onedev-install.sh index 360070c923..e7e6ac2717 100644 --- a/install/onedev-install.sh +++ b/install/onedev-install.sh @@ -15,21 +15,22 @@ update_os msg_info "Installing Dependencies" $STD apt install -y \ - default-jdk \ git \ git-lfs msg_ok "Installed Dependencies" +JAVA_VERSION="21" setup_java + msg_info "Installing OneDev" +RELEASE=$(curl -fsSL https://api.github.com/repos/theonedev/onedev/releases/latest | grep '"tag_name":' | cut -d'"' -f4) cd /opt -curl -fsSL "https://code.onedev.io/onedev/server/~site/onedev-latest.tar.gz" -o "/opt/onedev-latest.tar.gz" +curl -fsSL "https://code.onedev.io/onedev/server/~site/onedev-latest.tar.gz" -o onedev-latest.tar.gz tar -xzf onedev-latest.tar.gz mv /opt/onedev-latest /opt/onedev $STD /opt/onedev/bin/server.sh install systemctl start onedev -RELEASE=$(cat /opt/onedev/release.properties | grep "version" | cut -d'=' -f2) rm -rf /opt/onedev-latest.tar.gz -echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" +echo "${RELEASE}" >~/.onedev msg_ok "Installed OneDev" motd_ssh