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

Moving HA conf to HA home folder

This commit is contained in:
ewilly 2021-12-06 22:22:11 +01:00
parent 3cb3ea13b0
commit b8586fad06
5 changed files with 14 additions and 14 deletions

View file

@ -1,7 +1,7 @@
homeassistant:
auth_providers:
- type: command_line
command: __DATA_PATH__/.__APP__/bin/ynh_ldap-auth.sh
command: __DATA_PATH__/bin/ynh_ldap-auth.sh
meta: true
http:
@ -19,5 +19,5 @@ switch:
- platform: command_line
switches:
upgrade_homeassistant:
command_on: "nohup bash -c __DATA_PATH__/.__APP__/bin/upgrade_homeassistant.sh $1 > /dev/null 2>&1 &"
command_on: "nohup bash -c __DATA_PATH__/bin/upgrade_homeassistant.sh $1 > /dev/null 2>&1 &"
friendly_name: Upgrade Home Assistant

View file

@ -5,8 +5,8 @@ After=network.target
[Service]
Type=simple
User=__APP__
WorkingDirectory=__DATA_PATH__/.__APP__
ExecStart=__FINALPATH__/bin/hass --config "__DATA_PATH__/.__APP__" --log-file "__LOG_FILE__" --verbose
WorkingDirectory=__DATA_PATH__
ExecStart=__FINALPATH__/bin/hass --config "__DATA_PATH__" --log-file "__LOG_FILE__" --verbose
StandardOutput=append:__LOG_FILE__
StandardError=inherit

View file

@ -53,7 +53,7 @@ touch "$log_file"
chown -R $app: "$(dirname "$log_file")"
# create a directory for the datas of Home Assistant
myynh_create_dir "$data_path/.$app"
myynh_create_dir "$data_path"
myynh_create_dir "$data_path/.cache"
chown -R $app: "$data_path"
@ -67,10 +67,10 @@ ynh_exec_fully_quiet myynh_install_homeassistant --path="$data_path"
# set default configuration files and move all homeassistant_conf_files
ynh_script_progression --message="Configuring the installation..."
cp -r "../conf/homeassistant_conf_files/." "$data_path/.$app/"
ynh_add_config --template="../conf/homeassistant_conf_files/configuration.yaml" --destination="$data_path/.$app/configuration.yaml"
chown -R $app: "$data_path/.$app"
chmod -R +x "$data_path/.$app/bin/"
cp -r "../conf/homeassistant_conf_files/." "$data_path/"
ynh_add_config --template="../conf/homeassistant_conf_files/configuration.yaml" --destination="$data_path/configuration.yaml"
chown -R $app: "$data_path"
chmod -R +x "$data_path/bin/"
# grant sudo permissions to the user to manage his own systemd service
myynh_create_dir "/etc/sudoers.d"

View file

@ -46,7 +46,7 @@ chown -R $app: "$final_path"
ynh_script_progression --message="Restoring the data..."
ynh_restore_file --origin_path="$data_path"
chown -R $app: "$data_path"
chmod -R +x "$data_path/.$app/bin"
chmod -R +x "$data_path/bin"
# restore log
ynh_script_progression --message="Restoring the app..."

View file

@ -55,7 +55,7 @@ ynh_script_progression --message="If needed, migrating to new app architecture..
if [ ! -d "$data_path" ]; then
# move $data_path to new directory
mv "/""home""/$app" "$data_path"
ynh_replace_string --match_string="/home/homeassistant/.homeassistant" --replace_string="$data_path/.$app" --target_file="$data_path/.$app/configuration.yaml"
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
@ -78,9 +78,9 @@ ynh_exec_fully_quiet myynh_install_homeassistant --path="$data_path"
# update script in bin
ynh_script_progression --message="Updating YunoHost script used by homeassitant..."
cp -r "../conf/homeassistant_conf_files/bin/." "$data_path/.$app/bin/"
chown -R $app: "$data_path/.$app/bin"
chmod -R +x "$data_path/.$app/bin/"
cp -r "../conf/homeassistant_conf_files/bin/." "$data_path/bin/"
chown -R $app: "$data_path/bin"
chmod -R +x "$data_path/bin/"
# setup up systemd service
ynh_script_progression --message="Adding the dedicated service..."