diff --git a/src/modules/packages/main.py b/src/modules/packages/main.py index 1f9253ae8..f0f7b38a3 100644 --- a/src/modules/packages/main.py +++ b/src/modules/packages/main.py @@ -18,6 +18,7 @@ # You should have received a copy of the GNU General Public License # along with Calamares. If not, see . +import subprocess import libcalamares from libcalamares.utils import check_target_env_call, target_env_call @@ -117,8 +118,18 @@ def run_operations(pkgman, entry): for key in entry.keys(): if key == "install": pkgman.install(entry[key]) + elif key == "try_install": + try: + pkgman.install(entry[key]) + except subprocess.CalledProcessError: + libcalamares.utils.debug("WARNING: could not install packages {}".format(", ".join(entry[key]))) elif key == "remove": pkgman.remove(entry[key]) + elif key == "try_remove": + try: + pkgman.remove(entry[key]) + except subprocess.CalledProcessError: + libcalamares.utils.debug("WARNING: could not remove packages {}".format(", ".join(entry[key]))) elif key == "localInstall": pkgman.install(entry[key], from_local=True) diff --git a/src/modules/packages/packages.conf b/src/modules/packages/packages.conf index 8dd06d52f..4039278b3 100644 --- a/src/modules/packages/packages.conf +++ b/src/modules/packages/packages.conf @@ -36,9 +36,9 @@ update_db: true # - remove: # - pkg3 # - pkg4 -# - install: +# - try_install: # no system install failure if a package cannot be installed # - pkg5 -# - remove: +# - try_remove: # no system install failure if a package cannot be removed # - pkg2 # - pkg1 # - install: