mirror of
https://github.com/YunoHost-Apps/homeassistant_ynh.git
synced 2024-09-03 19:26:16 +02:00
Remove pip cache dir
This commit is contained in:
parent
b8586fad06
commit
77c1e690c9
4 changed files with 9 additions and 18 deletions
|
@ -49,16 +49,13 @@ $MY_PYTHON -m venv "$final_path"
|
||||||
# activate the virtual environment
|
# activate the virtual environment
|
||||||
source "$final_path/bin/activate"
|
source "$final_path/bin/activate"
|
||||||
|
|
||||||
# install last version of pip
|
|
||||||
pip install --upgrade pip
|
|
||||||
|
|
||||||
# install last version of wheel
|
# install last version of wheel
|
||||||
pip install --upgrade wheel
|
pip --no-cache-dir install --upgrade wheel
|
||||||
|
|
||||||
# upgrade homeassistant python package
|
# upgrade homeassistant python package
|
||||||
pip install --upgrade $app
|
pip --no-cache-dir install --upgrade $app
|
||||||
|
|
||||||
# restart homeassistant systemd service
|
# restart homeassistant systemd service
|
||||||
sudo systemctl restart $app@$app.service
|
sudo systemctl restart $app.service
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
|
@ -124,23 +124,15 @@ myynh_install_dependencies () {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Install/Upgrade Homeassistant in virtual environement
|
# Install/Upgrade Homeassistant in virtual environement
|
||||||
# | arg: -p, --path= - the parent path of cache directory
|
|
||||||
myynh_install_homeassistant () {
|
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 " \
|
ynh_exec_as $app -H -s /bin/bash -c " \
|
||||||
echo 'create the virtual environment' \
|
echo 'create the virtual environment' \
|
||||||
&& $MY_PYTHON -m venv "$final_path" \
|
&& $MY_PYTHON -m venv "$final_path" \
|
||||||
&& echo 'activate the virtual environment' \
|
&& echo 'activate the virtual environment' \
|
||||||
&& source "$final_path/bin/activate" \
|
&& source "$final_path/bin/activate" \
|
||||||
&& echo 'install last version of wheel' \
|
&& 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' \
|
&& echo 'install Home Assistant' \
|
||||||
&& pip --cache-dir "$path/.cache" install --upgrade $app==$VERSION \
|
&& pip --no-cache-dir install --upgrade $app==$VERSION \
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ myynh_install_dependencies --python="$PY_REQUIRED_VERSION"
|
||||||
|
|
||||||
# installation in a virtual environment
|
# installation in a virtual environment
|
||||||
ynh_script_progression --message="Installing Home Assistant 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
|
# set default configuration files and move all homeassistant_conf_files
|
||||||
ynh_script_progression --message="Configuring the installation..."
|
ynh_script_progression --message="Configuring the installation..."
|
||||||
|
|
|
@ -53,6 +53,8 @@ ynh_systemd_action --service_name="$app" --action=stop --line_match="Stopped Hom
|
||||||
# migrate to new app architecture
|
# migrate to new app architecture
|
||||||
ynh_script_progression --message="If needed, migrating to new app architecture..."
|
ynh_script_progression --message="If needed, migrating to new app architecture..."
|
||||||
if [ ! -d "$data_path" ]; then
|
if [ ! -d "$data_path" ]; then
|
||||||
|
# remove pip cache
|
||||||
|
ynh_secure_remove --file="/home/homeassistant/.cache"
|
||||||
# move $data_path to new directory
|
# move $data_path to new directory
|
||||||
mv "/""home""/$app" "$data_path"
|
mv "/""home""/$app" "$data_path"
|
||||||
ynh_replace_string --match_string="/home/homeassistant/.homeassistant" --replace_string="$data_path" --target_file="$data_path/configuration.yaml"
|
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
|
# installation in a virtual environment
|
||||||
ynh_script_progression --message="Installing Home Assistant 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
|
# update script in bin
|
||||||
ynh_script_progression --message="Updating YunoHost script used by homeassitant..."
|
ynh_script_progression --message="Updating YunoHost script used by homeassitant..."
|
||||||
|
|
Loading…
Add table
Reference in a new issue