migrate_to_bullseye: Try to tell the system to not yolorestart nginx in the middle of the big upgrade because of nginx-common...

This commit is contained in:
Alexandre Aubin 2022-01-17 14:12:53 +01:00
parent 71f456286a
commit 938d08134e

View file

@ -5,7 +5,7 @@ from moulinette import m18n
from yunohost.utils.error import YunohostError
from moulinette.utils.log import getActionLogger
from moulinette.utils.process import check_output, call_async_output
from moulinette.utils.filesystem import read_file, rm
from moulinette.utils.filesystem import read_file, rm, write_to_file
from yunohost.tools import (
Migration,
@ -81,6 +81,16 @@ class MyMigration(Migration):
"echo 'libc6 libraries/restart-without-asking boolean true' | debconf-set-selections"
)
# Do not restart nginx during the upgrade of nginx-common ...
# c.f. https://manpages.debian.org/bullseye/init-system-helpers/deb-systemd-invoke.1p.en.html
# and the code inside /usr/bin/deb-systemd-invoke to see how it calls /usr/sbin/policy-rc.d ...
write_to_file(
'/usr/sbin/policy-rc.d',
'#!/bin/bash\n[[ "$1" == "nginx" ]] && return 101 || return 0'
)
os.system("chmod +x /usr/sbin/policy-rc.d")
# FIXME: we still need to explicitly restart nginx somewhere ...
# Don't send an email to root about the postgresql migration. It should be handled automatically after.
os.system(
"echo 'postgresql-common postgresql-common/obsolete-major seen true' | debconf-set-selections"