Re: [OE-core] [[PATCH v3] init-install*: /etc/mtab make a link rather than a copy

2016-08-10 Thread Belal, Awais
Ping!

BR,
Awais


From: openembedded-core-boun...@lists.openembedded.org 
[openembedded-core-boun...@lists.openembedded.org] on behalf of Belal, Awais
Sent: Monday, August 01, 2016 4:31 PM
To: openembedded-core@lists.openembedded.org
Subject: [OE-core] [[PATCH v3] 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 
---
 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 f564f4e..c5db2f0 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -122,8 +122,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 72ce92b..bf92acb 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -118,8 +118,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//")
--
1.9.1

--
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core


[OE-core] [[PATCH v3] init-install*: /etc/mtab make a link rather than a copy

2016-08-01 Thread Awais Belal
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 
---
 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 f564f4e..c5db2f0 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-efi.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-efi.sh
@@ -122,8 +122,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 72ce92b..bf92acb 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.sh
@@ -118,8 +118,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//")
-- 
1.9.1

-- 
___
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core