Refactor: OneDev (#9597)
* Refactor: OneDev * Update onedev.sh --------- Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com>
This commit is contained in:
parent
e462aba7c2
commit
a0e8ee2130
19
ct/onedev.sh
19
ct/onedev.sh
@ -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
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user