@@ -27,31 +27,30 @@ function update_script() {
2727 msg_error " No ${APP} Installation Found!"
2828 exit
2929 fi
30- GITHUB_RELEASE=$( curl -fsSL https://api.github.com/repos/theonedev/onedev/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
31- if [[ ! -f /opt/${APP} _version.txt ]] || [[ " ${GITHUB_RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]]; then
30+
31+ if check_for_gh_release " onedev" " theonedev/onedev" ; then
32+ JAVA_VERSION=" 21" setup_java
33+
3234 msg_info " Stopping Service"
3335 systemctl stop onedev
3436 msg_ok " Stopped Service"
3537
36- msg_info " Updating ${APP} to v ${GITHUB_RELEASE} "
38+ msg_info " Updating OneDev "
3739 cd /opt
38- 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" )
40+ curl -fsSL " https://code.onedev.io/onedev/server/~site/onedev-latest.tar.gz" -o onedev-latest.tar.gz
3941 tar -xzf onedev-latest.tar.gz
4042 $STD /opt/onedev-latest/bin/upgrade.sh /opt/onedev
41- RELEASE=$( cat /opt/onedev/release.properties | grep " version" | cut -d' =' -f2)
4243 rm -rf /opt/onedev-latest
4344 rm -rf /opt/onedev-latest.tar.gz
44- echo " ${RELEASE } " > " /opt/ ${APP} _version.txt "
45- msg_ok " Updated ${APP} to v ${RELEASE} "
45+ echo " ${CHECK_UPDATE_RELEASE } " > ~/.onedev
46+ msg_ok " Updated OneDev "
4647
4748 msg_info " Starting Service"
4849 systemctl start onedev
4950 msg_ok " Started Service"
5051 msg_ok " Updated successfully!"
51- else
52- msg_ok " No update required. ${APP} is already at v${RELEASE} ."
52+ exit
5353 fi
54- exit
5554}
5655
5756start
0 commit comments