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

login
register
mail settings
Submitter Shan Hai
Date June 5, 2014, 2:12 a.m.
Message ID <1401934332-1714-2-git-send-email-shan.hai@windriver.com>
Download mbox | patch
Permalink /patch/73269/
State Accepted
Commit e922be50b3aaa9366019de927558c9785d7ab0c0
Headers show

Comments

Shan Hai - June 5, 2014, 2:12 a.m.
JIRAID: LIN6-7329

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

(LOCAL REV: NOT UPSTREAM) -- Sent to oe-core on 20140605

Signed-off-by: Shan Hai <shan.hai@windriver.com>
---
 .../initrdscripts/files/init-install.sh            |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

Patch

diff --git a/meta/recipes-core/initrdscripts/files/init-install.sh b/meta/recipes-core/initrdscripts/files/init-install.sh
index 0ede928..d7d3439 100644
--- a/meta/recipes-core/initrdscripts/files/init-install.sh
+++ b/meta/recipes-core/initrdscripts/files/init-install.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//")