diff --git a/conf/homeassistant_conf_files/bin/upgrade_homeassistant.sh b/conf/homeassistant_conf_files/bin/upgrade_homeassistant.sh index 5bd35f1..de7670b 100755 --- a/conf/homeassistant_conf_files/bin/upgrade_homeassistant.sh +++ b/conf/homeassistant_conf_files/bin/upgrade_homeassistant.sh @@ -49,16 +49,13 @@ $MY_PYTHON -m venv "$final_path" # activate the virtual environment source "$final_path/bin/activate" -# install last version of pip -pip install --upgrade pip - # install last version of wheel -pip install --upgrade wheel +pip --no-cache-dir install --upgrade wheel # upgrade homeassistant python package -pip install --upgrade $app +pip --no-cache-dir install --upgrade $app # restart homeassistant systemd service -sudo systemctl restart $app@$app.service +sudo systemctl restart $app.service exit 0 diff --git a/scripts/_common.sh b/scripts/_common.sh index db4736f..15edd5a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -124,23 +124,15 @@ myynh_install_dependencies () { } # Install/Upgrade Homeassistant in virtual environement -# | arg: -p, --path= - the parent path of cache directory myynh_install_homeassistant () { - # Declare an array to define the options of this helper. - local legacy_args=u - local -A args_array=( [p]=path= ) - local path - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - ynh_exec_as $app -H -s /bin/bash -c " \ echo 'create the virtual environment' \ && $MY_PYTHON -m venv "$final_path" \ && echo 'activate the virtual environment' \ && source "$final_path/bin/activate" \ && echo 'install last version of wheel' \ - && pip --cache-dir "$path/.cache" install --upgrade wheel \ + && pip --no-cache-dir install --upgrade wheel \ && echo 'install Home Assistant' \ - && pip --cache-dir "$path/.cache" install --upgrade $app==$VERSION \ + && pip --no-cache-dir install --upgrade $app==$VERSION \ " } diff --git a/scripts/install b/scripts/install index 14cf165..a34a207 100644 --- a/scripts/install +++ b/scripts/install @@ -63,7 +63,7 @@ myynh_install_dependencies --python="$PY_REQUIRED_VERSION" # installation in a virtual environment ynh_script_progression --message="Installing Home Assistant in a virtual environment..." -ynh_exec_fully_quiet myynh_install_homeassistant --path="$data_path" +ynh_exec_fully_quiet myynh_install_homeassistant # set default configuration files and move all homeassistant_conf_files ynh_script_progression --message="Configuring the installation..." diff --git a/scripts/upgrade b/scripts/upgrade index d603e4b..3d8f5b2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -53,6 +53,8 @@ ynh_systemd_action --service_name="$app" --action=stop --line_match="Stopped Hom # migrate to new app architecture ynh_script_progression --message="If needed, migrating to new app architecture..." if [ ! -d "$data_path" ]; then + # remove pip cache + ynh_secure_remove --file="/home/homeassistant/.cache" # move $data_path to new directory mv "/""home""/$app" "$data_path" ynh_replace_string --match_string="/home/homeassistant/.homeassistant" --replace_string="$data_path" --target_file="$data_path/configuration.yaml" @@ -74,7 +76,7 @@ fi # installation in a virtual environment ynh_script_progression --message="Installing Home Assistant in a virtual environment..." -ynh_exec_fully_quiet myynh_install_homeassistant --path="$data_path" +ynh_exec_fully_quiet myynh_install_homeassistant # update script in bin ynh_script_progression --message="Updating YunoHost script used by homeassitant..."