blob: 8760ccfecc110d876f8c7aae8234db3d72fdca08 [file] [log] [blame]
Brandon Kimbafdac12021-06-15 15:29:31 -07001diff --git a/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh b/meta-phosphor/recipes-phosphor/initrdscripts/files/obmc-init.sh
Heyi Guo2168adb2022-01-26 14:10:33 +08002index 2a32d26ffc..a8cc76d440 100644
Brandon Kimbafdac12021-06-15 15:29:31 -07003--- a/obmc-init.sh
4+++ b/obmc-init.sh
Heyi Guo2168adb2022-01-26 14:10:33 +08005@@ -287,6 +287,14 @@ then
Brandon Kimbafdac12021-06-15 15:29:31 -07006 fi
7 fi
8
9+# Ensure that we clean our rwfs on version change
10+if mount $rwdev $rwdir -t $rwfst -o $rwopts; then
11+ if ! cmp "$rwdir"/os-release /etc/os-release 2>/dev/null; then
12+ echo "RWFS from older BMC version, cleaning"
13+ touch $trigger
14+ fi
15+ umount "$rwdir"
16+fi
17 if grep -w clean-rwfs-filesystem $optfile
18 then
19 echo "Cleaning of read-write overlay filesystem requested."
Heyi Guo2168adb2022-01-26 14:10:33 +080020@@ -411,6 +419,9 @@ HERE
Brandon Kimbafdac12021-06-15 15:29:31 -070021 debug_takeover "$msg"
22 fi
23
24+# Keep track of the last version to use this rwfs
25+cp /etc/os-release "$rwdir"/os-release
26+
Heyi Guo2168adb2022-01-26 14:10:33 +080027 # Empty workdir; do not remove workdir itself for it will fail to recreate it if
28 # RWFS is full
29 if [ -d $work ]