populate-extfs.sh: keep file timestamps

Fix populate-extfs.sh to keep file timestamps while generating the
ext file systems.

[YOCTO #6348]

(From OE-Core rev: f8c0359edc2ce740e13e874ea189770ff99d1525)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Chen Qi 2014-05-26 22:15:16 -04:00 committed by Richard Purdie
parent 47afe5bcfa
commit 05f172c745
1 changed files with 9 additions and 1 deletions

View 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.