From 9a66a00278f10a7a4f167147f78a17c6b0f82d50 Mon Sep 17 00:00:00 2001 From: Laurent Peuch Date: Mon, 8 Aug 2016 07:46:38 +0200 Subject: [PATCH] [fix] wait for admin user to be available after a slapd regen-conf, this fix install on slow hardware/vps --- data/hooks/conf_regen/06-slapd | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/data/hooks/conf_regen/06-slapd b/data/hooks/conf_regen/06-slapd index b3353962e..aef47c347 100755 --- a/data/hooks/conf_regen/06-slapd +++ b/data/hooks/conf_regen/06-slapd @@ -102,6 +102,23 @@ do_post_regen() { fi sudo service slapd force-reload + + # on slow hardware/vm this regen conf would exit before the admin user that + # is stored in ldap is available because ldap seems to slow to restart + # so we'll wait either until we are able to log as admin or until a timeout + # is reached + # we need to do this because the next hooks executed after this one during + # postinstall requires to run as admin thus breaking postinstall on slow + # hardware which mean yunohost can't be correctly installed on those hardware + # and this sucks + # wait a maximum time of 5 minutes + # yes, force-reload behave like a restart + number_of_wait=0 + while ! sudo su admin -c '' && ((number_of_wait < 60)) + do + sleep 5 + ((number_of_wait += 1)) + done } FORCE=${2:-0}