aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Spooren <mail@aparcar.org>2021-12-09 07:17:42 -1000
committerTimo Teräs <timo.teras@iki.fi>2021-12-29 09:43:13 +0200
commit2da3f347d8851f6344ea6dba47676e488084debf (patch)
treea8dfcc18743a02052456c1616d7ed67cbb3e4397
parent70fe7b121adf6df1518ae1b2a171fdbde83149f2 (diff)
apk: add --force-no-chroot option
[TT: reoder changes to alphabetically sorted locations] Signed-off-by: Paul Spooren <mail@aparcar.org>
-rw-r--r--doc/apk.8.scd5
-rw-r--r--src/apk.c4
2 files changed, 9 insertions, 0 deletions
diff --git a/doc/apk.8.scd b/doc/apk.8.scd
index f119313..2a096f7 100644
--- a/doc/apk.8.scd
+++ b/doc/apk.8.scd
@@ -120,6 +120,11 @@ The following options are available for all commands.
*--force-broken-world*
Continue even if _world_ cannot be satisfied.
+*--force-no-chroot*
+ Disable chroot for scripts. This can be used for rootfs creation when
+ chroot is not available. Scripts running outside a chroot environment
+ may modify and damage the host system.
+
*--force-non-repository*
Continue even if packages may be lost on reboot. This can happen when
running in run-from-tmpfs mode, and installing non-repository package.
diff --git a/src/apk.c b/src/apk.c
index 39b878c..da5fdd7 100644
--- a/src/apk.c
+++ b/src/apk.c
@@ -62,6 +62,7 @@ static void version(struct apk_out *out, const char *prefix)
OPT(OPT_GLOBAL_force, APK_OPT_SH("f") "force") \
OPT(OPT_GLOBAL_force_binary_stdout, "force-binary-stdout") \
OPT(OPT_GLOBAL_force_broken_world, "force-broken-world") \
+ OPT(OPT_GLOBAL_force_no_chroot, "force-no-chroot") \
OPT(OPT_GLOBAL_force_non_repository, "force-non-repository") \
OPT(OPT_GLOBAL_force_old_apk, "force-old-apk") \
OPT(OPT_GLOBAL_force_overwrite, "force-overwrite") \
@@ -142,6 +143,9 @@ static int option_parse_global(void *ctx, struct apk_ctx *ac, int opt, const cha
case OPT_GLOBAL_force_refresh:
ac->force |= APK_FORCE_REFRESH;
break;
+ case OPT_GLOBAL_force_no_chroot:
+ ac->flags |= APK_NO_CHROOT;
+ break;
case OPT_GLOBAL_force_non_repository:
ac->force |= APK_FORCE_NON_REPOSITORY;
break;