upgrades: Perform easier checks first during dist upgrade

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2025-03-06 13:04:40 -08:00 committed by James Valleroy
parent 0022dc5889
commit 8c93ea20a4
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808

View File

@ -93,6 +93,12 @@ def check(test_upgrade=False):
Return (boolean, string) indicating if the upgrade is ready, and a reason
if not.
"""
if not utils.check_auto():
raise RuntimeError('upgrades-not-enabled')
if not utils.is_sufficient_free_space():
raise RuntimeError('not-enough-free-space')
if action_utils.service_is_running('freedombox-dist-upgrade'):
raise RuntimeError('found-previous')
@ -108,12 +114,6 @@ def check(test_upgrade=False):
if codename == dist:
raise RuntimeError(f'already-{dist}')
if not utils.check_auto():
raise RuntimeError('upgrades-not-enabled')
if not utils.is_sufficient_free_space():
raise RuntimeError('not-enough-free-space')
_sources_list_update(dist, codename)