aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-core/initrdscripts/files/0010-init-install-efi.sh-etc-mtab-make-a-softlink-rather-.patch
blob: 053ef092f131ae25f51abd6a4a34e58810778248 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
From 172e6d8c4e5cb8746b87130bbd6d38a60248b343 Mon Sep 17 00:00:00 2001
From: Awais Belal <awais_belal@mentor.com>
Date: Thu, 28 Jul 2016 13:35:01 +0500
Subject: [PATCH] init-install-efi.sh: /etc/mtab make a softlink 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.

Signed-off-by: Awais Belal <awais_belal@mentor.com>
---
 init-install-efi.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git init-install-efi.sh init-install-efi.sh
index a6a9047..39e8806 100644
--- init-install-efi.sh
+++ init-install-efi.sh
@@ -126,8 +126,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 | cut -d" " -f 3 | sed -e "s/MB//")
-- 
1.9.1