[make-initrd] [PATCH v6 17/22] bootchain-core: few minor improvements to the rootfs step

Leonid Krivoshein klark.devel at gmail.com
Sun Oct 24 20:22:39 MSK 2021


Now the step is run only once, additional checks are performed,
and a safe way to end the daemon main loop is used.

Signed-off-by: Leonid Krivoshein <klark.devel at gmail.com>
---
 features/bootchain-core/data/lib/bootchain/rootfs | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/features/bootchain-core/data/lib/bootchain/rootfs b/features/bootchain-core/data/lib/bootchain/rootfs
index 6ac64a6..aaba01d 100755
--- a/features/bootchain-core/data/lib/bootchain/rootfs
+++ b/features/bootchain-core/data/lib/bootchain/rootfs
@@ -2,9 +2,10 @@
 
 . bootchain-sh-functions
 
-[ -n "$prevdir" ] ||
+launch_step_once
+[ -n "$prevdir" ] && mountpoint -q -- "$prevdir" ||
 	fatal "no previous step to use as rootfs"
-
-run mount --move "$prevdir" "$rootmnt"
+[ "$prevdir" = "$rootmnt" ] ||
+	run mount --move -- "$prevdir" "$rootmnt"
 echo localdev > /etc/initrd/method
-exit 2
+break_bc_loop
-- 
2.24.1



More information about the Make-initrd mailing list