From bab44a79b744a8e215907fed71df472bf908766f Mon Sep 17 00:00:00 2001 From: cimryan Date: Fri, 2 Nov 2018 22:04:31 -0700 Subject: [PATCH] Split the implementation of check_and_configure_pushover into separate check and configure steps. --- setup/pi/configure.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/setup/pi/configure.sh b/setup/pi/configure.sh index a976c88..cc6874c 100644 --- a/setup/pi/configure.sh +++ b/setup/pi/configure.sh @@ -124,7 +124,8 @@ function install_archive_scripts () { get_script $install_path write-archive-configs-to.sh $archive_module } -function check_and_configure_pushover () { + +function check_pushover_configuration () { if [ ! -z "${pushover_enabled+x}" ] then if [ ! -n "${pushover_user_key+x}" ] || [ ! -n "${pushover_app_key+x}" ] @@ -138,17 +139,28 @@ function check_and_configure_pushover () { then echo "STOP: You're trying to setup Pushover, but didn't replace the default User and App key values." exit 1 - else - echo "Enabling pushover" - echo "export pushover_enabled=true" > /root/.teslaCamPushoverCredentials - echo "export pushover_user_key=$pushover_user_key" >> /root/.teslaCamPushoverCredentials - echo "export pushover_app_key=$pushover_app_key" >> /root/.teslaCamPushoverCredentials fi + fi +} + +function configure_pushover () { + if [ ! -z "${pushover_enabled+x}" ] + then + echo "Enabling pushover" + echo "export pushover_enabled=true" > /root/.teslaCamPushoverCredentials + echo "export pushover_user_key=$pushover_user_key" >> /root/.teslaCamPushoverCredentials + echo "export pushover_app_key=$pushover_app_key" >> /root/.teslaCamPushoverCredentials else echo "Pushover not configured." fi } +function check_and_configure_pushover () { + check_pushover_configuration + + configure_pushover +} + function install_pushover_scripts() { local install_path="$1" get_script $install_path send-pushover run