[make-initrd] [PATCH v1 25/41] fork pipeline: bootchained modified

Leonid Krivoshein klark.devel at gmail.com
Fri Sep 24 18:58:05 MSK 2021


---
  .../bootchain-core/data/sbin/bootchained      | 41 +++++++++++++------
  1 file changed, 29 insertions(+), 12 deletions(-)

diff --git a/make-initrd/features/bootchain-core/data/sbin/bootchained 
b/make-initrd/features/bootchain-core/data/sbin/bootchained
index 369938a..7a1843e 100755
--- a/make-initrd/features/bootchain-core/data/sbin/bootchained
+++ b/make-initrd/features/bootchain-core/data/sbin/bootchained
@@ -1,38 +1,55 @@
  #!/bin/bash -efu
  -. shell-error
-. shell-signal
+. bootchain-sh-functions
  -message_time=1
  pidfile="/var/run/$PROG.pid"
-logfile="/var/log/$PROG.log"
+
   exit_handler()
  {
  	local rc="$?"
  	trap - EXIT
  	rm -f -- "$pidfile"
+	wait
  	exit $rc
  }
  +debug()
+{
+	[ -z "$BC_DEBUG" ] ||
+		message "$*"
+}
+
+
+# Entry point
  [ ! -f "$pidfile" ] ||
  	fatal "already running"
-
  set_cleanup_handler exit_handler
  echo "$$" >"$pidfile"
  -. pipeline-sh-functions
-
-
-[ "${RDLOG-}" != 'console' ] ||
-	logfile=/dev/console
+if [ "${RDLOG-}" = console ]; then
+	BC_LOGFILE=/dev/console
+elif [ -z "${NOTTYS-}" ] &&
+	[ -n "$BC_LOG_VT" ] &&
+	[ ! -c "$BC_LOGFILE" ] &&
+	command -v openvt >/dev/null
+then
+	touch -- "$BC_LOGFILE"
+	[ -e "/dev/tty$BC_LOG_VT" ] ||
+		mknod "/dev/tty$BC_LOG_VT" c 4 "$BC_LOG_VT"
+	openvt -f -w -c$BC_LOG_VT -- /sbin/bootchain-logvt &
+fi
   exec >"$BC_LOGFILE" 2>&1
  message "Starting server [$(initrd_version)]..."
+debug "Booting with /proc/cmdline:"
+fdump /proc/cmdline
   run mkdir -p -- "$mntdir" "$BC_PASSED"
  -mountpoint -q "$mntdir" ||
-	mount -t tmpfs tmpfs "$mntdir" ||:
+mountpoint -q -- "$mntdir" ||
+	run mount -t tmpfs tmpfs "$mntdir" ||:
+
+export chainsteps="${BOOTCHAIN-}"
   bootchain-loop
-- 
2.21.0




More information about the Make-initrd mailing list