From b928dd12227e18f4106b74ee36559db73e23d184 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Wed, 27 Apr 2022 16:25:14 +0200 Subject: [PATCH] migrate_to_bullseye: /etc/apt/sources.list may not exist --- src/yunohost/data_migrations/0021_migrate_to_bullseye.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/yunohost/data_migrations/0021_migrate_to_bullseye.py b/src/yunohost/data_migrations/0021_migrate_to_bullseye.py index 77797c63fb..e8ed6bc4d3 100644 --- a/src/yunohost/data_migrations/0021_migrate_to_bullseye.py +++ b/src/yunohost/data_migrations/0021_migrate_to_bullseye.py @@ -299,7 +299,7 @@ def check_assertions(self): # Check system is up to date # (but we don't if 'bullseye' is already in the sources.list ... # which means maybe a previous upgrade crashed and we're re-running it) - if " bullseye " not in read_file("/etc/apt/sources.list"): + if os.path.exists("/etc/apt/sources.list") and " bullseye " not in read_file("/etc/apt/sources.list"): tools_update(target="system") upgradable_system_packages = list(_list_upgradable_apt_packages()) if upgradable_system_packages: @@ -355,7 +355,8 @@ def disclaimer(self): def patch_apt_sources_list(self): sources_list = glob.glob("/etc/apt/sources.list.d/*.list") - sources_list.append("/etc/apt/sources.list") + if os.path.exists("/etc/apt/sources.list"): + sources_list.append("/etc/apt/sources.list") # This : # - replace single 'buster' occurence by 'bulleye'