diff --git a/deploy/openhabian.sh b/deploy/openhabian.sh index 07d1d827..9c705350 100644 --- a/deploy/openhabian.sh +++ b/deploy/openhabian.sh @@ -1,8 +1,21 @@ #!/usr/bin/env sh -# Config variables -# DEPLOY_OPENHABIAN_KEYPASS : This should be default most of the time since a custom password requires openhab config changes -# DEPLOY_OPENHABIAN_KEYSTORE : This should generate based on existing openhab env vars. +# Deploy script to install keys to the openhab keystore + +# This script attempts to restart the openhab service upon completion. +# In order for this to work, the user running acme.sh needs to be able +# to execute the DEPLOY_OPENHABIAN_RESTART command +# (default: sudo service openhab restart) without needing a password prompt. +# To ensure this deployment runs properly ensure permissions are configured +# correctly, or change the command variable as needed. + +# Configutation options: +# DEPLOY_OPENHABIAN_KEYPASS : The default should be appropriate here for most cases, +# but change this to change the password used for the keystore. +# DEPLOY_OPENHABIAN_KEYSTORE : The full path of the openhab keystore file. This will +# default to a path based on the $OPENHAB_USERDATA directory. +# This should generate based on existing openhab env vars. +# DEPLOY_OPENHABIAN_RESTART : The command used to restart openhab openhabian_deploy() { @@ -30,7 +43,7 @@ openhabian_deploy() { # Define configurable options _openhab_keystore="${DEPLOY_OPENHABIAN_KEYSTORE:-${OPENHAB_USERDATA}/etc/keystore}" _openhab_keypass="${DEPLOY_OPENHABIAN_KEYPASS:-openhab}" - _default_restart="sudo service openhab resart" + _default_restart="sudo service openhab restart" _openhab_restart="${DEPLOY_OPENHABIAN_RESTART:-$_default_restart}" _debug _openhab_keystore "$_openhab_keystore" @@ -109,6 +122,7 @@ openhabian_deploy() { _err "The new key has been installed, but openhab may not use it until restarted" _err "To prevent this error, override the restart command with DEPLOY_OPENHABIAN_RESTART \ and ensure it can be called by the acme.sh user" + return 1 fi _savedeployconf DEPLOY_OPENHABIAN_KEYSTORE "$DEPLOY_OPENHABIAN_KEYSTORE"