@@ -55,7 +55,30 @@ function default_settings() {
55
55
function update_script() {
56
56
header_info
57
57
if [[ ! -f /etc/systemd/system/prometheus.service ]]; then msg_error " No ${APP} Installation Found!" ; exit ; fi
58
- msg_error " There is currently no update path available."
58
+ RELEASE=$( curl -s https://api.github.com/repos/prometheus/prometheus/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
59
+ if [[ ! -f /opt/${APP} _version.txt ]] || [[ " ${RELEASE} " != " $( cat /opt/${APP} _version.txt) " ]]; then
60
+ msg_info " Stopping ${APP} "
61
+ systemctl stop prometheus
62
+ msg_ok " Stopped ${APP} "
63
+
64
+ msg_info " Updating ${APP} to ${RELEASE} "
65
+ wget -q https://github.com/prometheus/prometheus/releases/download/v${RELEASE} /prometheus-${RELEASE} .linux-amd64.tar.gz
66
+ tar -xf prometheus-${RELEASE} .linux-amd64.tar.gz
67
+ cd prometheus-${RELEASE} .linux-amd64
68
+ cp -rf prometheus promtool /usr/local/bin/
69
+ cp -rf consoles/ console_libraries/ /etc/prometheus/
70
+ cd ~
71
+ rm -rf prometheus-${RELEASE} .linux-amd64 prometheus-${RELEASE} .linux-amd64.tar.gz
72
+ echo " ${RELEASE} " > /opt/${APP} _version.txt
73
+ msg_ok " Updated ${APP} to ${RELEASE} "
74
+
75
+ msg_info " Starting ${APP} "
76
+ systemctl start prometheus
77
+ msg_ok " Started ${APP} "
78
+ msg_ok " Updated Successfully"
79
+ else
80
+ msg_ok " No update required. ${APP} is already at ${RELEASE} "
81
+ fi
59
82
exit
60
83
}
61
84
0 commit comments