From 2da3f347d8851f6344ea6dba47676e488084debf Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Thu, 9 Dec 2021 07:17:42 -1000 Subject: [PATCH] apk: add --force-no-chroot option [TT: reoder changes to alphabetically sorted locations] Signed-off-by: Paul Spooren --- doc/apk.8.scd | 5 +++++ src/apk.c | 4 ++++ 2 files changed, 9 insertions(+) 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;