From 4b85e30580433a5d81c692170de638e09bd4cc22 Mon Sep 17 00:00:00 2001
From: Thierry Parmentelat <thierry.parmentelat@inria.fr>
Date: Sun, 8 Mar 2015 18:04:52 +0100
Subject: [PATCH] coming back to a model that works .. most of the time

---
 initscripts/pl_boot     |  8 ++++++++
 initscripts/pl_sysinit  |  8 ++++++++
 initscripts/pl_wrapper  |  4 ++--
 systemd/pl_boot.service | 11 ++++-------
 4 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/initscripts/pl_boot b/initscripts/pl_boot
index 931af20..51aee96 100755
--- a/initscripts/pl_boot
+++ b/initscripts/pl_boot
@@ -1,5 +1,13 @@
 #!/bin/bash
 
+### xxx tmp debug
+
+set -x
+echo pl_boot on console > /dev/console
+exec > /dev/console
+echo pl_boot plain
+
+###
 . /etc/init.d/pl_functions
 
 . /tmp/planet.cnf
diff --git a/initscripts/pl_sysinit b/initscripts/pl_sysinit
index 8b3d421..388010b 100755
--- a/initscripts/pl_sysinit
+++ b/initscripts/pl_sysinit
@@ -1,5 +1,13 @@
 #!/bin/sh
 
+### xxx tmp debug
+
+set -x
+echo pl_sysinit on console > /dev/console
+exec > /dev/console
+echo pl_sysinit plain
+
+###
 . /etc/init.d/pl_functions
 
 echo ""
diff --git a/initscripts/pl_wrapper b/initscripts/pl_wrapper
index da5fc3a..a46b9f5 100755
--- a/initscripts/pl_wrapper
+++ b/initscripts/pl_wrapper
@@ -3,8 +3,8 @@
 # nodes starting up with fedora18 - especially under kvm/qemu btw
 # tend to startup unreliably, this is an attempt to get more details by
 # * running pl_boot and pl_sysinit in -x mode
-# * and logging everything in /var/log/pl-boot
+# * and logging everything in /var/log/ as well as echoing in /dev/console
 #
 # also we just run both in sequence instead of relying on convoluted systemd dependencies
 # 
-(bash -x /etc/init.d/pl_sysinit ; bash -x /etc/init.d/pl_boot) > /dev/console 2>&1
+(bash -x /etc/init.d/pl_sysinit ; bash -x /etc/init.d/pl_boot) 2>&1 | tee /var/log/bootcd.log > /dev/console
diff --git a/systemd/pl_boot.service b/systemd/pl_boot.service
index b75fa83..7ab5f8e 100644
--- a/systemd/pl_boot.service
+++ b/systemd/pl_boot.service
@@ -3,12 +3,9 @@ Description=pl_boot service
 Wants=network-online.target
 After=network.target
 
+# in debug mode we fork bash -x so that we can get a grip on
+# what exactly is going on in here
 [Service]
-# it is possible to mention ExecStart several times
-#ExecStart=/etc/init.d/pl_sysinit
-#ExecStart=/etc/init.d/pl_boot
-# However pl_wrapper is a convenience that lets us
-# reliably redirect outputs to the console
-ExecStart=/etc/init/pl_wrapper
+ExecStart=/etc/init.d/pl_sysinit
+ExecStart=/etc/init.d/pl_boot
 Type=oneshot
-
-- 
2.47.0