[oe-commits] [openembedded-core] 33/62: init-install*: /etc/mtab make a link rather than a copy
git at git.openembedded.org
git at git.openembedded.org
Wed Aug 17 09:36:50 UTC 2016
rpurdie pushed a commit to branch master
in repository openembedded-core.
commit 9f9240d175acee274c04242fd5781094b3f5491b
Author: Awais Belal <awais_belal at mentor.com>
AuthorDate: Mon Aug 1 16:31:43 2016 +0500
init-install*: /etc/mtab make a link rather than a copy
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 at mentor.com>
Signed-off-by: Ross Burton <ross.burton at intel.com>
---
meta/recipes-core/initrdscripts/files/init-install-efi.sh | 4 ++--
meta/recipes-core/initrdscripts/files/init-install.sh | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/meta/recipes-core/initrdscripts/files/init-install-efi.sh b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
index 3134486..2d20a6d 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -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//")
diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 0542e26..89d5a5d 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -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//")
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Openembedded-commits
mailing list