From 1fb6414aa26e3ac3f2017e72b942bc6b753181b6 Mon Sep 17 00:00:00 2001 From: MichaIng <28480705+MichaIng@users.noreply.github.com> Date: Tue, 20 Nov 2018 21:59:50 +0100 Subject: [PATCH] v6.18 + DietPi-Software | Grafana: Wrap admin_password into tripled double quotes + DietPi-Software | Grafana: Move DB/plugin dir to userdata only, if it does not yet exist + DietPi-Software | PHPSysInfo: Backup existing config file before moving ours in place --- dietpi/dietpi-software | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index e504845cf2..3bc73298a7 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -4766,7 +4766,7 @@ _EOF_ fi - echo -e "deb $deb_address $G_DISTRO_NAME main" > /etc/apt/sources.list.d/grafana.list + echo "deb $deb_address $G_DISTRO_NAME main" > /etc/apt/sources.list.d/grafana.list G_AGUP fi @@ -9735,12 +9735,21 @@ _EOF_ Banner_Configuration - # - Move DB/plugins to userdata location - mv /var/lib/grafana $G_FP_DIETPI_USERDATA/ + # - Move DB/plugins to userdata location, if not already existent + if [[ -d $G_FP_DIETPI_USERDATA/grafana ]]; then + + G_DIETPI-NOTIFY 2 "Existing database/plugin directory $G_FP_DIETPI_USERDATA/grafana found. Will not overwrite..." + [[ -e /var/lib/grafana ]] && rm -R /var/lib/grafana + + else + + mv /var/lib/grafana $G_FP_DIETPI_USERDATA/ + + fi ln -sf $G_FP_DIETPI_USERDATA/grafana /var/lib/grafana - # - Set password - G_CONFIG_INJECT 'admin_password = ' "admin_password = $GLOBAL_PW" /etc/grafana/grafana.ini + # - Set password, wrap into trippled double quotes in case of ; or # being contained, according to docs: http://docs.grafana.org/installation/configuration/#password + G_CONFIG_INJECT 'admin_password[[:blank:]]*=' "admin_password = \"\"\"$GLOBAL_PW\"\"\"" /etc/grafana/grafana.ini fi @@ -9777,6 +9786,7 @@ _EOF_ if (( ${aSOFTWARE_INSTALL_STATE[$software_id]} == 1 )); then Banner_Configuration + G_BACKUP_FP /DietPi/dietpi/conf/phpsysinfo.ini cp /DietPi/dietpi/conf/phpsysinfo.ini /var/www/phpsysinfo/phpsysinfo.ini fi