mirror of
https://github.com/YunoHost-Apps/synapse_ynh.git
synced 2024-09-03 20:26:38 +02:00
Make user creation script depend on YNH version
The format used to create a new user on YunoHost 11.1 and above is different than the one used beforehand. This change is intended to detect which version is currently installed and use the correct format.
This commit is contained in:
parent
d3694bcc55
commit
39ffead3a9
3 changed files with 21 additions and 3 deletions
|
@ -146,7 +146,13 @@ ynh_exec_warn_less ynh_install_app_dependencies $dependances
|
||||||
ynh_script_progression --message="Configuring system user..." --weight=3
|
ynh_script_progression --message="Configuring system user..." --weight=3
|
||||||
|
|
||||||
ynh_system_user_create --username=$synapse_user --home_dir=$final_path
|
ynh_system_user_create --username=$synapse_user --home_dir=$final_path
|
||||||
yunohost user create $synapse_user_app -f Synapse -l Application -F "Synapse Application" -d $domain -p "$synapse_user_app_pwd"
|
# The format to create an user account varies depending on the version of YunoHost currently installed.
|
||||||
|
ynh_current_version=$(dpkg-query --showformat='${Version}' --show yunohost)
|
||||||
|
if $(dpkg --compare-versions "$ynh_current_version" ge "11.1"); then
|
||||||
|
yunohost user create $synapse_user_app -F "Synapse Application" -d $domain -p "$synapse_user_app_pwd"
|
||||||
|
else
|
||||||
|
yunohost user create $synapse_user_app -f Synapse -l Application -d $domain -p "$synapse_user_app_pwd"
|
||||||
|
fi
|
||||||
adduser $synapse_user ssl-cert
|
adduser $synapse_user ssl-cert
|
||||||
adduser turnserver ssl-cert
|
adduser turnserver ssl-cert
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,13 @@ ynh_script_progression --message="Recreating the dedicated system user..." --wei
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$synapse_user --home_dir=$final_path
|
ynh_system_user_create --username=$synapse_user --home_dir=$final_path
|
||||||
yunohost user create $synapse_user_app -f Synapse -l Application -F "Synapse Application" -d $domain -p "$synapse_user_app_pwd"
|
# The format to create an user account varies depending on the version of YunoHost currently installed.
|
||||||
|
ynh_current_version=$(dpkg-query --showformat='${Version}' --show yunohost)
|
||||||
|
if $(dpkg --compare-versions "$ynh_current_version" ge "11.1"); then
|
||||||
|
yunohost user create $synapse_user_app -F "Synapse Application" -d $domain -p "$synapse_user_app_pwd"
|
||||||
|
else
|
||||||
|
yunohost user create $synapse_user_app -f Synapse -l Application -d $domain -p "$synapse_user_app_pwd"
|
||||||
|
fi
|
||||||
adduser $synapse_user ssl-cert
|
adduser $synapse_user ssl-cert
|
||||||
adduser turnserver ssl-cert
|
adduser turnserver ssl-cert
|
||||||
|
|
||||||
|
|
|
@ -141,7 +141,13 @@ fi
|
||||||
if [ -z $synapse_user_app_pwd ]; then
|
if [ -z $synapse_user_app_pwd ]; then
|
||||||
synapse_user_app_pwd="$(ynh_string_random --length=30)"
|
synapse_user_app_pwd="$(ynh_string_random --length=30)"
|
||||||
ynh_app_setting_set --app=$app --key=synapse_user_app_pwd --value=$synapse_user_app_pwd
|
ynh_app_setting_set --app=$app --key=synapse_user_app_pwd --value=$synapse_user_app_pwd
|
||||||
yunohost user create $synapse_user_app -f Synapse -l Application -F "Synapse Application" -d $domain -p "$synapse_user_app_pwd"
|
# The format to create an user account varies depending on the version of YunoHost currently installed.
|
||||||
|
ynh_current_version=$(dpkg-query --showformat='${Version}' --show yunohost)
|
||||||
|
if $(dpkg --compare-versions "$ynh_current_version" ge "11.1"); then
|
||||||
|
yunohost user create $synapse_user_app -F "Synapse Application" -d $domain -p "$synapse_user_app_pwd"
|
||||||
|
else
|
||||||
|
yunohost user create $synapse_user_app -f Synapse -l Application -d $domain -p "$synapse_user_app_pwd"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue