From b634c949d0c1c7d157856c3d043c2b389fe22e61 Mon Sep 17 00:00:00 2001 From: Alexander Tratsevskiy Date: Fri, 28 Apr 2023 23:46:53 +0300 Subject: [PATCH] =?UTF-8?q?homeassistant:=20=D0=B8=D1=81=D0=BF=D1=80=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../homeassistant/homeassistant/init.homeassistant | 2 +- scripts/homeassistant/step/1-install.sh | 7 ++++--- scripts/homeassistant/step/5-config.sh | 5 +++-- 3 files changed, 8 insertions(+), 6 deletions(-) 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=\$!