[make-initrd] [PATCH v1 35/41] fork pipeline: bootchain-loop: added switch to foreground

Leonid Krivoshein klark.devel at gmail.com
Fri Sep 24 18:59:10 MSK 2021


---
  .../bootchain-core/data/sbin/bootchain-loop   | 31 ++++++++++++++++++-
  1 file changed, 30 insertions(+), 1 deletion(-)

diff --git 
a/make-initrd/features/bootchain-core/data/sbin/bootchain-loop 
b/make-initrd/features/bootchain-core/data/sbin/bootchain-loop
index 7474ebb..9d15781 100755
--- a/make-initrd/features/bootchain-core/data/sbin/bootchain-loop
+++ b/make-initrd/features/bootchain-core/data/sbin/bootchain-loop
@@ -5,6 +5,7 @@
  stepnum="${stepnum:-0}"
  chainsteps="${chainsteps-}"
  prevdir="${prevdir-}"
+BC_IM_supported=
    debug()
@@ -14,12 +15,40 @@ debug()
  }
   +if has_feature bootchain-interactive; then
+	. interactive-sh-functions
+
+	[ "x${1-}" != "x--foreground" ] ||
+		IM_activate "$BC_FGVT_ACTIVATE" "$BC_LOGFILE"
+	BC_IM_supported=1
+fi
+
  rc=0
  while [ -n "$chainsteps" ]; do
  	name="${chainsteps%%,*}"
  	exe="$handlerdir/$name"
  -	if [ -x "$exe" ]; then
+	if [ "$name" = fg ]; then
+		[ -n "$BC_IM_supported" ] ||
+			fatal "bootchain-interactive feature required"
+		assign "callnum" "\${callnum_$name:-0}"
+		chainsteps="${chainsteps#$name}"
+		chainsteps="${chainsteps#,}"
+
+		if IM_is_active; then
+			message "[$callnum] Step '$name' has ignored"
+		else
+			message "[$callnum] Switching to foreground"
+
+			callnum=$((1 + $callnum))
+			assign "callnum_$name" "\$callnum"
+
+			export stepnum chainsteps callnum_fg prevdir bcretry
+
+			IM_exec "$0" --foreground
+		fi
+
+	elif [ -x "$exe" ]; then
  		assign "callnum" "\${callnum_$name:-0}"
  		datadir="$mntdir/src/step$stepnum"
  		destdir="$mntdir/dst/step$stepnum"
-- 
2.21.0




More information about the Make-initrd mailing list