Merge pull request #172 from YunoHost/fix_slapd_regenconf_on_slowhardware

Fix broken installation on slow hardware / VPS
This commit is contained in:
Alexandre Aubin 2016-12-11 23:06:22 +01:00 committed by GitHub
commit 47ac08954b

View file

@ -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}