initfs: Restore our former scripts
Revert to our original initramfs init, shutdown, and update
scripts to test with systemd top of tree.
The former mount and unmount strategy used by phosphor-initfs
has been in use for close to 6 years. Revert to it to provide
clarity on what has changed when systemd hands off and the
effects it has on our real world shutdown and update process.
Use the experience from the prior results to guide the structure
for discussion.
Signed-off-by: Milton Miller <mdmii@outlook.com>
diff --git a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh
index 536a40d..3df371f 100644
--- a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh
+++ b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh
@@ -1,9 +1,8 @@
#!/bin/sh
fslist="proc sys dev run"
-api=run/initramfs
-rodir=$api/ro
-rwdir=$api/rw
+rodir=run/initramfs/ro
+rwdir=run/initramfs/rw
upper=$rwdir/cow
work=$rwdir/work
@@ -13,21 +12,14 @@
mount dev dev -tdevtmpfs
mount sys sys -tsysfs
mount proc proc -tproc
-if grep $api proc/mounts
-then
- umount $api
-fi
if ! grep run proc/mounts
then
mount tmpfs run -t tmpfs -o mode=755,nodev
fi
-mkdir -p $api
-mount initrd $api -t tmpfs
-cp -rp init shutdown update whitelist bin sbin usr lib etc var $api
-
mkdir -p $rodir $rwdir
+cp -rp init shutdown update whitelist bin sbin usr lib etc var run/initramfs
# To start a interactive shell with job control at this point, run
# getty 38400 ttyS4
diff --git a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-shutdown.sh b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-shutdown.sh
index e58907b..53d0e54 100644
--- a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-shutdown.sh
+++ b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-shutdown.sh
@@ -14,36 +14,27 @@
else
umount_proc=
fi
-api=/run/initramfs
-if [ ! -f $api/shutdown ]
-then
- mkdir -p $api
- mount --bind / $api
-fi
# Remove an empty oldroot, that means we are not invoked from systemd-shutdown
rmdir /oldroot 2>/dev/null
# Move /oldroot/run to /mnt in case it has the underlying rofs loop mounted.
# Ordered before /oldroot the overlay is unmounted before the loop mount
-# Unmount under initramfs but not the initramfs directory itself
-# Also unmount /ro and /rw if they are mounted (/run/initramfs/{ro,rw} before pivot)
mkdir -p /mnt
mount --move /oldroot/run /mnt
set -x
-awk '/oldroot|mnt|initramfs[^ ]/ { print $2 } / .r[ow] / { print $2 }' < /proc/mounts |
- sort -r | while IFS= read -r f
+awk '/oldroot|mnt/ { print $2 }' < /proc/mounts | sort -r | while IFS= read -r f
do
umount "$f"
done
set +x
-update=$api/update
-image=$api/image-
+update=/run/initramfs/update
+image=/run/initramfs/image-
wdt="-t 1 -T 5"
-wdrst="-T 150"
+wdrst="-T 15"
if ls $image* > /dev/null 2>&1
then