diff options
Diffstat (limited to 'meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh')
-rw-r--r-- | meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh index e61ede9111..c493160300 100644 --- a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh +++ b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh @@ -411,9 +411,25 @@ HERE debug_takeover "$msg" fi -rm -rf $work +# Empty workdir; do not remove workdir itself for it will fail to recreate it if +# RWFS is full +if [ -d $work ] +then + find $work -maxdepth 1 -mindepth 1 -exec rm -rf '{}' + +fi + mkdir -p $upper $work +# Opportunisticly set a sane BMC date based on a file that gets +# written right before rebooting or powercycling. If none exists, +# use the image build date. +files="$upper/var/lib/systemd/random-seed $rodir/etc/os-release" +time=$(find $files -exec stat -c %Y {} \; | sort -n | tail -n 1) +# Allow RTC coordinated time to supersede this setting +if [ "$(date +%s)" -lt "$time" ]; then + date -s @$((time + 5)) || true +fi + mount -t overlay -o lowerdir=$rodir,upperdir=$upper,workdir=$work cow /root while ! chroot /root /bin/sh -c "test -x '$init' -a -s '$init'" @@ -433,6 +449,4 @@ do mount --move $f root/$f done -# switch_root /root $init -exec chroot /root $init - +exec switch_root /root $init |