mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-09-19 04:59:01 +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
|
@contextmanager
|
||||||
def _apt_hold():
|
def _apt_hold():
|
||||||
"""Do not allow freedombox package to be removed during package install."""
|
"""Do not allow freedombox package to be removed during package install."""
|
||||||
|
current_hold = subprocess.check_output(
|
||||||
|
['apt-mark', 'showhold', 'freedombox'])
|
||||||
try:
|
try:
|
||||||
yield subprocess.run(['apt-mark', 'hold', 'freedombox'], check=True)
|
yield current_hold or subprocess.run(
|
||||||
|
['apt-mark', 'hold', 'freedombox'], check=True)
|
||||||
finally:
|
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):
|
def _run_apt_command(arguments):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user