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-28 15:09:32 +01:00
parent 5bfd645872
commit f066806a46
2 changed files with 10 additions and 8 deletions

View file

@ -39,10 +39,6 @@ ynh_app_setting_set --app="$app" --key=data_path --value="$data_path"
ynh_app_setting_set --app="$app" --key=log_file --value="$log_file"
ynh_app_setting_set --app="$app" --key=path_url --value="$path_url"
# grant sudo permissions to the user to manage his own systemd service
myynh_create_dir "/etc/sudoers.d"
ynh_add_config --template="../conf/sudoers" --destination="/etc/sudoers.d/$app"
# create a dedicated system user
ynh_script_progression --message="Creating dedicated user, rights and folders..."
ynh_system_user_create --username="$app"
@ -78,6 +74,11 @@ cp -r "../conf/homeassistant_conf_files/." "$data_path/.$app/"
chown -R $app: "$data_path/.$app"
chmod -R +x "$data_path/.$app/bin/"
# grant sudo permissions to the user to manage his own systemd service
myynh_create_dir "/etc/sudoers.d"
ynh_add_config --template="../conf/sudoers" --destination="/etc/sudoers.d/$app"
chown -R root: "/etc/sudoers.d/$app"
# setup up systemd service
ynh_script_progression --message="Adding the dedicated service..."
ynh_replace_string --match_string="__DATAPATH__" --replace_string="$data_path" --target_file="../conf/systemd.service"

View file

@ -42,10 +42,6 @@ if [ -f "/etc/yunohost/apps/$app/scripts/backup" ] ; then
}
fi
# grant sudo permissions to the user to manage his own systemd service
ynh_script_progression --message="Creating dedicated user, rights and folders..."
ynh_add_config --template="../conf/sudoers" --destination="/etc/sudoers.d/$app"
# build (if needed) & install Pyhton
ynh_script_progression --message="Installing dependencies..."
myynh_install_dependencies --python="$PY_REQUIRED_VERSION"
@ -92,6 +88,11 @@ ynh_replace_string --match_string="__DATAPATH__" --replace_string="$data_path" -
ynh_replace_string --match_string="__LOGFILE__" --replace_string="$log_file" --target_file="../conf/systemd.service"
ynh_add_systemd_config
# grant sudo permissions to the user to manage his own systemd service
ynh_script_progression --message="Creating dedicated user, rights and folders..."
ynh_add_config --template="../conf/sudoers" --destination="/etc/sudoers.d/$app"
chown -R root: "/etc/sudoers.d/$app"
# add service in admin panel
yunohost service add "$app" --log "$log_file" --description "Home Assistant server" --needs_exposed_ports $port