mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
bullseye migration: backport a bunch of fixes from the dev branch
This commit is contained in:
parent
5d26fec9a5
commit
61175392ed
1 changed files with 39 additions and 3 deletions
|
@ -185,6 +185,31 @@ class MyMigration(Migration):
|
||||||
del services["postgresql"]
|
del services["postgresql"]
|
||||||
_save_services(services)
|
_save_services(services)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Critical fix for RPI otherwise network is down after rebooting
|
||||||
|
# https://forum.yunohost.org/t/20652
|
||||||
|
#
|
||||||
|
if os.system("systemctl | grep -q dhcpcd") == 0:
|
||||||
|
logger.info("Applying fix for DHCPCD ...")
|
||||||
|
os.system("mkdir -p /etc/systemd/system/dhcpcd.service.d")
|
||||||
|
write_to_file(
|
||||||
|
"/etc/systemd/system/dhcpcd.service.d/wait.conf",
|
||||||
|
'[Service]\nExecStart=\nExecStart=/usr/sbin/dhcpcd -w'
|
||||||
|
)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Another boring fix for the super annoying libc6-dev: Breaks libgcc-8-dev
|
||||||
|
# https://forum.yunohost.org/t/20617
|
||||||
|
#
|
||||||
|
if os.system("grep -A10 'ynh-deps' /var/lib/dpkg/status | grep -q 'Depends:.*build-essential'") == 0:
|
||||||
|
logger.info("Attempting to fix the build-essential / libc6-dev / libgcc-8-dev hell ...")
|
||||||
|
os.system("cp /var/lib/dpkg/status /root/dpkg_status.bkp")
|
||||||
|
# This removes the dependency to build-essential from $app-ynh-deps
|
||||||
|
os.system("perl -i~ -0777 -pe 's/(Package: .*-ynh-deps\\n(.+:.+\\n)+Depends:.*)(build-essential, ?)(.*)/$1$4/g' /var/lib/dpkg/status")
|
||||||
|
self.apt("build-essential", verb="remove")
|
||||||
|
os.system("LC_ALL=C DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none apt autoremove --assume-yes")
|
||||||
|
self.apt("gcc-8 libgcc-8-dev", verb="remove")
|
||||||
|
|
||||||
#
|
#
|
||||||
# Main upgrade
|
# Main upgrade
|
||||||
#
|
#
|
||||||
|
@ -277,9 +302,17 @@ class MyMigration(Migration):
|
||||||
|
|
||||||
# Clean the mess
|
# Clean the mess
|
||||||
logger.info(m18n.n("migration_0021_cleaning_up"))
|
logger.info(m18n.n("migration_0021_cleaning_up"))
|
||||||
os.system("apt autoremove --assume-yes")
|
os.system("LC_ALL=C DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none apt autoremove --assume-yes")
|
||||||
os.system("apt clean --assume-yes")
|
os.system("apt clean --assume-yes")
|
||||||
|
|
||||||
|
#
|
||||||
|
# Stupid hack for stupid dnsmasq not picking up its new init.d script then breaking everything ...
|
||||||
|
# https://forum.yunohost.org/t/20676
|
||||||
|
#
|
||||||
|
if os.path.exists("/etc/init.d/dnsmasq.dpkg-dist"):
|
||||||
|
logger.info("Copying new version for /etc/init.d/dnsmasq ...")
|
||||||
|
os.system("cp /etc/init.d/dnsmasq.dpkg-dist /etc/init.d/dnsmasq")
|
||||||
|
|
||||||
#
|
#
|
||||||
# Yunohost upgrade
|
# Yunohost upgrade
|
||||||
#
|
#
|
||||||
|
@ -337,7 +370,7 @@ class MyMigration(Migration):
|
||||||
raise YunohostError("migration_0021_not_buster")
|
raise YunohostError("migration_0021_not_buster")
|
||||||
|
|
||||||
# Have > 1 Go free space on /var/ ?
|
# Have > 1 Go free space on /var/ ?
|
||||||
if free_space_in_directory("/var/") / (1024 ** 3) < 1.0:
|
if free_space_in_directory("/var/") / (1024**3) < 1.0:
|
||||||
raise YunohostError("migration_0021_not_enough_free_space")
|
raise YunohostError("migration_0021_not_enough_free_space")
|
||||||
|
|
||||||
# Check system is up to date
|
# Check system is up to date
|
||||||
|
@ -453,6 +486,9 @@ class MyMigration(Migration):
|
||||||
os.system(f"apt-mark unhold {package}")
|
os.system(f"apt-mark unhold {package}")
|
||||||
|
|
||||||
def apt_install(self, cmd):
|
def apt_install(self, cmd):
|
||||||
|
return self.apt(cmd, verb="install")
|
||||||
|
|
||||||
|
def apt(self, cmd, verb="install"):
|
||||||
def is_relevant(line):
|
def is_relevant(line):
|
||||||
return "Reading database ..." not in line.rstrip()
|
return "Reading database ..." not in line.rstrip()
|
||||||
|
|
||||||
|
@ -466,7 +502,7 @@ class MyMigration(Migration):
|
||||||
)
|
)
|
||||||
|
|
||||||
cmd = (
|
cmd = (
|
||||||
"LC_ALL=C DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none apt install --quiet -o=Dpkg::Use-Pty=0 --fix-broken --assume-yes "
|
f"LC_ALL=C DEBIAN_FRONTEND=noninteractive APT_LISTCHANGES_FRONTEND=none apt {verb} --quiet -o=Dpkg::Use-Pty=0 --fix-broken --assume-yes "
|
||||||
+ cmd
|
+ cmd
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue