summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/live/ogOperations.py17
-rw-r--r--src/utils/probe.py9
2 files changed, 23 insertions, 3 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py
index c3ede91..a3c3836 100644
--- a/src/live/ogOperations.py
+++ b/src/live/ogOperations.py
@@ -18,7 +18,7 @@ from src.live.partcodes import GUID_MAP
from src.utils.net import ethtool
from src.utils.menu import generate_menu
from src.utils.fs import mount_mkdir, umount, get_usedperc
-from src.utils.probe import os_probe
+from src.utils.probe import os_probe, cache_probe
from src.utils.disk import get_disks
@@ -49,10 +49,12 @@ class OgLiveOperations:
def _refresh_payload_partition(self, cxt, pa, part_setup, disk):
parttype = cxt.partition_to_string(pa, fdisk.FDISK_FIELD_TYPEID)
fstype = cxt.partition_to_string(pa, fdisk.FDISK_FIELD_FSTYPE)
+ padev = cxt.partition_to_string(pa, fdisk.FDISK_FIELD_DEVICE)
size = cxt.partition_to_string(pa, fdisk.FDISK_FIELD_SIZE)
partnum = pa.partno + 1
- source = f'/dev/{disk}{partnum}'
- target = f'/mnt/{disk}{partnum}/'
+ source = padev
+ target = padev.replace('dev', 'mnt')
+
if cxt.label.name == 'gpt':
code = GUID_MAP.get(parttype, 0x0)
else:
@@ -75,6 +77,13 @@ class OgLiveOperations:
part_setup['code'] = hex(code)[2:]
part_setup['size'] = str(int(size) // 1024)
+ def _refresh_part_setup_cache(self, cxt, pa, part_setup, cache):
+ padev = cxt.partition_to_string(pa, fdisk.FDISK_FIELD_DEVICE)
+ if padev == cache:
+ part_setup['filesystem'] = 'CACHE'
+ part_setup['code'] = 'ca'
+
+
def parseGetConf(self, out):
parsed = {'serial_number': '',
'disk_setup': list(),
@@ -314,6 +323,7 @@ class OgLiveOperations:
def refresh(self, ogRest):
self._restartBrowser(self._url_log)
+ cache = cache_probe()
disks = get_disks()
parsed = { 'serial_number': '',
'disk_setup': [],
@@ -334,6 +344,7 @@ class OgLiveOperations:
for pa in cxt.partitions:
part_setup = part_setup.copy()
self._refresh_payload_partition(cxt, pa, part_setup, disk)
+ self._refresh_part_setup_cache(cxt, pa, part_setup, cache)
parsed['partition_setup'].append(part_setup)
generate_menu(parsed['partition_setup'])
diff --git a/src/utils/probe.py b/src/utils/probe.py
index d14146c..f1bdc27 100644
--- a/src/utils/probe.py
+++ b/src/utils/probe.py
@@ -62,6 +62,15 @@ def getwindowsversion(winreghives):
return 'Microsoft Windows'
+def cache_probe():
+ """
+ Runs 'blkid -L CACHE' and returns stripped stdout
+ """
+ proc_blkid = subprocess.run(['blkid', '-L', 'CACHE'],
+ stdout=subprocess.PIPE)
+ stdout = proc_blkid.stdout.decode().strip()
+ return stdout
+
def os_probe(mountpoint):
"""
Probes mountpoint for typical OS dependant files.