Patchwork [2/5] oe-core/init-install-testfs.sh: do not overwrite /etc/mtab if the link already exist

login
register
mail settings
Submitter Cristian Iorga
Date June 20, 2014, 3:42 p.m.
Message ID <e96f09ffae12592ff00f6227153f456a2d8e2667.1403277454.git.cristian.iorga@intel.com>
Download mbox | patch
Permalink /patch/74167/
State New
Headers show

Comments

Cristian Iorga - June 20, 2014, 3:42 p.m.
Overwriting of /etc/mtab would fail as below if the /etc/mtab link already
exist during installation phase, this patch fix this problem by checking
existance of the link before try to overwrite it.

Error message during installation if the /etc/mtab exists:
"cat: /proc/mounts: input file is output file"

Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
---
 meta/recipes-core/initrdscripts/files/init-install-testfs.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
index 6faa233..d2cc6ac 100644
--- a/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install-testfs.sh
@@ -90,7 +90,9 @@  if [ ! -b /dev/loop0 ] ; then
 fi
 
 mkdir -p /tmp
-cat /proc/mounts > /etc/mtab
+if [ ! -L /etc/mtab ]; then
+	cat /proc/mounts > /etc/mtab
+fi
 
 disk_size=$(parted /dev/${device} unit mb print | grep Disk | cut -d" " -f 3 | sed -e "s/MB//")