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 authored and Sunil Mohan Adapa committed 2020-10-05 15:12:37 -07:00
1 parent bacfc4bcee
commit 0e9e80f435
1 file changed
+7
+7
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: