From 19bd4da10400497bfa8de70d22d4c105ad4e6b5a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 18 Feb 2019 15:58:24 +0100 Subject: [PATCH] Assert that dpkg is not broken when trying to install an app --- locales/en.json | 1 + src/yunohost/app.py | 3 +++ 2 files changed, 4 insertions(+) diff --git a/locales/en.json b/locales/en.json index 8528c2576..477563c8b 100644 --- a/locales/en.json +++ b/locales/en.json @@ -146,6 +146,7 @@ "diagnosis_monitor_network_error": "Can't monitor network: {error}", "diagnosis_monitor_system_error": "Can't monitor system: {error}", "diagnosis_no_apps": "No installed application", + "dpkg_is_broken": "You cannot do this right now because dpkg/apt (the system package managers) seems to be in a broken state... You can try to solve this issue by connecting through SSH and running `sudo dpkg --configure -a`.", "dnsmasq_isnt_installed": "dnsmasq does not seem to be installed, please run 'apt-get remove bind9 && apt-get install dnsmasq'", "domain_cannot_remove_main": "Cannot remove main domain. Set a new main domain first", "domain_cert_gen_failed": "Unable to generate certificate", diff --git a/src/yunohost/app.py b/src/yunohost/app.py index 0bca68787..d332971c4 100644 --- a/src/yunohost/app.py +++ b/src/yunohost/app.py @@ -722,6 +722,9 @@ def app_install(operation_logger, auth, app, label=None, args=None, no_remove_on }, } + if packages.dpkg_is_broken(): + raise YunohostError(m18n.n("dpkg_is_broken")) + def confirm_install(confirm): # Ignore if there's nothing for confirm (good quality app), if --force is used