1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/homeassistant_ynh.git synced 2024-09-03 19:26:16 +02:00
This commit is contained in:
ewilly 2021-11-27 21:51:34 +01:00
parent 4eaae0532f
commit 04f69bc521
5 changed files with 13 additions and 8 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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