]> code.ossystems Code Review - openembedded-core.git/commitdiff
populate-extfs.sh: keep file timestamps
authorChen Qi <Qi.Chen@windriver.com>
Tue, 27 May 2014 02:15:16 +0000 (22:15 -0400)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 24 Jun 2014 10:05:26 +0000 (11:05 +0100)
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>
meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/populate-extfs.sh

index 23d97d39b6a559ac9fb38a16854084accdc9e5cc..26a8d891430f2b177d5bc09f1d2726711836efe0 100644 (file)
@@ -36,7 +36,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
@@ -70,6 +70,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.