summaryrefslogtreecommitdiffstats
path: root/src/live
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-09-27 14:01:38 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-09-27 14:27:00 +0200
commit9c2ae873f2e52a596b60a277b64d8cf2130eba40 (patch)
tree55a6d2705fce19dd308e6364a9cdf600087723b3 /src/live
parent8754c21694b5dff69105a0d9b739dd87088626ee (diff)
live: disable browser operations if the binary is missing
Add shutils.which checks before every browser operations to skip the subprocess call if the binary is missing.
Diffstat (limited to 'src/live')
-rw-r--r--src/live/ogOperations.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/live/ogOperations.py b/src/live/ogOperations.py
index 76999ba..77e6514 100644
--- a/src/live/ogOperations.py
+++ b/src/live/ogOperations.py
@@ -48,6 +48,9 @@ class OgLiveOperations:
self._smb_pass = config['samba']['pass']
def _restartBrowser(self, url):
+ if not shutil.which('browser'):
+ return
+
try:
proc = subprocess.call(["pkill", "-9", "browser"])
proc = subprocess.Popen(["browser", "-qws", url])
@@ -353,7 +356,7 @@ class OgLiveOperations:
umount_cache()
if subprocess.run(cmd_ethtool).returncode != 0:
logging.error('Error running ethtool subprocess')
- if subprocess.run(cmd_browser).returncode != 0:
+ if shutil.which('browser') and subprocess.run(cmd_browser).returncode != 0:
logging.error('Error terminating ogBrowser process')
if subprocess.run(cmd_busybox) != 0:
logging.error('Error running "busybox poweroff" subprocess')