1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/dendrite_ynh.git synced 2024-09-03 18:25:58 +02:00

add_systemd_config

This commit is contained in:
Gredin67 2023-07-31 13:52:24 +02:00
parent b2f70fdafa
commit 0230a72b19

View file

@ -9,30 +9,29 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
# Stop script if errors
ynh_abort_if_errors
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
get_registration_disabled() {
registration_disabled=$(ynh_app_setting_get --app $app --key registration_disabled)
echo "${registration_disabled}"
}
set__registration_disabled() {
if [ $registration_disabled ]
then
really_enable_open_registration=""
else
really_enable_open_registration="--really-enable-open-registration"
fi
ynh_write_var_in_file --file=$final_path/dendrite.yaml --key=registration_disabled --value="${registration_disabled}"
ynh_add_systemd_config
ynh_app_setting_set --app=$app --key=registration_disabled --value=$registration_disabled
}
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
ynh_app_config_apply() {
_ynh_app_config_apply
if [ "${changed[registration]}" == "true" ]
then
if [ $registration -eq 1 ]
then
registration_disabled="false"
really_enable_open_registration="--really-enable-open-registration"
else
registration_disabled="true"
really_enable_open_registration=""
fi
ynh_add_config --template="../conf/dendrite.yaml" --destination="$install_dir/dendrite.yaml"
ynh_add_systemd_config
ynh_systemd_action --service_name=$app --action="restart" --line_match="Starting external listener" --log_path="systemd"
ynh_app_setting_set --app=$app --key=registration --value=$registration
fi
}
ynh_app_config_run $1 ynh_app_config_run $1