postinstall: ignore legacy scripts non-zero return code

legacy scripts are not reliable, legacy scripts continue processing on errors,
warn on errors until they are converted to native code instead.
master
OpenGnSys Support Team 2024-08-30 11:47:30 +02:00
parent 9270a6c58f
commit c09c064f28
1 changed files with 47 additions and 54 deletions

View File

@ -99,85 +99,78 @@ def configure_os_custom(disk, partition):
cmd_configure = f"{command_path} {disk} {partition}"
try:
proc = subprocess.run(shlex.split(cmd_configure),
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
encoding='utf-8',
check=True)
out = proc.stdout
except OSError as e:
raise OgError(f'Error processing configureOsCustom: {e}') from e
proc = subprocess.run(shlex.split(cmd_configure),
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
encoding='utf-8',
check=True)
if proc.returncode != 0:
logging.warning(f'{cmd_configure} returned non-zero exit status {proc.returncode}')
def windows_register_c_drive(disk, partition):
cmd_configure = f"ogWindowsRegisterPartition {disk} {partition} C {disk} {partition}"
try:
proc = subprocess.run(cmd_configure,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
encoding='utf-8',
shell=True,
check=True)
except OSError as e:
raise OgError(f'Error processing ogWindowsRegisterPartition: {e}') from e
proc = subprocess.run(cmd_configure,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
encoding='utf-8',
shell=True,
check=True)
if proc.returncode != 0:
logging.warning(f'{cmd_configure} returned non-zero exit status {proc.returncode}')
def configure_mbr_boot_sector(disk, partition):
cmd_configure = f"ogFixBootSector {disk} {partition}"
try:
proc = subprocess.run(cmd_configure,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
encoding='utf-8',
shell=True,
check=True)
except OSError as e:
raise OgError(f'Error processing ogFixBootSector: {e}') from e
proc = subprocess.run(cmd_configure,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
encoding='utf-8',
shell=True,
check=True)
if proc.returncode != 0:
logging.warning(f'{cmd_configure} returned non-zero exit status {proc.returncode}')
def configure_grub_in_mbr(disk, partition):
cmd_configure = f"ogGrubInstallMbr {disk} {partition} TRUE"
try:
proc = subprocess.run(cmd_configure,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
encoding='utf-8',
shell=True,
check=True)
except OSError as e:
raise OgError(f'Error processing ogGrubInstallMbr: {e}') from e
proc = subprocess.run(cmd_configure,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
encoding='utf-8',
shell=True,
check=True)
if proc.returncode != 0:
logging.warning(f'{cmd_configure} returned non-zero exit status {proc.returncode}')
def configure_fstab(disk, partition):
cmd_configure = f"ogConfigureFstab {disk} {partition}"
try:
proc = subprocess.run(cmd_configure,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
encoding='utf-8',
shell=True,
check=True)
except OSError as e:
raise OgError(f'Error processing ogConfigureFstab: {e}') from e
proc = subprocess.run(cmd_configure,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
encoding='utf-8',
shell=True,
check=True)
if proc.returncode != 0:
logging.warning(f'{cmd_configure} returned non-zero exit status {proc.returncode}')
def install_grub(disk, partition):
cmd_configure = f"ogGrubInstallPartition {disk} {partition}"
try:
proc = subprocess.run(cmd_configure,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
encoding='utf-8',
shell=True,
check=True)
except OSError as e:
raise OgError(f'Error processing ogGrubInstallPartition: {e}') from e
proc = subprocess.run(cmd_configure,
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
encoding='utf-8',
shell=True,
check=True)
if proc.returncode != 0:
logging.warning(f'{cmd_configure} returned non-zero exit status {proc.returncode}')
def configure_os_linux(disk, partition):