upgrades: Check free space before dist-upgrade

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy 2020-08-27 13:18:16 -04:00 committed by Sunil Mohan Adapa
parent bacfc4bcee
commit 0e9e80f435
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2

View File

@ -345,6 +345,13 @@ def _check_and_dist_upgrade(develop=False, test_upgrade=False):
'not set.')
return
output = subprocess.check_output(['df', '--output=avail,pcent', '/'])
output = output.decode().split('\n')[1].split()
free_space, free_percent = int(output[0]), int(output[1][:-1])
if free_space < 1000000 or free_percent < 10:
print('Not enough free space in /.')
return
print(f'Upgrading from {dist} to {codename}...')
if check_dist == 'testing':
with open(SOURCES_LIST, 'r') as sources_list: