1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/homeassistant_ynh.git synced 2024-09-03 19:26:16 +02:00

Update _common.sh

This commit is contained in:
ewilly 2021-11-15 21:31:48 +01:00 committed by GitHub
parent 81d121f40b
commit b4ad39fe3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,7 @@
#
# Release to install
VERSION=2021.11.3
VERSION=2021.6.5
# Package dependencies
PKG_DEPENDENCIES="python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5"
@ -25,6 +25,18 @@ exec_as() {
fi
}
# Check if directory/file already exists (path in argument)
myynh_check_path () {
[ -z "$1" ] && ynh_die "No argument supplied"
[ ! -e "$1" ] || ynh_die "$1 already exists"
}
# Create directory only if not already exists (path in argument)
myynh_create_dir () {
[ -z "$1" ] && ynh_die "No argument supplied"
[ -d "$1" ] || mkdir -p "$1"
}
# Compare version in arguments
myynh_version_compare () {
# myynh_version_compare A B
@ -127,27 +139,17 @@ myynh_install_dependencies () {
# Install/Upgrade Homeassistant in virtual environement
myynh_install_homeassistant () {
exec_as $app -H -s /bin/bash -c " \
echo 'create the virtual environment' \
echo 'create the cache direcotry' \
&& myynh_create_dir "$1/.cache" \
&& 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 pip' \
&& pip --cache-dir $1 install --upgrade pip \
&& pip --cache-dir "$1/.cache" install --upgrade pip \
&& echo 'install last version of wheel' \
&& pip --cache-dir $1 install --upgrade wheel \
&& pip --cache-dir "$1/.cache" install --upgrade wheel \
&& echo 'install Home Assistant' \
&& pip --cache-dir $1 install --upgrade $app==$VERSION \
&& pip --cache-dir "$1/.cache" install --upgrade $app==$VERSION \
"
}
# Check if directory/file already exists (path in argument)
myynh_check_path () {
[ -z "$1" ] && ynh_die "No argument supplied"
[ ! -e "$1" ] || ynh_die "$1 already exists"
}
# Create directory only if not already exists (path in argument)
myynh_create_dir () {
[ -z "$1" ] && ynh_die "No argument supplied"
[ -d "$1" ] || mkdir -p "$1"
}