diff --git a/debian/changelog b/debian/changelog index 208214192..95a1250c1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -16,6 +16,12 @@ yunohost (11.1.0) testing; urgency=low -- Alexandre Aubin Tue, 25 Oct 2022 17:57:29 +0200 +yunohost (11.0.10.2) stable; urgency=low + + - Add another trick to autorestart yunohost-api at the end of the upgrade when ran from the api itself... (6f640c08) + + -- Alexandre Aubin Thu, 27 Oct 2022 15:46:26 +0200 + yunohost (11.0.10.1) stable; urgency=low - self-upgrade: fix yunohost-api restart which was not triggered @_@ (472e9250) diff --git a/debian/control b/debian/control index 0760e2cde..facedbff2 100644 --- a/debian/control +++ b/debian/control @@ -27,7 +27,7 @@ Depends: ${python3:Depends}, ${misc:Depends} , rspamd, opendkim-tools, postsrsd, procmail, mailutils , redis-server , acl - , git, curl, wget, cron, unzip, jq, bc, at + , git, curl, wget, cron, unzip, jq, bc, at, procps , lsb-release, haveged, fake-hwclock, equivs, lsof, whois Recommends: yunohost-admin , ntp, inetutils-ping | iputils-ping diff --git a/debian/postinst b/debian/postinst index e93845e88..9fb9b9977 100644 --- a/debian/postinst +++ b/debian/postinst @@ -38,6 +38,24 @@ do_configure() { systemctl restart yunohost-api else echo "(Delaying the restart of yunohost-api, this should automatically happen after the end of this upgrade)" + cat << EOF | at -M now >/dev/null 2>&1 +# Wait for apt / dpkg / yunohost to not be up anymore, hence the upgrade finished + +while pgrep -x apt || pgrep -x apt-get || pgrep dpkg || test -e /var/run/moulinette_yunohost.lock; +do + sleep 3 +done + +# Restart yunohost-api, though only if it wasnt already restarted by something else in the last 60 secs + +API_START_TIMESTAMP="\$(date --date="\$(systemctl show yunohost-api | grep ExecMainStartTimestamp= | awk -F= '{print \$2}')" +%s)" + +if [ "\$(( \$(date +%s) - \$API_START_TIMESTAMP ))" -ge 60 ]; +then + echo "restart" >> /var/log/testalex + systemctl restart yunohost-api +fi +EOF fi fi }