From 657fc2cdcdfdc9d1e5db99d710ebe5af528ce62f Mon Sep 17 00:00:00 2001 From: John Klug Date: Tue, 5 Oct 2021 13:52:03 -0500 Subject: Add multiple rootfs/config/oem support --- .../multitech/overlayfs-init-ubi/overlayfs.init | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'recipes-core/multitech/overlayfs-init-ubi') diff --git a/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init b/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init index 0000f29..7fc7f7e 100644 --- a/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init +++ b/recipes-core/multitech/overlayfs-init-ubi/overlayfs.init @@ -128,8 +128,25 @@ do_rw_mount() { done } + +TMP=/var/volatile +# Set the suffix number in /var/oem and /var/config to match root +fix_volume_names() { + if ! [[ $(cat /proc/cmdline) =~ root=ubi0:rootfs([0-9]+) ]] ; then + loginfo "Cannot find root=ubi0:rootfs in /proc/cmdline" + fi + vol_suffix=${BASH_REMATCH[1]} + echo $vol_suffix + sed -r "s/(ubi0:(oem|config))([0-9]*)/\1${vol_suffix}/" /etc/fstab >${TMP}/fstab + if ! cmp ${TMP}/fstab /etc/fstab ; then + loginfo "Updating fstab with new volume names" + cp ${TMP}/fstab /etc/fstab + fi +} + do_start() { do_rw_mount + fix_volume_names } case $1 in -- cgit v1.2.3