diff --git a/conf/homeassistant_conf_files/configuration.yaml b/conf/homeassistant_conf_files/configuration.yaml index 557a568..9897aee 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: __DATAPATH__/.__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 __DATA_PATH__/.__APP__/bin/upgrade_homeassistant.sh $1 > /dev/null 2>&1 &" + command_on: "nohup bash -c __DATAPATH__/.__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 704cce2..f8c0ce3 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -5,10 +5,10 @@ After=network.target [Service] Type=simple User=__APP__ -WorkingDirectory=__PATH__ -ExecStart=/opt/yunohost/__APP__/bin/hass --config "__DATA_PATH__/.__APP__" --log-file "/var/log/__APP__/__APP__.log" --verbose +WorkingDirectory=__DATAPATH__/.__APP__ +ExecStart=__FINALPATH__/bin/hass --config "__DATAPATH__/.__APP__" --log-file "__LOGFILE__" --verbose -# Sandboxing options to harden security +# Sandboxing options to harden security__DATA_PATH__ # Depending on specificities of your service/app, you may need to tweak these # .. but this should be a good baseline # Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html diff --git a/scripts/install b/scripts/install index 85253e9..bba09ef 100644 --- a/scripts/install +++ b/scripts/install @@ -73,14 +73,15 @@ ynh_exec_fully_quiet myynh_install_homeassistant --path="$data_path" 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="__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" +ynh_replace_string --match_string="__DATAPATH__" --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_replace_string --match_string="__DATAPATH__" --replace_string="$data_path" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__LOGFILE__" --replace_string="$log_file" --target_file="../conf/systemd.service" ynh_add_systemd_config --service="$app" ## add service in admin panel diff --git a/scripts/restore b/scripts/restore index 864278e..4fafe50 100644 --- a/scripts/restore +++ b/scripts/restore @@ -82,6 +82,9 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" # restore nginx ynh_script_progression --message="Restoring nginx web server..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + +sleep 10s #Only necessary for CI test otherwise curl failed to nginx page + ynh_systemd_action --service_name=nginx --action=reload sleep 10s #Only necessary for CI test otherwise curl failed to nginx page diff --git a/scripts/upgrade b/scripts/upgrade index d20a702..b567fbd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -88,7 +88,8 @@ 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_replace_string --match_string="__DATAPATH__" --replace_string="$data_path" --target_file="../conf/systemd.service" +ynh_replace_string --match_string="__LOGFILE__" --replace_string="$log_file" --target_file="../conf/systemd.service" ynh_add_systemd_config --service="$app" # add service in admin panel