1+ #! /usr/bin/env bash
2+ source <( curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+ # Copyright (c) 2021-2024 community-scripts ORG
4+ # Author: kristocopani
5+ # License: MIT
6+ # https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
7+
8+ function header_info {
9+ clear
10+ cat << "EOF "
11+ ____ ____
12+ / __ \____ ___ / __ \___ _ __
13+ / / / / __ \/ _ \/ / / / _ \ | / /
14+ / /_/ / / / / __/ /_/ / __/ |/ /
15+ \____/_/ /_/\___/_____/\___/|___/
16+
17+ EOF
18+ }
19+ header_info
20+ echo -e " Loading..."
21+ APP=" OneDev"
22+ var_disk=" 4"
23+ var_cpu=" 2"
24+ var_ram=" 2048"
25+ var_os=" debian"
26+ var_version=" 12"
27+ variables
28+ color
29+ catch_errors
30+
31+ function default_settings() {
32+ CT_TYPE=" 1"
33+ PW=" "
34+ CT_ID=$NEXTID
35+ HN=$NSAPP
36+ DISK_SIZE=" $var_disk "
37+ CORE_COUNT=" $var_cpu "
38+ RAM_SIZE=" $var_ram "
39+ BRG=" vmbr0"
40+ NET=" dhcp"
41+ GATE=" "
42+ APT_CACHER=" "
43+ APT_CACHER_IP=" "
44+ DISABLEIP6=" no"
45+ MTU=" "
46+ SD=" "
47+ NS=" "
48+ MAC=" "
49+ VLAN=" "
50+ SSH=" no"
51+ VERB=" no"
52+ echo_default
53+ }
54+ function update_script() {
55+ header_info
56+ check_container_storage
57+ check_container_resources
58+
59+ if [[ ! -f /etc/systemd/system/onedev.service ]]; then
60+ msg_error " No ${APP} Installation Found!"
61+ exit
62+ fi
63+ GITHUB_RELEASE=$( curl -s https://api.github.com/repos/theonedev/onedev/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
64+ if [[ ! -f /opt/${APP} _version.txt ]] || [[ " ${GITHUB_RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]]; then
65+ msg_info " Stopping Service"
66+ systemctl stop onedev
67+ msg_ok " Stopped Service"
68+
69+ msg_info " Updating ${APP} to v${GITHUB_RELEASE} "
70+ cd /opt
71+ wget -q https://code.onedev.io/onedev/server/~site/onedev-latest.tar.gz
72+ tar -xzf onedev-latest.tar.gz
73+ /opt/onedev-latest/bin/upgrade.sh /opt/onedev > /dev/null
74+ RELEASE=$( cat /opt/onedev/release.properties | grep " version" | cut -d' =' -f2)
75+ echo " ${RELEASE} " > " /opt/${APP} _version.txt"
76+ msg_ok " Updated ${APP} to v${RELEASE} "
77+
78+ msg_info " Starting Service"
79+ systemctl start onedev
80+ msg_ok " Started Service"
81+
82+ msg_info " Cleaning up"
83+ rm -rf /opt/onedev-latest
84+ rm -rf /opt/onedev-latest.tar.gz
85+ msg_ok " Cleaned"
86+ msg_ok " Updated Successfully"
87+ else
88+ msg_ok " No update required. ${APP} is already at v${RELEASE} ."
89+ fi
90+ exit
91+ }
92+
93+ start
94+ build_container
95+ description
96+
97+ msg_ok " Completed Successfully!\n"
98+ echo -e " ${APP} should be reachable by going to the following URL.
99+ ${BL} http://${IP} :6610${CL} \n"
0 commit comments