endeavouros-team / calamares

Distribution-independent installer framework
https://calamares.io
14 stars 10 forks source link

eos_bootloader: installing packages from ISO if installing packages from REPO crashed #27

Open Valeria-Fadeeva opened 8 months ago

Valeria-Fadeeva commented 8 months ago

if package not in repo or crash

file: src/modules/eos_bootloader/main.py

    # install packages
    if offline:
        package_files = get_local_packages(packages)
        if package_files is not None:
            try:
                libcalamares.utils.target_env_process_output(["pacman", "--noconfirm", "-U"] + package_files)
            except subprocess.CalledProcessError as cpe:
                return f"Failed to install packages for {bootloader_name}", f"The install failed with error: {cpe.stderr}"
    else:
        if packages is not None:
            try:
                libcalamares.utils.target_env_process_output(["pacman", "--noconfirm", "-S"] + packages)
            except subprocess.CalledProcessError as cpe:
                return f"Failed to install packages for {bootloader_name}", f"The install failed with error: {cpe.stderr}"

replace

    # install packages
    if offline:
        package_files = get_local_packages(packages)
        if package_files is not None:
            try:
                libcalamares.utils.target_env_process_output(["pacman", "--noconfirm", "--needed", "-U"] + package_files)
            except subprocess.CalledProcessError as cpe:
                return f"Failed to install packages for {bootloader_name}", f"The install failed with error: {cpe.stderr}"
    else:
        if packages is not None:
            try:
                libcalamares.utils.target_env_process_output(["pacman", "--noconfirm", "--needed", "-S"] + packages)
            except subprocess.CalledProcessError as cpe:
                package_files = get_local_packages(packages)
                if package_files is not None:
                    try:
                        libcalamares.utils.target_env_process_output(["pacman", "--noconfirm", "--needed", "-U"] + package_files)
                    except subprocess.CalledProcessError as cpe:
                        return f"Failed to install packages for {bootloader_name}", f"The install failed with error: {cpe.stderr}"
dalto8 commented 8 months ago

This isn't really something that could ever happen in our installer the way we use this module.

If it would help you to add support for that, I don't have a problem with adding it. I think in that case it would be be better to broadly refactor it so it has better handling for non-repo packages during an online install.

I would warn you that installing offline packages during an online install may carry some risk as the package you are installing could be out-of-date with the repos at the point of the install.

Either way, it would probably not come until after our upcoming release though.

Valeria-Fadeeva commented 8 months ago

Yes, i want =). Thank you.