@@ -20,48 +20,51 @@ color
2020catch_errors
2121
2222function update_script() {
23- header_info
24- check_container_storage
25- check_container_resources
23+ header_info
24+ check_container_storage
25+ check_container_resources
2626
27- if [[ ! -d " /opt/gomft" ]]; then
28- msg_error " No ${APP} Installation Found!"
29- exit
30- fi
31- RELEASE=$( curl -s https://api.github.com/repos/StarFleetCPTN/GoMFT/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
32- if [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]] || [[ ! -f /opt/${APP} _version.txt ]]; then
33- msg_info " Stopping $APP "
34- systemctl stop gomft
35- msg_ok " Stopped $APP "
27+ if [[ ! -d " /opt/gomft" ]]; then
28+ msg_error " No ${APP} Installation Found!"
29+ exit
30+ fi
31+ RELEASE=$( curl -s https://api.github.com/repos/StarFleetCPTN/GoMFT/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
32+ if [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]] || [[ ! -f /opt/${APP} _version.txt ]]; then
33+ msg_info " Stopping $APP "
34+ systemctl stop gomft
35+ msg_ok " Stopped $APP "
3636
37- msg_info " Updating $APP to ${RELEASE} "
38- rm -f /opt/gomft/gomft
39- temp_file=$( mktemp)
40- wget -q " https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v${RELEASE} .tar.gz" -O $temp_file
41- tar -xzf $temp_file
42- cp -rf GoMFT-${RELEASE} /* /opt/gomft
43- cd /opt/gomft
44- $STD go mod download
45- $STD go build -o gomft
46- $STD $HOME /go/bin/templ generate
47- chmod +x /opt/gomft/gomft
48- echo " ${RELEASE} " > /opt/${APP} _version.txt
49- msg_ok " Updated $APP to ${RELEASE} "
37+ msg_info " Updating $APP to ${RELEASE} "
38+ rm -f /opt/gomft/gomft
39+ temp_file=$( mktemp)
40+ wget -q " https://github.com/StarFleetCPTN/GoMFT/archive/refs/tags/v${RELEASE} .tar.gz" -O $temp_file
41+ tar -xzf $temp_file
42+ cp -rf GoMFT-${RELEASE} /* /opt/gomft
43+ cd /opt/gomft
44+ $STD go mod download
45+ $STD go install github.com/a-h/templ/cmd/templ@latest
46+ $STD $HOME /go/bin/templ generate
47+ export CGO_ENABLED=1
48+ export GOOS=linux
49+ $STD go build -o gomft
50+ chmod +x /opt/gomft/gomft
51+ echo " ${RELEASE} " > /opt/${APP} _version.txt
52+ msg_ok " Updated $APP to ${RELEASE} "
5053
51- msg_info " Cleaning Up"
52- rm -f $temp_file
53- rm -rf GoMFT-${RELEASE}
54- msg_ok " Cleanup Complete"
54+ msg_info " Cleaning Up"
55+ rm -f $temp_file
56+ rm -rf GoMFT-${RELEASE}
57+ msg_ok " Cleanup Complete"
5558
56- msg_info " Starting $APP "
57- systemctl start gomft
58- msg_ok " Started $APP "
59+ msg_info " Starting $APP "
60+ systemctl start gomft
61+ msg_ok " Started $APP "
5962
60- msg_ok " Update Successful"
61- else
62- msg_ok " No update required. ${APP} is already at ${RELEASE} "
63- fi
64- exit
63+ msg_ok " Update Successful"
64+ else
65+ msg_ok " No update required. ${APP} is already at ${RELEASE} "
66+ fi
67+ exit
6568}
6669
6770start
0 commit comments