Refactor: OneDev (#9597)

* Refactor: OneDev

* Update onedev.sh

---------

Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com>
This commit is contained in:
CanbiZ 2025-12-05 22:16:42 +01:00 committed by GitHub
parent e462aba7c2
commit a0e8ee2130
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 14 deletions

View File

@ -27,31 +27,30 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi 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" msg_info "Stopping Service"
systemctl stop onedev systemctl stop onedev
msg_ok "Stopped Service" msg_ok "Stopped Service"
msg_info "Updating ${APP} to v${GITHUB_RELEASE}" msg_info "Updating OneDev"
cd /opt 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 tar -xzf onedev-latest.tar.gz
$STD /opt/onedev-latest/bin/upgrade.sh /opt/onedev $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
rm -rf /opt/onedev-latest.tar.gz rm -rf /opt/onedev-latest.tar.gz
echo "${RELEASE}" >"/opt/${APP}_version.txt" echo "${CHECK_UPDATE_RELEASE}" >~/.onedev
msg_ok "Updated ${APP} to v${RELEASE}" msg_ok "Updated OneDev"
msg_info "Starting Service" msg_info "Starting Service"
systemctl start onedev systemctl start onedev
msg_ok "Started Service" msg_ok "Started Service"
msg_ok "Updated successfully!" msg_ok "Updated successfully!"
else
msg_ok "No update required. ${APP} is already at v${RELEASE}."
fi
exit exit
fi
} }
start start

View File

@ -15,21 +15,22 @@ update_os
msg_info "Installing Dependencies" msg_info "Installing Dependencies"
$STD apt install -y \ $STD apt install -y \
default-jdk \
git \ git \
git-lfs git-lfs
msg_ok "Installed Dependencies" msg_ok "Installed Dependencies"
JAVA_VERSION="21" setup_java
msg_info "Installing OneDev" msg_info "Installing OneDev"
RELEASE=$(curl -fsSL https://api.github.com/repos/theonedev/onedev/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
cd /opt 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 tar -xzf onedev-latest.tar.gz
mv /opt/onedev-latest /opt/onedev mv /opt/onedev-latest /opt/onedev
$STD /opt/onedev/bin/server.sh install $STD /opt/onedev/bin/server.sh install
systemctl start onedev systemctl start onedev
RELEASE=$(cat /opt/onedev/release.properties | grep "version" | cut -d'=' -f2)
rm -rf /opt/onedev-latest.tar.gz rm -rf /opt/onedev-latest.tar.gz
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt" echo "${RELEASE}" >~/.onedev
msg_ok "Installed OneDev" msg_ok "Installed OneDev"
motd_ssh motd_ssh