chore: refactor update messages

This commit is contained in:
Tobias
2026-01-06 17:05:47 +01:00
parent 7c27cceec6
commit 5d7084c0bb
78 changed files with 155 additions and 158 deletions

View File

@@ -32,11 +32,11 @@ function update_script() {
RELEASE=$(curl -fsSL https://api.github.com/repos/arpanghosh8453/garmin-grafana/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
if [[ ! -d /opt/garmin-grafana/ ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_info "Stopping $APP"
msg_info "Stopping Services"
systemctl stop garmin-grafana
systemctl stop grafana-server
systemctl stop influxdb
msg_ok "Stopped $APP"
msg_ok "Stopped Services"
if [[ ! -f /opt/garmin-grafana/.env ]]; then
msg_error "No .env file found in /opt/garmin-grafana/.env"
@@ -59,7 +59,6 @@ function update_script() {
mv "garmin-grafana-${RELEASE}/" "/opt/garmin-grafana"
rm -f "${RELEASE}.zip"
$STD uv sync --locked --project /opt/garmin-grafana/
# shellcheck disable=SC2016
sed -i 's/\${DS_GARMIN_STATS}/garmin_influxdb/g' /opt/garmin-grafana/Grafana_Dashboard/Garmin-Grafana-Dashboard.json
sed -i 's/influxdb:8086/localhost:8086/' /opt/garmin-grafana/Grafana_Datasource/influxdb.yaml
sed -i "s/influxdb_user/${INFLUXDB_USER}/" /opt/garmin-grafana/Grafana_Datasource/influxdb.yaml
@@ -73,18 +72,17 @@ function update_script() {
cp -r /opt/garmin-grafana-backup/.garminconnect /opt/garmin-grafana/.garminconnect
msg_ok "Updated $APP to v${RELEASE}"
msg_info "Starting $APP"
msg_info "Starting Services"
systemctl start garmin-grafana
systemctl start grafana-server
systemctl start influxdb
msg_ok "Started $APP"
msg_ok "Started Services"
msg_info "Cleaning Up"
rm -rf /opt/garmin-grafana-backup
msg_ok "Cleanup Completed"
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Update Successful"
msg_ok "Updated Successfully!"
else
msg_ok "No update required. ${APP} is already at v${RELEASE}"
fi
@@ -95,7 +93,7 @@ start
build_container
description
msg_ok "Completed Successfully!\n"
msg_ok "Completed successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:3000${CL}"