diff options
author | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-08-30 11:47:30 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2024-08-30 11:56:41 +0200 |
commit | c09c064f28594a1850dae595b20af9ba165692df (patch) | |
tree | cf03098f7bf328621f3f2d5f5e3d2d8512c6bb8d /src | |
parent | 9270a6c58ff7e557eb7faf97dfdc436ab8edd4e3 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/utils/postinstall.py | 101 |
1 files changed, 47 insertions, 54 deletions
diff --git a/src/utils/postinstall.py b/src/utils/postinstall.py index 6d6e60e..7e21e67 100644 --- a/src/utils/postinstall.py +++ b/src/utils/postinstall.py @@ -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): |