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:
parent
3cb3ea13b0
commit
b8586fad06
5 changed files with 14 additions and 14 deletions
|
@ -1,7 +1,7 @@
|
||||||
homeassistant:
|
homeassistant:
|
||||||
auth_providers:
|
auth_providers:
|
||||||
- type: command_line
|
- type: command_line
|
||||||
command: __DATA_PATH__/.__APP__/bin/ynh_ldap-auth.sh
|
command: __DATA_PATH__/bin/ynh_ldap-auth.sh
|
||||||
meta: true
|
meta: true
|
||||||
|
|
||||||
http:
|
http:
|
||||||
|
@ -19,5 +19,5 @@ switch:
|
||||||
- platform: command_line
|
- platform: command_line
|
||||||
switches:
|
switches:
|
||||||
upgrade_homeassistant:
|
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
|
friendly_name: Upgrade Home Assistant
|
||||||
|
|
|
@ -5,8 +5,8 @@ After=network.target
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
WorkingDirectory=__DATA_PATH__/.__APP__
|
WorkingDirectory=__DATA_PATH__
|
||||||
ExecStart=__FINALPATH__/bin/hass --config "__DATA_PATH__/.__APP__" --log-file "__LOG_FILE__" --verbose
|
ExecStart=__FINALPATH__/bin/hass --config "__DATA_PATH__" --log-file "__LOG_FILE__" --verbose
|
||||||
StandardOutput=append:__LOG_FILE__
|
StandardOutput=append:__LOG_FILE__
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ touch "$log_file"
|
||||||
chown -R $app: "$(dirname "$log_file")"
|
chown -R $app: "$(dirname "$log_file")"
|
||||||
|
|
||||||
# create a directory for the datas of Home Assistant
|
# 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"
|
myynh_create_dir "$data_path/.cache"
|
||||||
chown -R $app: "$data_path"
|
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
|
# set default configuration files and move all homeassistant_conf_files
|
||||||
ynh_script_progression --message="Configuring the installation..."
|
ynh_script_progression --message="Configuring the installation..."
|
||||||
cp -r "../conf/homeassistant_conf_files/." "$data_path/.$app/"
|
cp -r "../conf/homeassistant_conf_files/." "$data_path/"
|
||||||
ynh_add_config --template="../conf/homeassistant_conf_files/configuration.yaml" --destination="$data_path/.$app/configuration.yaml"
|
ynh_add_config --template="../conf/homeassistant_conf_files/configuration.yaml" --destination="$data_path/configuration.yaml"
|
||||||
chown -R $app: "$data_path/.$app"
|
chown -R $app: "$data_path"
|
||||||
chmod -R +x "$data_path/.$app/bin/"
|
chmod -R +x "$data_path/bin/"
|
||||||
|
|
||||||
# grant sudo permissions to the user to manage his own systemd service
|
# grant sudo permissions to the user to manage his own systemd service
|
||||||
myynh_create_dir "/etc/sudoers.d"
|
myynh_create_dir "/etc/sudoers.d"
|
||||||
|
|
|
@ -46,7 +46,7 @@ chown -R $app: "$final_path"
|
||||||
ynh_script_progression --message="Restoring the data..."
|
ynh_script_progression --message="Restoring the data..."
|
||||||
ynh_restore_file --origin_path="$data_path"
|
ynh_restore_file --origin_path="$data_path"
|
||||||
chown -R $app: "$data_path"
|
chown -R $app: "$data_path"
|
||||||
chmod -R +x "$data_path/.$app/bin"
|
chmod -R +x "$data_path/bin"
|
||||||
|
|
||||||
# restore log
|
# restore log
|
||||||
ynh_script_progression --message="Restoring the app..."
|
ynh_script_progression --message="Restoring the app..."
|
||||||
|
|
|
@ -55,7 +55,7 @@ ynh_script_progression --message="If needed, migrating to new app architecture..
|
||||||
if [ ! -d "$data_path" ]; then
|
if [ ! -d "$data_path" ]; then
|
||||||
# move $data_path to new directory
|
# move $data_path to new directory
|
||||||
mv "/""home""/$app" "$data_path"
|
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"
|
chown -R $app: "$data_path"
|
||||||
fi
|
fi
|
||||||
if [ ! -f "$log_file" ]; then
|
if [ ! -f "$log_file" ]; then
|
||||||
|
@ -78,9 +78,9 @@ ynh_exec_fully_quiet myynh_install_homeassistant --path="$data_path"
|
||||||
|
|
||||||
# update script in bin
|
# update script in bin
|
||||||
ynh_script_progression --message="Updating YunoHost script used by homeassitant..."
|
ynh_script_progression --message="Updating YunoHost script used by homeassitant..."
|
||||||
cp -r "../conf/homeassistant_conf_files/bin/." "$data_path/.$app/bin/"
|
cp -r "../conf/homeassistant_conf_files/bin/." "$data_path/bin/"
|
||||||
chown -R $app: "$data_path/.$app/bin"
|
chown -R $app: "$data_path/bin"
|
||||||
chmod -R +x "$data_path/.$app/bin/"
|
chmod -R +x "$data_path/bin/"
|
||||||
|
|
||||||
# setup up systemd service
|
# setup up systemd service
|
||||||
ynh_script_progression --message="Adding the dedicated service..."
|
ynh_script_progression --message="Adding the dedicated service..."
|
||||||
|
|
Loading…
Add table
Reference in a new issue