]> code.ossystems Code Review - openembedded-core.git/commitdiff
init-install*: /etc/mtab make a link rather than a copy
authorAwais Belal <awais_belal@mentor.com>
Mon, 1 Aug 2016 11:31:43 +0000 (16:31 +0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 17 Aug 2016 09:33:29 +0000 (10:33 +0100)
Using a copy would only make management of devices erroneous
and makes the system unstable in some scenarios as tools will
have to manipulate both files separately. A link ensures that
both files /proc/mounts and /etc/mtab will have the same
information at all times and this is how it is handled
on newer systems where there is such a need. Same is
suggested by busybox.

Signed-off-by: Awais Belal <awais_belal@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/recipes-core/initrdscripts/files/init-install-efi.sh
meta/recipes-core/initrdscripts/files/init-install.sh

index 3134486aae4af657bf88f4fc3d26e10ec9cc4e15..2d20a6dad7908f7965c46a4cf3b917eee299a913 100644 (file)
@@ -128,8 +128,8 @@ umount ${device}* 2> /dev/null || /bin/true
 mkdir -p /tmp
 
 # Create /etc/mtab if not present
-if [ ! -e /etc/mtab ]; then
-    cat /proc/mounts > /etc/mtab
+if [ ! -e /etc/mtab ] && [ -e /proc/mounts ]; then
+    ln -sf /proc/mounts /etc/mtab
 fi
 
 disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")
index 0542e26fd2e8fa985092c0285621ef79edfda882..89d5a5d9a4cf7d610b927e106cae1cea7bd3d479 100644 (file)
@@ -124,8 +124,8 @@ if [ ! -b /dev/loop0 ] ; then
 fi
 
 mkdir -p /tmp
-if [ ! -L /etc/mtab ]; then
-    cat /proc/mounts > /etc/mtab
+if [ ! -L /etc/mtab ] && [ -e /proc/mounts ]; then
+    ln -sf /proc/mounts /etc/mtab
 fi
 
 disk_size=$(parted ${device} unit mb print | grep '^Disk .*: .*MB' | cut -d" " -f 3 | sed -e "s/MB//")