Fix restore script, order of restoring steps matters

This commit is contained in:
Dante 2023-12-11 12:27:40 +00:00
parent f8c6c0baa9
commit a514980745

View file

@ -31,7 +31,7 @@ ynh_restore_file --origin_path="$install_dir"
chmod 750 "$install_dir" chmod 750 "$install_dir"
chmod -R 750 "$install_dir" chmod -R 750 "$install_dir"
chown -R $app:$app "$install_dir" chown -R "$app:$app" "$install_dir"
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
@ -40,26 +40,27 @@ chown -R $app:$app "$install_dir"
#================================================= #=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=8 ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=8
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
#=================================================
# REGISTER SYNAPSE APP-SERVICE
#=================================================
ynh_script_progression --message="Registering Synapse app-service" --weight=1
$install_dir/bin/python3 -m mautrix_telegram -g -c $install_dir/config.yaml -r "etc/matrix-$synapse_instance/app-service/$app.yaml"
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh || echo "Synapse can't restart with the appservice configuration"
#================================================= #=================================================
# RESTORE THE LOGROTATE CONFIGURATION # RESTORE THE LOGROTATE CONFIGURATION
#================================================= #=================================================
# This section has to be always above REGISTER SYNAPSE APP-SERVICE section in order to restore successfully
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app" ynh_restore_file --origin_path="/etc/logrotate.d/$app"
mkdir -p "/var/log/$app" mkdir -p "/var/log/$app"
chmod -R 600 "/var/log/$app" chmod -R 600 "/var/log/$app"
chmod 700 "/var/log/$app" chmod 700 "/var/log/$app"
chown -R $app:$app /var/log/$app chown -R "$app:$app" "/var/log/$app"
#=================================================
# REGISTER SYNAPSE APP-SERVICE
#=================================================
ynh_script_progression --message="Registering Synapse app-service" --weight=1
$install_dir/bin/python3 -m mautrix_telegram -g -c "$install_dir/config.yaml" -r "/etc/matrix-$synapse_instance/app-service/$app.yaml"
/opt/yunohost/matrix-$synapse_instance/update_synapse_for_appservice.sh || echo "Synapse can't restart with the appservice configuration"
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD