diff --git a/conf/homeassistant_conf_files/configuration.yaml b/conf/homeassistant_conf_files/configuration.yaml index 1815781..557a568 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: __PATH__/bin/ynh_ldap-auth.sh + command: __DATA_PATH__/.__APP__/bin/ynh_ldap-auth.sh meta: true http: @@ -19,5 +19,5 @@ switch: - platform: command_line switches: upgrade_homeassistant: - command_on: "nohup bash -c __PATH__/bin/upgrade_homeassistant.sh $1 > /dev/null 2>&1 &" + command_on: "nohup bash -c __DATA_PATH__/.__APP__/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 9cfd630..704cce2 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,7 +6,7 @@ After=network.target Type=simple User=__APP__ WorkingDirectory=__PATH__ -ExecStart=/opt/yunohost/__APP__/bin/hass --config "__PATH__" --log-file "/var/log/__APP__/__APP__.log" --verbose +ExecStart=/opt/yunohost/__APP__/bin/hass --config "__DATA_PATH__/.__APP__" --log-file "/var/log/__APP__/__APP__.log" --verbose # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these diff --git a/scripts/install b/scripts/install index 2e0e509..6b258b1 100644 --- a/scripts/install +++ b/scripts/install @@ -68,13 +68,15 @@ 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..." ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/homeassistant_conf_files/configuration.yaml" -ynh_replace_string --match_string="__PATH__" --replace_string="$data_path/.$app" --target_file="../conf/homeassistant_conf_files/configuration.yaml" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/homeassistant_conf_files/configuration.yaml" +ynh_replace_string --match_string="__DATA_PATH__" --replace_string="$data_path" --target_file="../conf/homeassistant_conf_files/configuration.yaml" cp -r "../conf/homeassistant_conf_files/." "$data_path/.$app/" chown -R $app: "$data_path/.$app" chmod -R +x "$data_path/.$app/bin/" # setup up systemd service ynh_script_progression --message="Adding the dedicated service..." +ynh_replace_string --match_string="__DATA_PATH__" --replace_string="$data_path" --target_file="../conf/systemd.service" ynh_add_systemd_config --service="$app" ## add service in admin panel diff --git a/scripts/upgrade b/scripts/upgrade index d0b6921..916c10d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -76,6 +76,7 @@ chmod -R +x "$data_path/.$app/bin/" # setup up systemd service ynh_script_progression --message="Adding the dedicated service..." +ynh_replace_string --match_string="__DATA_PATH__" --replace_string="$data_path" --target_file="../conf/systemd.service" ynh_add_systemd_config --service="$app" # add service in admin panel