Split the implementation of check_and_configure_pushover into separate check and configure steps.

This commit is contained in:
cimryan
2018-11-02 22:04:31 -07:00
parent 1099f8ada8
commit bab44a79b7

View File

@@ -124,7 +124,8 @@ function install_archive_scripts () {
get_script $install_path write-archive-configs-to.sh $archive_module 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}" ] if [ ! -z "${pushover_enabled+x}" ]
then then
if [ ! -n "${pushover_user_key+x}" ] || [ ! -n "${pushover_app_key+x}" ] if [ ! -n "${pushover_user_key+x}" ] || [ ! -n "${pushover_app_key+x}" ]
@@ -138,17 +139,28 @@ function check_and_configure_pushover () {
then then
echo "STOP: You're trying to setup Pushover, but didn't replace the default User and App key values." echo "STOP: You're trying to setup Pushover, but didn't replace the default User and App key values."
exit 1 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
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 else
echo "Pushover not configured." echo "Pushover not configured."
fi fi
} }
function check_and_configure_pushover () {
check_pushover_configuration
configure_pushover
}
function install_pushover_scripts() { function install_pushover_scripts() {
local install_path="$1" local install_path="$1"
get_script $install_path send-pushover run get_script $install_path send-pushover run