From 4fe843b1b9e95f9c0301ffecd49a87e1800c4ed8 Mon Sep 17 00:00:00 2001 From: nicedevil007 <17103076+nicedevil007@users.noreply.github.com> Date: Wed, 22 Mar 2023 21:32:44 +0100 Subject: [PATCH] New Grafana Update Menu (#1213) and readded IP Change options from "old scripts" --- ct/alpine-grafana.sh | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/ct/alpine-grafana.sh b/ct/alpine-grafana.sh index eb8dc51a..fde9667b 100644 --- a/ct/alpine-grafana.sh +++ b/ct/alpine-grafana.sh @@ -52,17 +52,36 @@ function default_settings() { } function update_script() { - UPD=$(whiptail --title "SUPPORT" --radiolist --cancel-button Exit-Script "Spacebar = Select" 11 58 1 \ - "1" "Check for Grafana Updates" ON \ - 3>&1 1>&2 2>&3) - - header_info - if [ "$UPD" == "1" ]; then - apk update && apk upgrade - exit; - else - exit-script +LXCIP=$(ip a s dev eth0 | awk '/inet / {print $2}' | cut -d/ -f1) +while true; do + CHOICE=$(whiptail --title "SUPPORT" --menu "Select option" --cancel-button Exit-Script 11 58 3 \ + "1" "Check for Grafana Updates" \ + "2" "Allow 0.0.0.0 for listening" \ + "3" "Allow only ${LXCIP} for listening" 3>&2 2>&1 1>&3 + ) + exit_status=$? + if [ $exit_status == 1 ] ; then + clear + exit-script fi + header_info + case $CHOICE in + 1 ) + apk update && apk upgrade + exit + ;; + 2 ) + sed -i -e "s/cfg:server.http_addr=.*/cfg:server.http_addr=0.0.0.0/g" /etc/conf.d/grafana + service grafana restart + exit + ;; + 3 ) + sed -i -e "s/cfg:server.http_addr=.*/cfg:server.http_addr=$LXCIP/g" /etc/conf.d/grafana + service grafana restart + exit + ;; + esac +done } start