mirror of
https://github.com/YunoHost-Apps/homeassistant_ynh.git
synced 2024-09-03 19:26:16 +02:00
Merge pull request #95 from YunoHost-Apps/ci-auto-update-v2022.5.2
Upgrade to version 2022.5.2
This commit is contained in:
commit
cc825d5c0c
10 changed files with 15 additions and 96 deletions
|
@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
|
||||
Home automation platform
|
||||
|
||||
**Shipped version:** 2022.2.9~ynh2
|
||||
**Shipped version:** 2022.5.2~ynh1
|
||||
|
||||
**Demo:** https://demo.home-assistant.io
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
|||
|
||||
Plateforme domotique
|
||||
|
||||
**Version incluse :** 2022.2.9~ynh2
|
||||
**Version incluse :** 2022.5.2~ynh1
|
||||
|
||||
**Démo :** https://demo.home-assistant.io
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
upgrade=1 from_commit=4eaade48e9bdccf56a53f09a269b2e5ba7621296
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
port_already_use=1
|
||||
|
@ -18,6 +17,3 @@
|
|||
;;; Options
|
||||
Notification=all
|
||||
;;; Upgrade options
|
||||
; commit=4eaade48e9bdccf56a53f09a269b2e5ba7621296
|
||||
name= Update to 2021.6.5 on 21/06/2021
|
||||
manifest_arg=domain=DOMAIN&is_public=1&
|
||||
|
|
|
@ -61,5 +61,6 @@ pip --cache-dir "$data_path/.cache" install --upgrade $app
|
|||
|
||||
# restart homeassistant systemd service
|
||||
sudo systemctl restart $app.service
|
||||
[ ! -z "$DEBUG" ] && log "Last $app service start : $(sudo systemctl status $app.service | grep Started | tail -1)"
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Home automation platform",
|
||||
"fr": "Plateforme domotique"
|
||||
},
|
||||
"version": "2022.2.9~ynh2",
|
||||
"version": "2022.5.2~ynh1",
|
||||
"url": "https://github.com/home-assistant/home-assistant",
|
||||
"upstream": {
|
||||
"license": "Apache-2.0",
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
#=================================================
|
||||
|
||||
# Release to install
|
||||
app_version=2022.2.9
|
||||
app_version=2022.5.2
|
||||
|
||||
# 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 libturbojpeg0 libmariadb-dev libmariadb-dev-compat"
|
||||
pkg_dependencies="python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5 libturbojpeg0 libmariadb-dev libmariadb-dev-compat rustc"
|
||||
|
||||
# Requirements (Major.Minor.Patch)
|
||||
# PY_VERSION=$(curl -s "https://www.python.org/ftp/python/" | grep ">3.9" | tail -n1 | cut -d '/' -f 2 | cut -d '>' -f 2)
|
||||
|
|
|
@ -162,7 +162,7 @@ myynh_set_permissions
|
|||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
# add service in admin panel
|
||||
yunohost service add $app --description="Home Assistant server" --log="$log_file" --needs_exposed_ports=$port
|
||||
yunohost service add $app --description="Home Assistant server" --log="$log_file"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
|
@ -91,16 +91,6 @@ ynh_script_progression --message="Removing dependencies..."
|
|||
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $port..."
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
|
|
|
@ -135,7 +135,7 @@ myynh_set_permissions
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="Home Assistant server" --log="$log_file" --needs_exposed_ports=$port
|
||||
yunohost service add $app --description="Home Assistant server" --log="$log_file"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
|
@ -18,6 +18,12 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
log_file=$(ynh_app_setting_get --app=$app --key=log_file)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path_url)
|
||||
python=$(ynh_app_setting_get --app=$app --key=python)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -45,80 +51,6 @@ ynh_script_progression --message="Stopping a systemd service..."
|
|||
|
||||
ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# changes introduce in
|
||||
if [ -z $(ynh_app_setting_get --app=$app --key=final_path) ]
|
||||
then
|
||||
final_path="/var/www/$app"
|
||||
data_path="/home/yunohost.app/$app"
|
||||
log_file="/var/log/$app/$app.log"
|
||||
path_url="/"
|
||||
ynh_app_setting_set --app=$app --key=final_path --value="$final_path"
|
||||
ynh_app_setting_set --app=$app --key=data_path --value="$data_path"
|
||||
ynh_app_setting_set --app=$app --key=log_file --value="$log_file"
|
||||
ynh_app_setting_set --app=$app --key=path_url --value="$path_url"
|
||||
else
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
log_file=$(ynh_app_setting_get --app=$app --key=log_file)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path_url)
|
||||
python=$(ynh_app_setting_get --app=$app --key=python)
|
||||
fi
|
||||
|
||||
# changes introduced in 2021.11.5~ynh1
|
||||
if [ -f "/etc/systemd/system/$app@$app.service" ]
|
||||
then
|
||||
# remove old systemd service
|
||||
if ynh_exec_warn_less yunohost service status "$app@$app" >/dev/null
|
||||
then
|
||||
yunohost service remove "$app@$app"
|
||||
fi
|
||||
ynh_remove_systemd_config --service="$app@$app"
|
||||
fi
|
||||
if [ ! -d "$final_path" ]
|
||||
then
|
||||
# move $final_path to new directory
|
||||
mv "/opt/yunohost/$app" "$final_path"
|
||||
chown -R $app: "$final_path"
|
||||
fi
|
||||
if [ ! -d "$data_path" ]
|
||||
then
|
||||
# move $data_path to new directory
|
||||
mv "/""home""/$app" "$data_path"
|
||||
find "$data_path/.$app" -maxdepth 1 -mindepth 1 -exec mv {} "$data_path" \;
|
||||
rmdir "$data_path/.$app"
|
||||
ynh_replace_string --match_string="/home/homeassistant/.homeassistant" --replace_string="$data_path" --target_file="$data_path/configuration.yaml"
|
||||
chown -R $app: "$data_path"
|
||||
fi
|
||||
if [ ! -f "$log_file" ]
|
||||
then
|
||||
# create a directory with its log file
|
||||
myynh_create_dir "$(dirname "$log_file")"
|
||||
touch "$log_file"
|
||||
fi
|
||||
|
||||
# changes introduced in 2021.12.8~ynh1
|
||||
if [ -z $(ynh_app_setting_get --app=$app --key=db_name) ]
|
||||
then
|
||||
# create a MySQL database
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
if [ -z $(sed -n "/recorder:/=" "$data_path/configuration.yaml") ]
|
||||
then
|
||||
sed -i "$ a recorder:" "$data_path/configuration.yaml"
|
||||
sed -i "$ a \ db_url: mysql://$db_user:$db_pwd@127.0.0.1/$db_name?unix_socket=/var/run/mysqld/mysqld.sock&charset=utf8mb4" "$data_path/configuration.yaml"
|
||||
else
|
||||
sed -i "/recorder:/a \ db_url: mysql://$db_user:$db_pwd@127.0.0.1/$db_name?unix_socket=/var/run/mysqld/mysqld.sock&charset=utf8mb4" "$data_path/configuration.yaml"
|
||||
fi
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
|
@ -193,7 +125,7 @@ myynh_set_permissions
|
|||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="Home Assistant server" --log="$log_file" --needs_exposed_ports=$port
|
||||
yunohost service add $app --description="Home Assistant server" --log="$log_file"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
|
Loading…
Reference in a new issue