mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
upgrades: Check for held freedombox package daily
Guard against removing a hold while the package manager is busy. Test: 1. Place hold on freedombox package. 2. Wait 3 minutes in development mode. - Package is held. 3. Touch /var/lib/freedombox/package-held. 4. Wait 3 minutes in development mode. - Package is not held. - Flag is removed. Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
3 files changed
+26
-12
No files matched your search
@@ -460,3 +460,15 @@ def apt_unhold_freedombox():
|
||||
subprocess.check_call(['apt-mark', 'unhold', 'freedombox'])
|
||||
if apt_hold_flag.exists():
|
||||
apt_hold_flag.unlink()
|
||||
|
||||
|
||||
def is_package_manager_busy():
|
||||
"""Return whether package manager is busy.
|
||||
This command uses the `lsof` command to check whether the dpkg lock file
|
||||
is open which indicates that the package manager is busy"""
|
||||
LOCK_FILE = '/var/lib/dpkg/lock'
|
||||
try:
|
||||
subprocess.check_output(['lsof', LOCK_FILE])
|
||||
return True
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
Reference in new issue
Block a user