mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Check for obvious conflict with already running apt/dpkg commands when running yunohost upgrade
This commit is contained in:
parent
0f2465a949
commit
d0c982a422
3 changed files with 7 additions and 0 deletions
|
@ -157,6 +157,7 @@
|
||||||
"diagnosis_monitor_system_error": "Can't monitor system: {error}",
|
"diagnosis_monitor_system_error": "Can't monitor system: {error}",
|
||||||
"diagnosis_no_apps": "No installed application",
|
"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`.",
|
"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`.",
|
||||||
|
"dpkg_lock_not_available": "This command can't be ran right now because another program seems to be using the lock of dpkg (the system package manager)",
|
||||||
"dnsmasq_isnt_installed": "dnsmasq does not seem to be installed, please run 'apt-get remove bind9 && apt-get install dnsmasq'",
|
"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_cannot_remove_main": "Cannot remove main domain. Set a new main domain first",
|
||||||
"domain_cert_gen_failed": "Unable to generate certificate",
|
"domain_cert_gen_failed": "Unable to generate certificate",
|
||||||
|
|
|
@ -553,6 +553,10 @@ def tools_upgrade(operation_logger, apps=None, system=False):
|
||||||
if packages.dpkg_is_broken():
|
if packages.dpkg_is_broken():
|
||||||
raise YunohostError("dpkg_is_broken")
|
raise YunohostError("dpkg_is_broken")
|
||||||
|
|
||||||
|
# Check for obvious conflict with other dpkg/apt commands already running in parallel
|
||||||
|
if not packages.dpkg_lock_available():
|
||||||
|
raise YunohostError("dpkg_lock_not_available")
|
||||||
|
|
||||||
if system is not False and apps is not None:
|
if system is not False and apps is not None:
|
||||||
raise YunohostError("tools_upgrade_cant_both")
|
raise YunohostError("tools_upgrade_cant_both")
|
||||||
|
|
||||||
|
|
|
@ -482,6 +482,8 @@ def dpkg_is_broken():
|
||||||
return any(re.match("^[0-9]+$", f)
|
return any(re.match("^[0-9]+$", f)
|
||||||
for f in os.listdir("/var/lib/dpkg/updates/"))
|
for f in os.listdir("/var/lib/dpkg/updates/"))
|
||||||
|
|
||||||
|
def dpkg_lock_available():
|
||||||
|
return os.system("lsof /var/lib/dpkg/lock >/dev/null") != 0
|
||||||
|
|
||||||
def _list_upgradable_apt_packages():
|
def _list_upgradable_apt_packages():
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue