summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/live/ogOperations.py4
-rw-r--r--src/utils/cache.py4
-rw-r--r--src/utils/probe.py11
3 files changed, 11 insertions, 8 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py
index b7208f6..8c8b67a 100644
--- a/src/live/ogOperations.py
+++ b/src/live/ogOperations.py
@@ -27,7 +27,7 @@ from src.utils.legacy import *
from src.utils.net import ethtool
from src.utils.menu import generate_menu
from src.utils.fs import *
-from src.utils.probe import os_probe, cache_probe
+from src.utils.probe import os_probe, get_cache_dev_path
from src.utils.disk import *
from src.utils.cache import generate_cache_txt, umount_cache, init_cache
from src.utils.tiptorrent import *
@@ -542,7 +542,7 @@ class OgLiveOperations:
def refresh(self, ogRest):
self._restartBrowser(self._url_log)
- cache = cache_probe()
+ cache = get_cache_dev_path()
disks = get_disks()
interface = os.getenv('DEVICE')
link = ethtool(interface)
diff --git a/src/utils/cache.py b/src/utils/cache.py
index afdc75a..b60b5be 100644
--- a/src/utils/cache.py
+++ b/src/utils/cache.py
@@ -11,7 +11,7 @@ import os
from src.utils.fs import mount_mkdir, umount
from src.utils.net import getifaddr
-from src.utils.probe import cache_probe
+from src.utils.probe import get_cache_dev_path
OGIMG='/opt/opengnsys/images/'
OGCACHE_MOUNTPOINT='/opt/opengnsys/cache'
@@ -23,7 +23,7 @@ def mount_cache():
Returns the mountpoint or an empty string.
"""
- cache_dev = cache_probe()
+ cache_dev = get_cache_dev_path()
if cache_dev:
# cache_target = cache_dev.replace('dev', 'mnt')
diff --git a/src/utils/probe.py b/src/utils/probe.py
index 8c0e39a..b2ed5de 100644
--- a/src/utils/probe.py
+++ b/src/utils/probe.py
@@ -135,14 +135,17 @@ def get_linux_distro_id(mountpoint):
logging.error(f'os-release file not found at "{osrelease}"')
return 'linux'
-def cache_probe():
+def get_cache_dev_path():
"""
- Runs 'blkid -L CACHE' and returns stripped stdout
+ Runs 'blkid -L CACHE' and returns stripped path to device, eg. /dev/sda3
"""
proc_blkid = subprocess.run(['blkid', '-L', 'CACHE'],
stdout=subprocess.PIPE)
- stdout = proc_blkid.stdout.decode().strip()
- return stdout
+ if proc_blkid.returncode != 0:
+ logging.error('Cannot find device path to cache')
+ return ''
+
+ return proc_blkid.stdout.decode().strip()
def get_os_family(mountpoint):