|
| 1 | +From 112c9497e53327e7fb6b2dd844bf76d6c488ff0f Mon Sep 17 00:00:00 2001 |
| 2 | +From: Alexey Gladkov < [email protected]> |
| 3 | +Date: Sat, 14 Jun 2025 17:10:12 +0200 |
| 4 | +Subject: [PATCH] switch_root: Allow to use on overlayfs |
| 5 | + |
| 6 | +Signed-off-by: Alexey Gladkov < [email protected]> |
| 7 | +--- |
| 8 | + util-linux/switch_root.c | 6 +++++- |
| 9 | + 1 file changed, 5 insertions(+), 1 deletion(-) |
| 10 | + |
| 11 | +diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c |
| 12 | +index 14139736e..3ffea5482 100644 |
| 13 | +--- a/util-linux/switch_root.c |
| 14 | ++++ b/util-linux/switch_root.c |
| 15 | +@@ -64,6 +64,9 @@ extern int capget(cap_user_header_t header, const cap_user_data_t data); |
| 16 | + #ifndef TMPFS_MAGIC |
| 17 | + # define TMPFS_MAGIC ((unsigned)0x01021994) |
| 18 | + #endif |
| 19 | ++#ifndef OVERLAYFS_MAGIC |
| 20 | ++#define OVERLAYFS_MAGIC ((unsigned)0x794c7630) |
| 21 | ++#endif |
| 22 | + #ifndef MS_MOVE |
| 23 | + # define MS_MOVE 8192 |
| 24 | + #endif |
| 25 | +@@ -244,8 +247,9 @@ int switch_root_main(int argc UNUSED_PARAM, char **argv) |
| 26 | + statfs("/", &stfs); // this never fails |
| 27 | + if ((unsigned)stfs.f_type != RAMFS_MAGIC |
| 28 | + && (unsigned)stfs.f_type != TMPFS_MAGIC |
| 29 | ++ && (unsigned)stfs.f_type != OVERLAYFS_MAGIC |
| 30 | + ) { |
| 31 | +- bb_simple_error_msg_and_die("root filesystem is not ramfs/tmpfs"); |
| 32 | ++ bb_simple_error_msg_and_die("root filesystem is not ramfs/tmpfs/overlayfs"); |
| 33 | + } |
| 34 | + |
| 35 | + if (!dry_run) { |
| 36 | +-- |
| 37 | +2.49.0 |
| 38 | + |
0 commit comments