diff --git a/profiles/templates/homeassistant/homeassistant/init.homeassistant b/profiles/templates/homeassistant/homeassistant/init.homeassistant index a3b8dde..34de5cf 100644 --- a/profiles/templates/homeassistant/homeassistant/init.homeassistant +++ b/profiles/templates/homeassistant/homeassistant/init.homeassistant @@ -12,7 +12,7 @@ serverlog="/var/log/homeassistant/server.log" warningslog="/var/log/homeassistant/warnings.log" retry="20" -command=/var/calculate/www/${RC_SVCNAME}/${RC_SVCNAME}-live/bin/hass +command=/var/calculate/www/${RC_SVCNAME}/${RC_SVCNAME}-live/.venv/bin/hass directory=/var/calculate/www/${RC_SVCNAME}/${RC_SVCNAME}-live start_stop_daemon_args="--user $user --stdout $stdoutlog --stderr $serverlog --wait 10" diff --git a/scripts/homeassistant/step/1-install.sh b/scripts/homeassistant/step/1-install.sh index e30d44b..71adc2d 100644 --- a/scripts/homeassistant/step/1-install.sh +++ b/scripts/homeassistant/step/1-install.sh @@ -9,7 +9,8 @@ configure() { local __result=${2:-} local home_dir=/var/calculate/www/homeassistant - local last_ver="$(get_last_ver homeassistant pip)" + ha_ver="$(get_last_ver homeassistant pip)" + local last_ver=$ha_ver local work_dir="$home_dir/versions/homeassistant-$last_ver" local live_dir="$home_dir/homeassistant-live" local live_ver="$(get_live_ver $live_dir)" @@ -44,8 +45,8 @@ configure() { ebegin 'Create a virtualenv' test -e ${work_dir} && rm -rf ${work_dir} - python -m venv $work_dir - source $work_dir/bin/activate + python -m venv ${work_dir}/.venv + source ${work_dir}/.venv/bin/activate eend ebegin 'Install all Python dependencies' diff --git a/scripts/homeassistant/step/5-config.sh b/scripts/homeassistant/step/5-config.sh index f9a9abb..d05c7df 100644 --- a/scripts/homeassistant/step/5-config.sh +++ b/scripts/homeassistant/step/5-config.sh @@ -3,7 +3,8 @@ # configure() { local home_dir=/var/calculate/www/homeassistant - local live_dir="${home_dir}/homeassistant-live" + local last_ver=$ha_ver + local work_dir="$home_dir/versions/homeassistant-$last_ver" local conf_dir="/var/calculate/homeassistant" # выйдем если все настроено @@ -22,7 +23,7 @@ configure() { set -ueo pipefail export PATH="/lib/rc/bin:$PATH" - source ${live_dir}/bin/activate + source ${work_dir}/.venv/bin/activate hass --config ${conf_dir} &>>${log_dir}/config.log & id_hass=\$!