diff options
-rw-r--r-- | recipes-core/multitech/overlayfs-init-ubi/overlayfs.init | 17 |
1 files changed, 17 insertions, 0 deletions
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 |