From 0e9e80f435bf3dd93ff76ca62588a42867e1cc37 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Thu, 27 Aug 2020 13:18:16 -0400 Subject: [PATCH] upgrades: Check free space before dist-upgrade Signed-off-by: James Valleroy Reviewed-by: Sunil Mohan Adapa --- actions/upgrades | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/actions/upgrades b/actions/upgrades index 66c72463e..36c6cb945 100755 --- a/actions/upgrades +++ b/actions/upgrades @@ -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: