summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Sirgo Rica <asirgo@soleta.eu>2024-08-08 13:37:28 +0200
committerAlejandro Sirgo Rica <asirgo@soleta.eu>2024-08-09 11:05:02 +0200
commit71b3211d3d64cae19daf7e940516f47bc284450c (patch)
tree72620b0f14ec2fde970180c1aa4ce39407fff31b
parentfe40f9c5d66916cad4cee8d5b2d9e172fc1c0477 (diff)
postinstall: remove shell=True
Remove the use of shell=True.
-rw-r--r--src/utils/postinstall.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/utils/postinstall.py b/src/utils/postinstall.py
index 65434af..6d6e60e 100644
--- a/src/utils/postinstall.py
+++ b/src/utils/postinstall.py
@@ -10,6 +10,7 @@ import subprocess
import shutil
import logging
import hivex
+import shlex
from src.log import OgError
from src.utils.bcd import update_bcd
from src.utils.probe import *
@@ -90,19 +91,19 @@ def set_linux_hostname(disk, partition, name):
def configure_os_custom(disk, partition):
- if not shutil.which('configureOsCustom'):
+ command_path = shutil.which('configureOsCustom')
+ if not command_path:
raise OgError('configureOsCustom not found')
logging.info(f'Found configureOsCustom script, invoking it...')
- cmd_configure = f"configureOsCustom {disk} {partition}"
+ cmd_configure = f"{command_path} {disk} {partition}"
try:
- proc = subprocess.run(cmd_configure,
+ proc = subprocess.run(shlex.split(cmd_configure),
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
encoding='utf-8',
- shell=True,
check=True)
out = proc.stdout
except OSError as e: