From 15489df68fe5ce92e3f4df2d5200a2a0755eca0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josu=C3=A9=20Tille?= Date: Tue, 12 Dec 2023 15:56:48 +0100 Subject: [PATCH] Fix install --- scripts/_common.sh | 12 +++++++++--- scripts/change_url | 1 + scripts/install | 1 + scripts/restore | 1 + scripts/upgrade | 1 + 5 files changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index a39a0cb..cb0ff2b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -74,6 +74,14 @@ install_exension() { done } +wait_xwiki_started() { + local res + while echo "$res" | grep -q 'meta http-equiv="refresh" content="1"'; do + res=($curl "http://localhost:$port/xwiki/bin/view/Main/") + sleep 10 + done +} + wait_for_flavor_install() { local flavor_job_id='org.xwiki.platform%3Axwiki-platform-distribution-flavor-mainwiki/wiki%3Axwiki' local status_raw @@ -82,9 +90,7 @@ wait_for_flavor_install() { local curl='curl --silent --show-error' # Need to call main page to start xwiki service - $curl "http://localhost:$port/xwiki/bin/view/Main/" > /dev/null & - - sleep 20 + wait_xwiki_started while true; do status_raw=$($curl --user "superadmin:$super_admin_pwd" -X GET -H 'Content-Type: text/xml' "http://localhost:$port/xwiki/rest/jobstatus/extension/action/$flavor_job_id") diff --git a/scripts/change_url b/scripts/change_url index e4bef48..82dce30 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -33,6 +33,7 @@ ynh_change_url_nginx_config ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="$systemd_match_start_line" +wait_xwiki_started #================================================= # END OF SCRIPT diff --git a/scripts/install b/scripts/install index 784a8e9..c1acf5f 100755 --- a/scripts/install +++ b/scripts/install @@ -84,6 +84,7 @@ disable_super_admin ynh_script_progression --message='Starting a systemd service...' --weight=1 ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="$systemd_match_start_line" +wait_xwiki_started #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index 96ddea0..a13ab2e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -47,6 +47,7 @@ yunohost service add $app --description=XWiki --log="/var/log/$app/$app.log" ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="$systemd_match_start_line" +wait_xwiki_started ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 46a63c8..f687240 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -88,6 +88,7 @@ disable_super_admin ynh_script_progression --message='Starting a systemd service...' --weight=1 ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="$systemd_match_start_line" +wait_xwiki_started #================================================= # END OF SCRIPT