diff options
Diffstat (limited to 'src/live/ogOperations.py')
-rw-r--r-- | src/live/ogOperations.py | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py index c51215c..76999ba 100644 --- a/src/live/ogOperations.py +++ b/src/live/ogOperations.py @@ -61,7 +61,8 @@ class OgLiveOperations: part_setup['filesystem'] = '' part_setup['os'] = '' part_setup['size'] = str(cxt.nsectors * cxt.sector_size // 1024) - part_setup['used_size'] = '0' + part_setup['used_size'] = 0 + part_setup['free_size'] = 0 if not cxt.label: part_setup['code'] = '0' else: @@ -84,11 +85,15 @@ class OgLiveOperations: if mount_mkdir(source, target): probe_result = os_probe(target) part_setup['os'] = probe_result - part_setup['used_size'] = get_usedperc(target) + + total, used, free = shutil.disk_usage(target) + part_setup['used_size'] = used + part_setup['free_size'] = free umount(target) else: part_setup['os'] = '' - part_setup['used_size'] = '0' + part_setup['used_size'] = 0 + part_setup['free_size'] = 0 part_setup['disk_type'] = '' @@ -111,9 +116,10 @@ class OgLiveOperations: part_setup['code'] = 'ca' def _get_cache_contents(self): - cache_contents = [] + cache_contents = {} - if not mount_cache(): + cache_mnt = mount_cache() + if not cache_mnt: return cache_contents img_dir = OG_CACHE_IMAGE_PATH @@ -121,6 +127,8 @@ class OgLiveOperations: if not os.path.isdir(img_dir): return cache_contents + image_list = [] + for file_name in os.listdir(img_dir): file_path = os.path.join(img_dir, file_name) @@ -151,10 +159,15 @@ class OgLiveOperations: continue image_size = os.stat(file_path).st_size - cache_contents.append({ + image_list.append({ 'name': file_name, 'size': image_size, 'checksum': image_checksum}) + + total, used, free = shutil.disk_usage(cache_mnt) + cache_contents['used_size'] = used + cache_contents['free_size'] = free + cache_contents['images'] = image_list return cache_contents def _get_boot_entry_data(self): |