forked from Mirror/pmbootstrap
helpers: apk: sanity check final command (MR 2463)
When running "apk add" we must always have --cache-dir set! We also expect --no-interactive to be set. Add some asserts so we don't regress here. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
7847488058
commit
41c8413fda
1 changed files with 12 additions and 0 deletions
|
@ -205,6 +205,18 @@ def run(command: Sequence[PathString], chroot: Chroot, with_progress: bool = Tru
|
|||
"""
|
||||
_command = _prepare_cmd(command, chroot)
|
||||
|
||||
# Sanity checks. We should avoid accidentally writing to
|
||||
# /var/cache/apk on the host!
|
||||
if "add" in command:
|
||||
if "--no-interactive" not in _command:
|
||||
raise RuntimeError(
|
||||
"Encountered an 'apk add' command without --no-interactive! This is a bug."
|
||||
)
|
||||
if "--cache-dir" not in _command:
|
||||
raise RuntimeError(
|
||||
"Encountered an 'apk add' command without --cache-dir! This is a bug."
|
||||
)
|
||||
|
||||
if with_progress:
|
||||
_apk_with_progress(_command)
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue