Skip to content

Commit

Permalink
[fix] wait for admin user to be available after a slapd regen-conf, t…
Browse files Browse the repository at this point in the history
…his fix install on slow hardware/vps
  • Loading branch information
Psycojoker committed Sep 4, 2016
1 parent 21376eb commit 9a66a00
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions data/hooks/conf_regen/06-slapd
Expand Up @@ -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}
Expand Down

0 comments on commit 9a66a00

Please sign in to comment.