diff options
author | Martin Schlemmer <azarah@nosferatu.za.org> | 2004-11-03 23:52:01 +0100 |
---|---|---|
committer | Sam Ravnborg <sam@mars.ravnborg.org> | 2004-11-03 23:52:01 +0100 |
commit | 242ee42016330f04f01d2e41ce780728856a822d (patch) | |
tree | c3d593337f61083e921e664535d7c6ec56cec776 /scripts | |
parent | 1f34389ffa572306d3892a4a07eb612ca269afa1 (diff) | |
download | history-242ee42016330f04f01d2e41ce780728856a822d.tar.gz |
kbuild: check timestamps on files for initramfs
Add a comment to gen_initramfs_list.sh output that contains the
numeric mtime of the last modified file in the source directory,
or the mtime of the source list. This should cause the initramfs
image to be rebuild if a file in the source directory changed, or
the source list (if that was used rather than a directory as source).
Signed-off-by: Martin Schlemmer <azarah@nosferatu.za.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/gen_initramfs_list.sh | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 1d415792ac7811..2a697c37135ed2 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh @@ -37,6 +37,18 @@ filetype() { return 0 } +print_mtime() { + local argv1="$1" + local my_mtime="0" + + if [ -e "${argv1}" ]; then + my_mtime=$(find "${argv1}" -printf "%T@\n" | sort -r | head -n 1) + fi + + echo "# Last modified: ${my_mtime}" + echo +} + parse() { local location="$1" local name="${location/${srcdir}//}" @@ -77,16 +89,19 @@ parse() { return 0 } -if [ -z $1 ]; then +if [ -z "$1" ]; then simple_initramfs -elif [ -f $1 ]; then - cat $1 -elif [ -d $1 ]; then +elif [ -f "$1" ]; then + print_mtime "$1" + cat "$1" +elif [ -d "$1" ]; then srcdir=$(echo "$1" | sed -e 's://*:/:g') dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" 2>/dev/null) # If $dirlist is only one line, then the directory is empty if [ "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then + print_mtime "$1" + echo "${dirlist}" | \ while read x; do parse ${x} |