Patchwork [dora,1/1] populate-extfs.sh: keep file timestamps

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date May 23, 2014, 9:54 a.m.
Message ID <0b765ce48ce12f1b0222ef2e769c7644aa4df9eb.1400838768.git.Qi.Chen@windriver.com>
Download mbox | patch
Permalink /patch/72629/
State New
Headers show

Comments

Qi.Chen@windriver.com - May 23, 2014, 9:54 a.m.
Fix populate-extfs.sh to keep file timestamps while generating the
ext file systems.

[YOCTO #6348]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
---
 .../e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh   |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Patch

diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh b/meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh
index 7de720b..76c4d6f 100644
--- a/meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh
@@ -35,7 +35,7 @@  DEBUGFS="debugfs"
 		fi
 
 		# Only stat once since stat is a time consuming command
-		STAT=$(stat -c "TYPE=\"%F\";DEVNO=\"0x%t 0x%T\";MODE=\"%f\";U=\"%u\";G=\"%g\"" "$FILE")
+		STAT=$(stat -c "TYPE=\"%F\";DEVNO=\"0x%t 0x%T\";MODE=\"%f\";U=\"%u\";G=\"%g\";AT=\"%x\";MT=\"%y\";CT=\"%z\"" "$FILE")
 		eval $STAT
 
 		case $TYPE in
@@ -69,6 +69,14 @@  DEBUGFS="debugfs"
 		# Set uid and gid
 		echo "sif \"$TGT\" uid $U"
 		echo "sif \"$TGT\" gid $G"
+
+		# Set atime, mtime and ctime
+		AT=`echo $AT | cut -d'.' -f1 | sed -e 's#[- :]##g'`
+		MT=`echo $MT | cut -d'.' -f1 | sed -e 's#[- :]##g'`
+		CT=`echo $CT | cut -d'.' -f1 | sed -e 's#[- :]##g'`
+		echo "sif \"$TGT\" atime $AT"
+		echo "sif \"$TGT\" mtime $MT"
+		echo "sif \"$TGT\" ctime $CT"
 	done
 
 	# Handle the hard links.