@@ -20,24 +20,33 @@ color
2020catch_errors
2121
2222function update_script() {
23- header_info
24- check_container_storage
25- check_container_resources
26- if [[ ! -f /usr/local/bin/gitea ]]; then
27- msg_error " No ${APP} Installation Found!"
28- exit
29- fi
30- RELEASE=$( curl -fsSL https://github.com/go-gitea/gitea/releases/latest | grep " title>Release" | cut -d " " -f 4 | sed ' s/^v//' )
31- msg_info " Updating $APP to ${RELEASE} "
32- FILENAME=" gitea-$RELEASE -linux-amd64"
33- curl -fsSL " https://github.com/go-gitea/gitea/releases/download/v$RELEASE /gitea-$RELEASE -linux-amd64" -o $FILENAME
34- systemctl stop gitea
35- rm -rf /usr/local/bin/gitea
36- mv $FILENAME /usr/local/bin/gitea
37- chmod +x /usr/local/bin/gitea
38- systemctl start gitea
39- msg_ok " Updated $APP Successfully"
40- exit
23+ header_info
24+ check_container_storage
25+ check_container_resources
26+
27+ if [[ ! -f /usr/local/bin/gitea ]]; then
28+ msg_error " No ${APP} Installation Found!"
29+ exit
30+ fi
31+ RELEASE=$( curl -fsSL https://github.com/go-gitea/gitea/releases/latest | grep " title>Release" | cut -d " " -f 4 | sed ' s/^v//' )
32+ if [[ " ${RELEASE} " != " $( cat ~ /.gitea 2> /dev/null) " ]] || [[ ! -f ~ /.gitea ]]; then
33+ msg_info " Stopping service"
34+ systemctl stop gitea
35+ msg_ok " Service stopped"
36+
37+ rm -rf /usr/local/bin/gitea
38+ fetch_and_deploy_gh_release " gitea" " go-gitea/gitea" " singlefile" " latest" " /usr/local/bin" " gitea-*-linux-amd64"
39+ chmod +x /usr/local/bin/gitea
40+
41+ msg_info " Starting service"
42+ systemctl start gitea
43+ msg_ok " Started service"
44+
45+ msg_ok " Update Successful"
46+ else
47+ msg_ok " No update required. ${APP} is already at ${RELEASE} "
48+ fi
49+ exit
4150}
4251
4352start
0 commit comments