[make-initrd] [PATCH v1 37/41] fork pipeline: bootchain-loop: added switch retry/noretry

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


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

diff --git 
a/make-initrd/features/bootchain-core/data/sbin/bootchain-loop 
b/make-initrd/features/bootchain-core/data/sbin/bootchain-loop
index 229074f..1cf00d3 100755
--- a/make-initrd/features/bootchain-core/data/sbin/bootchain-loop
+++ b/make-initrd/features/bootchain-core/data/sbin/bootchain-loop
@@ -2,6 +2,7 @@
   . bootchain-sh-functions
  +bcretry="${bcretry:-1}"
  stepnum="${stepnum:-0}"
  chainsteps="${chainsteps-}"
  prevdir="${prevdir-}"
@@ -54,6 +55,18 @@ while [ -n "$chainsteps" ]; do
  		prevdir=
  		message "[0] Step '$name' has been passed"
  +	elif [ "$name" = retry ]; then
+		chainsteps="${chainsteps#$name}"
+		chainsteps="${chainsteps#,}"
+		bcretry=1
+		message "subsequent steps will restart after failure"
+
+	elif [ "$name" = noretry ]; then
+		chainsteps="${chainsteps#$name}"
+		chainsteps="${chainsteps#,}"
+		bcretry=0
+		message "daemon will be stopped immediately after any step failure"
+
  	elif [ -x "$exe" ]; then
  		assign "callnum" "\${callnum_$name:-0}"
  		datadir="$mntdir/src/step$stepnum"
@@ -85,6 +98,8 @@ while [ -n "$chainsteps" ]; do
  				message "[$callnum] Handler failed (rc=$rc, try=$try)"
  				[ ! -f "$BC_PASSED/$PROG" ] ||
  					break 2
+				[ "$bcretry" != 0 ] ||
+					break
  				sleep 2
  			done
  -- 2.21.0




More information about the Make-initrd mailing list