mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Add small helper to check if dpkg is in a broken state
This commit is contained in:
parent
d5ea18d042
commit
1d8d3c2828
1 changed files with 9 additions and 0 deletions
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
|
import os
|
||||||
import logging
|
import logging
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
@ -470,3 +471,11 @@ def ynh_packages_version(*args, **kwargs):
|
||||||
'yunohost', 'yunohost-admin', 'moulinette', 'ssowat',
|
'yunohost', 'yunohost-admin', 'moulinette', 'ssowat',
|
||||||
with_repo=True
|
with_repo=True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def dpkg_is_broken():
|
||||||
|
# If dpkg is broken, /var/lib/dpkg/updates
|
||||||
|
# will contains files like 0001, 0002, ...
|
||||||
|
# ref: https://sources.debian.org/src/apt/1.4.9/apt-pkg/deb/debsystem.cc/#L141-L174
|
||||||
|
return any(re.match("^[0-9]+$", f)
|
||||||
|
for f in os.listdir("/var/lib/dpkg/updates/"))
|
||||||
|
|
Loading…
Add table
Reference in a new issue