From b8586fad064e65f1afd420b184cb20438e6cb69f Mon Sep 17 00:00:00 2001 From: ewilly Date: Mon, 6 Dec 2021 22:22:11 +0100 Subject: [PATCH] Moving HA conf to HA home folder --- conf/homeassistant_conf_files/configuration.yaml | 4 ++-- conf/systemd.service | 4 ++-- scripts/install | 10 +++++----- scripts/restore | 2 +- scripts/upgrade | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/conf/homeassistant_conf_files/configuration.yaml b/conf/homeassistant_conf_files/configuration.yaml index 557a568..a500827 100644 --- a/conf/homeassistant_conf_files/configuration.yaml +++ b/conf/homeassistant_conf_files/configuration.yaml @@ -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 diff --git a/conf/systemd.service b/conf/systemd.service index 0b8330f..a42c0db 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -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 diff --git a/scripts/install b/scripts/install index 0a1dd59..14cf165 100644 --- a/scripts/install +++ b/scripts/install @@ -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" diff --git a/scripts/restore b/scripts/restore index 4fafe50..5bc9e6e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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..." diff --git a/scripts/upgrade b/scripts/upgrade index e253200..d603e4b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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..."