Allow try_install and try_remove entries in packages module.

This commit is contained in:
Teo Mrnjavac 2016-11-02 17:00:08 +01:00 committed by Philip
parent d4bdef0be3
commit 2bc12b80cc
2 changed files with 13 additions and 2 deletions

View File

@ -18,6 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with Calamares. If not, see <http://www.gnu.org/licenses/>.
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)

View File

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