Rely on /etc/os-release to get the release number..

This commit is contained in:
Alexandre Aubin 2018-06-12 00:29:52 +02:00
parent 201edd8c38
commit 1b55eacf9c

View file

@ -85,11 +85,13 @@ class MyMigration(Migration):
self.upgrade_yunohost_packages() self.upgrade_yunohost_packages()
def debian_major_version(self): def debian_major_version(self):
# We rely on lsb_release instead of the python module "platform", # The python module "platform" and lsb_release are not reliable because
# because "platform" relies on uname, which on some weird setups does # on some setup, they still return Release=8 even after upgrading to
# not behave correctly (still says running Jessie when lsb_release says # stretch ... (Apparently this is related to OVH overriding some stuff
# Stretch...) # with /etc/lsb-release for instance -_-)
return int(check_output("lsb_release -r").split("\t")[1][0]) # Instead, we rely on /etc/os-release which should be the raw info from
# the distribution...
return int(check_output("grep VERSION_ID /etc/os-release | tr '\"' ' ' | cut -d ' ' -f2"))
def yunohost_major_version(self): def yunohost_major_version(self):
return int(get_installed_version("yunohost").split('.')[0]) return int(get_installed_version("yunohost").split('.')[0])