mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Martin Schlemmer [c]" <azarah@nosferatu.za.org>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: Andrew Morton <akpm@osdl.org>,
	torvalds@osdl.org,
	Linux Kernel Mailing Lists <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2.6.9-bk7] Select cpio_list or source directory for initramfs image updates [u]
Date: Wed, 27 Oct 2004 20:44:05 +0200	[thread overview]
Message-ID: <1098902645.12420.75.camel@nosferatu.lan> (raw)
In-Reply-To: <20041026231514.GA3285@mars.ravnborg.org>


[-- Attachment #1.1: Type: text/plain, Size: 2183 bytes --]

On Wed, 2004-10-27 at 01:15 +0200, Sam Ravnborg wrote:
> On Tue, Oct 26, 2004 at 11:07:29PM +0200, Martin Schlemmer [c] wrote:
>  
> > > Current patch will not rebuild image if one of the
> > > programs listed are changed. But it should give a good
> > > foundation to do so.
> > > 
> > 
> > I will see if I get the time to get that implemented elegantly if
> > you do not beat me to it.
> 
> Something as simple as putting relevant timestamps in the generated
> file as coment should do it.
> If timestamp differ then initramfs_list will be updated and initramfs
> image will be remade.
> 
> All changes isolated to gen_initramfs_list.sh.
> Care to give that a spin?
> 

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


Signed-off-by: Martin Schlemmer <azarah@nosferatu.za.org>

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}



-- 
Martin Schlemmer


[-- Attachment #1.2: initramfs_list-regen-on-mtime-v1.patch --]
[-- Type: text/x-patch, Size: 1210 bytes --]

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}

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2004-10-27 19:32 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200410200849.i9K8n5921516@mail.osdl.org>
2004-10-23 12:06 ` Martin Schlemmer [c]
2004-10-24 10:08   ` Andrew Morton
2004-10-24 13:59     ` Martin Schlemmer [c]
2004-10-24 22:26     ` Sam Ravnborg
2004-10-26 22:12   ` Sam Ravnborg
2004-10-26 21:07     ` Martin Schlemmer [c]
2004-10-26 23:15       ` Sam Ravnborg
2004-10-26 21:36         ` Martin Schlemmer [c]
2004-10-27  4:09         ` Dave Airlie
2004-10-27  6:21           ` Sam Ravnborg
2004-10-27  4:55             ` timestamps in kernel was " Dave Airlie
2004-10-27 18:44         ` Martin Schlemmer [c] [this message]
2004-10-30 23:43           ` Sam Ravnborg
2004-10-31 10:36             ` Martin Schlemmer [c]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1098902645.12420.75.camel@nosferatu.lan \
    --to=azarah@nosferatu.za.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome