lkml.org 
[lkml]   [2004]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    SubjectRe: [PATCH 2.6.9-bk7] Select cpio_list or source directory for initramfs image updates [u]
    From
    Date
    On Sun, 2004-10-31 at 01:43 +0200, Sam Ravnborg wrote:
    > On Wed, Oct 27, 2004 at 08:44:05PM +0200, Martin Schlemmer [c] wrote:
    > > >
    > >
    > > How about below? Works as expected. I am open to suggestions short of
    > > coding a util to print numeric mtimes besides find, but for the life of
    > > me could not think of another way ...
    >
    > Looks good.
    > Please send me a version that is not whitespace damaged and with a
    > proper changelog.
    > The changelog shall be descriptive in itself without relying on context
    > from privious patch or comments in a mail.
    >

    Unfortunately evolution 2.0 seems to have some issues, and the
    whitespace damage is one of them. Anyhow, here is the patch attached,
    with a changelog. Hope that is OK.

    ----

    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>

    --
    Martin Schlemmer

    diff -uprN -X dontdiff linux-2.6.9.orig/scripts/gen_initramfs_list.sh linux-2.6.9/scripts/gen_initramfs_list.sh
    --- linux-2.6.9.orig/scripts/gen_initramfs_list.sh 2004-10-27 20:06:47.043999448 +0200
    +++ linux-2.6.9/scripts/gen_initramfs_list.sh 2004-10-27 20:34:39.121804984 +0200
    @@ -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}[unhandled content-type:application/pgp-signature]
    \
     
     \ /
      Last update: 2005-03-22 14:07    [W:0.047 / U:150.452 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site