From 38a02f698e6f32467c2e1adcf4898d4deac07521 Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Sun, 5 Nov 2023 23:21:54 +0100 Subject: [PATCH] add autohotspot config checks (#2091) * add autohotspot config checks * print info if AUTOHOTSPOTconfig is not set --- scripts/installscripts/buster-install-default.sh | 13 +++++++++++++ scripts/installscripts/tests/test_installation.sh | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/scripts/installscripts/buster-install-default.sh b/scripts/installscripts/buster-install-default.sh index d4b35899e..bd5da1bf9 100644 --- a/scripts/installscripts/buster-install-default.sh +++ b/scripts/installscripts/buster-install-default.sh @@ -759,6 +759,7 @@ check_config_file() { check_variable "WIFIipRouter" fi fi + check_variable "EXISTINGuse" check_variable "AUDIOiFace" @@ -776,6 +777,18 @@ check_config_file() { check_variable "DIRaudioFolders" check_variable "GPIOconfig" + # Feature optional. if config not present, defaults to NO + if [[ -z "${AUTOHOTSPOTconfig}" ]]; then + echo "INFO: \$AUTOHOTSPOTconfig is missing or not set" + else + if [[ "$AUTOHOTSPOTconfig" == "YES" ]]; then + check_variable "AUTOHOTSPOTssid" + check_variable "AUTOHOTSPOTcountryCode" + check_variable "AUTOHOTSPOTpass" + check_variable "AUTOHOTSPOTip" + fi + fi + if [ "${fail}" == "true" ]; then exit 1 fi diff --git a/scripts/installscripts/tests/test_installation.sh b/scripts/installscripts/tests/test_installation.sh index da23da9cc..ba899f855 100755 --- a/scripts/installscripts/tests/test_installation.sh +++ b/scripts/installscripts/tests/test_installation.sh @@ -136,6 +136,18 @@ verify_conf_file() { fi check_variable "MPDconfig" check_variable "DIRaudioFolders" + check_variable "GPIOconfig" + + # Feature optional. if config not present, defaults to NO + if [[ -n "${AUTOHOTSPOTconfig}" ]]; then + echo "\$AUTOHOTSPOTconfig is set to '$AUTOHOTSPOTconfig'" + if [[ "$AUTOHOTSPOTconfig" == "YES" ]]; then + check_variable "AUTOHOTSPOTssid" + check_variable "AUTOHOTSPOTcountryCode" + check_variable "AUTOHOTSPOTpass" + check_variable "AUTOHOTSPOTip" + fi + fi if [ "${fail}" == "true" ]; then exit 1