postinstall: remove shell=True

Remove the use of shell=True.
master
Alejandro Sirgo Rica 2024-08-08 13:37:28 +02:00
parent fe40f9c5d6
commit 71b3211d3d
1 changed files with 5 additions and 4 deletions

View File

@ -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: