Skip to content
Snippets Groups Projects
Unverified Commit 41c8413f authored by Caleb Connolly's avatar Caleb Connolly :recycle:
Browse files

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: default avatarCaleb Connolly <caleb@postmarketos.org>
parent 78474880
No related branches found
No related tags found
1 merge request!2463Rework apk handling and always use apk.static
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment