1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/synapse_ynh.git synced 2024-09-03 20:26:38 +02:00

Update upgrade

This commit is contained in:
Thatoo 2023-10-20 10:02:52 +02:00 committed by GitHub
parent d81a346f88
commit ed858d9341
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -186,19 +186,16 @@ if [ -z $e2e_enabled_by_default_in_element ] ; then
ynh_app_setting_set --app=$app --key=e2e_enabled_by_default_in_element --value=$e2e_enabled_by_default_in_element ynh_app_setting_set --app=$app --key=e2e_enabled_by_default_in_element --value=$e2e_enabled_by_default_in_element
fi fi
if [ "$e2e_enabled_by_default" = "invite" ] ; then if [ "$e2e_enabled_by_default" = "all" ] || [ "$e2e_enabled_by_default" = "invite" ] ; then
e2e_enabled_by_default_in_element="true" e2e_enabled_by_default_in_element="true"
ynh_app_setting_set --app=$app --key=e2e_enabled_by_default_in_element --value=$e2e_enabled_by_default_in_element ynh_app_setting_set --app=$app --key=e2e_enabled_by_default_in_element --value=$e2e_enabled_by_default_in_element
fi server_name=$(ynh_app_setting_get --app $app --key server_name)
sed -i -r "s|\"im\.vector\.riot\.e2ee\": \{\"default\": [A-Za-z]+ \}|\"im.vector.riot.e2ee\": {\"default\": ${e2e_enabled_by_default_in_element} }|g" "/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf"
if [ "$e2e_enabled_by_default" = "all" ] ; then elif [ "$e2e_enabled_by_default" = "off" ] ; then
e2e_enabled_by_default_in_element="true" e2e_enabled_by_default_in_element="false"
ynh_app_setting_set --app=$app --key=e2e_enabled_by_default_in_element --value=$e2e_enabled_by_default_in_element ynh_app_setting_set --app=$app --key=e2e_enabled_by_default_in_element --value=$e2e_enabled_by_default_in_element
fi server_name=$(ynh_app_setting_get --app $app --key server_name)
sed -i -r "s|\"im\.vector\.riot\.e2ee\": \{\"default\": [A-Za-z]+ \}|\"im.vector.riot.e2ee\": {\"default\": ${e2e_enabled_by_default_in_element} }|g" "/etc/nginx/conf.d/${server_name}.d/${app}_server_name.conf"
if [ "$e2e_enabled_by_default" = "off" ] ; then
e2e_enabled_by_default_in_element="false"
ynh_app_setting_set --app=$app --key=e2e_enabled_by_default_in_element --value=$e2e_enabled_by_default_in_element
fi fi
if [ -z $report_stats ]; then if [ -z $report_stats ]; then
@ -237,7 +234,7 @@ if [ -e "/var/lib/matrix-$app" ]; then
fi fi
if ! grep -q "$final_path" /etc/passwd; then if ! grep -q "$final_path" /etc/passwd; then
# matrix-synapse:x:994:994::/var/lib/matrix-synapse:/usr/sbin/nologin # matrix-synapse:x:994:994::/var/lib/matrix-synapse:/usr/sbin/nologin
sed --in-place -r "s@matrix-$app\:x\:([[:digit:]]+\:[[:digit:]]+)\:\:/.*/matrix-$app\:/usr/sbin/nologin@matrix-$app\:x\:\1\:\:$final_path\:/usr/sbin/nologin@g" /etc/passwd --in-place -r "s@matrix-$app\:x\:([[:digit:]]+\:[[:digit:]]+)\:\:/.*/matrix-$app\:/usr/sbin/nologin@matrix-$app\:x\:\1\:\:$final_path\:/usr/sbin/nologin@g" /etc/passwd
fi fi
#================================================= #=================================================
@ -394,7 +391,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=6 ynh_script_progression --message="Upgrading dependencies..." --weight=6
# WARNING : theses command are used in INSTALL, UPGRADE, RESTORE # WARNING : theses command are u in INSTALL, UPGRADE, RESTORE
# For any update do it in all files # For any update do it in all files
ynh_exec_warn_less ynh_install_app_dependencies $dependances ynh_exec_warn_less ynh_install_app_dependencies $dependances
@ -411,7 +408,7 @@ fi
#================================================= #=================================================
# CREATE SMALL CAS SERVER # CREATE SMALL CAS SERVER
#================================================= #=================================================
# WARNING : theses command are used in INSTALL, UPGRADE # WARNING : theses command are u in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files
mkdir -p $final_www_path mkdir -p $final_www_path
@ -454,7 +451,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Updating synapse config..." --weight=2 ynh_script_progression --message="Updating synapse config..." --weight=2
# WARNING : theses command are used in INSTALL, UPGRADE, CONFIG, CHANGE-URL (4 times) # WARNING : theses command are u in INSTALL, UPGRADE, CONFIG, CHANGE-URL (4 times)
# For any update do it in all files # For any update do it in all files
if [ -z $macaroon_secret_key ]; then if [ -z $macaroon_secret_key ]; then
@ -518,7 +515,7 @@ fi
# MIGRATION 4 : CREATE A DH FILE # MIGRATION 4 : CREATE A DH FILE
#================================================= #=================================================
# WARNING : theses command are used in INSTALL, UPGRADE, RESTORE # WARNING : theses command are u in INSTALL, UPGRADE, RESTORE
# For any update do it in all files # For any update do it in all files
# Make dh cert for synapse if it doesn't exist # Make dh cert for synapse if it doesn't exist
@ -559,11 +556,11 @@ ynh_add_nginx_config app
#================================================= #=================================================
ynh_script_progression --message="Updating Coturn config..." --weight=1 ynh_script_progression --message="Updating Coturn config..." --weight=1
# WARNING : theses command are used in INSTALL, UPGRADE # WARNING : theses command are u in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files
# Get public IP and set as external IP for coturn # Get public IP and set as external IP for coturn
# note : '|| true' is used to ignore the errors if we can't get the public ipv4 or ipv6 # note : '|| true' is u to ignore the errors if we can't get the public ipv4 or ipv6
public_ip4="$(curl -s ip.yunohost.org)" || true public_ip4="$(curl -s ip.yunohost.org)" || true
public_ip6="$(curl -s ipv6.yunohost.org)" || true public_ip6="$(curl -s ipv6.yunohost.org)" || true
@ -584,7 +581,7 @@ ynh_add_config --template="turnserver.conf" --destination="/etc/matrix-$app/cotu
# ADD SCRIPT FOR COTURN CRON AND APP SERVICE # ADD SCRIPT FOR COTURN CRON AND APP SERVICE
#================================================= #=================================================
# WARNING : theses command are used in INSTALL, UPGRADE # WARNING : theses command are u in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files
ynh_add_config --template="../sources/Coturn_config_rotate.sh" --destination="$final_path/Coturn_config_rotate.sh" ynh_add_config --template="../sources/Coturn_config_rotate.sh" --destination="$final_path/Coturn_config_rotate.sh"
@ -605,8 +602,8 @@ fi
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
yunohost service add matrix-$app --log "/var/log/matrix-$app/homeserver.log" --needs_exposed_ports $synapse_tls_port yunohost service add matrix-$app --log "/var/log/matrix-$app/homeserver.log" --needs_expo_ports $synapse_tls_port
yunohost service add coturn-$app --needs_exposed_ports $turnserver_tls_port yunohost service add coturn-$app --needs_expo_ports $turnserver_tls_port
#================================================= #=================================================
# UPDATE SYSTEMD # UPDATE SYSTEMD
@ -625,7 +622,7 @@ ynh_add_systemd_config --service=coturn-$app --template=coturn-synapse.service
#================================================= #=================================================
ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=8 ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=8
# WARNING : theses command are used in INSTALL, UPGRADE # WARNING : theses command are u in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files
ynh_add_fail2ban_config --use_template ynh_add_fail2ban_config --use_template
@ -675,7 +672,7 @@ fi
# SECURE FILES AND DIRECTORIES # SECURE FILES AND DIRECTORIES
#================================================= #=================================================
# WARNING : theses command are used in INSTALL, UPGRADE, RESTORE # WARNING : theses command are u in INSTALL, UPGRADE, RESTORE
# For any update do it in all files # For any update do it in all files
chown $synapse_user:root -R $final_path chown $synapse_user:root -R $final_path
chmod 770 $final_path/Coturn_config_rotate.sh chmod 770 $final_path/Coturn_config_rotate.sh
@ -692,7 +689,7 @@ setfacl -R -m user:turnserver:rwX /var/log/matrix-$app
# UPDATE HOOKS # UPDATE HOOKS
#================================================= #=================================================
# WARNING : theses command are used in INSTALL, UPGRADE # WARNING : theses command are u in INSTALL, UPGRADE
# For any update do it in all files # For any update do it in all files
ynh_replace_string __APP__ $app ../hooks/post_cert_update ynh_replace_string __APP__ $app ../hooks/post_cert_update
ynh_replace_string __DOMAIN__ $domain ../hooks/post_cert_update ynh_replace_string __DOMAIN__ $domain ../hooks/post_cert_update