mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-05-27 10:44:33 +00:00
packages: Keep existing hold if already set
Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
parent
10c6ee13da
commit
907912d3a6
@ -58,10 +58,14 @@ def parse_arguments():
|
||||
@contextmanager
|
||||
def _apt_hold():
|
||||
"""Do not allow freedombox package to be removed during package install."""
|
||||
current_hold = subprocess.check_output(
|
||||
['apt-mark', 'showhold', 'freedombox'])
|
||||
try:
|
||||
yield subprocess.run(['apt-mark', 'hold', 'freedombox'], check=True)
|
||||
yield current_hold or subprocess.run(
|
||||
['apt-mark', 'hold', 'freedombox'], check=True)
|
||||
finally:
|
||||
subprocess.run(['apt-mark', 'unhold', 'freedombox'], check=True)
|
||||
if not current_hold:
|
||||
subprocess.run(['apt-mark', 'unhold', 'freedombox'], check=True)
|
||||
|
||||
|
||||
def _run_apt_command(arguments):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user