All of lore.kernel.org
 help / color / mirror / Atom feed
* Kernel Source updater script
@ 2012-11-05 23:52 Matteo Croce
  2012-11-06  4:43 ` Greg KH
  0 siblings, 1 reply; 4+ messages in thread
From: Matteo Croce @ 2012-11-05 23:52 UTC (permalink / raw)
  To: linux-kernel

Hi all,

I know that this is useless to people using git, but it was so fun to write
and I use it to update regularly my pc kernel source from time to time
while saving servers (and home) bandwidth

cheers!

#!/bin/sh

ver=$(awk '/^VERSION/{print$3}' Makefile)
patch=$(awk '/^PATCHLEVEL/{print$3}' Makefile)
sub=$(awk '/^SUBLEVEL/{print$3}' Makefile)

echo "Current kernel: $ver.$patch.$sub"

[ -d .pc ] && quilt pop -a

up_sub() {
	next=$((sub + 1))
	while wget -q --spider
http://www.kernel.org/pub/linux/kernel/v$ver.0/incr/patch-$ver.$patch.$sub-$next.xz;
do
		url="$url http://www.kernel.org/pub/linux/kernel/v$ver.0/incr/patch-$ver.$patch.$sub-$next.xz"
		sub=$next
		next=$((next + 1))
	done

	echo "Upgrading to version: $ver.$patch.$sub"

	wget -qO- $url |xz -d |patch -p1 |sed -u 's/$/
                  /' |tr '[\n]' '[\r]'
	echo
}

up_patch(){
	if [ $sub -gt 0 ]; then
		url=
		next=$((sub - 1))
		while [ $sub -gt 0 ] ; do
			if [ $next -ne 0 ]; then
				url="$url http://www.kernel.org/pub/linux/kernel/v$ver.0/incr/patch-$ver.$patch.$next-$sub.xz"
			else
				url="$url http://www.kernel.org/pub/linux/kernel/v$ver.0/patch-$ver.$patch.$sub.xz"
			fi
			sub=$next
			next=$((next - 1))
		done

		echo "Downgrading to version: $ver.$patch.$sub"

		wget -qO- $url |xz -d |patch -p1 -R |sed -u 's/$/
                      /' |tr '[\n]' '[\r]'
		echo
	fi

	url=
	patch=$((patch + 1))
	while wget -q --spider
http://www.kernel.org/pub/linux/kernel/v$ver.0/patch-$ver.$patch.xz;
do
		url="$url http://www.kernel.org/pub/linux/kernel/v$ver.0/patch-$ver.$patch.xz"
		patch=$((patch + 1))
	done
	patch=$((patch - 1))

	sub=1
	while wget -q --spider
http://www.kernel.org/pub/linux/kernel/v$ver.0/patch-$ver.$patch.$sub.xz;
do
		sub=$((sub + 1))
	done
	sub=$((sub - 1))
	url="$url http://www.kernel.org/pub/linux/kernel/v$ver.0/patch-$ver.$patch.$sub.xz"

	echo "Upgrading to version: $ver.$patch.$sub"

	wget -qO- $url |xz -d |patch -p1 |sed -u 's/$/
                  /' |tr '[\n]' '[\r]'
	echo
}

case $1 in
patch)
	up_patch
	;;

sub)
	up_sub
	;;

*)
	echo "usage: $0 [patch|sub]"
esac

[ -d .pc ] && while quilt push; do
	quilt refresh
done

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Kernel Source updater script
  2012-11-05 23:52 Kernel Source updater script Matteo Croce
@ 2012-11-06  4:43 ` Greg KH
  2012-11-20 13:40   ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2012-11-06  4:43 UTC (permalink / raw)
  To: Matteo Croce; +Cc: linux-kernel

On Tue, Nov 06, 2012 at 12:52:46AM +0100, Matteo Croce wrote:
> Hi all,
> 
> I know that this is useless to people using git, but it was so fun to write
> and I use it to update regularly my pc kernel source from time to time
> while saving servers (and home) bandwidth

Have you looked at the python script called 'ketchup'?  I think it
already does a lot of what you are doing here.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Kernel Source updater script
  2012-11-06  4:43 ` Greg KH
@ 2012-11-20 13:40   ` Pavel Machek
  2012-11-20 16:20     ` Matteo Croce
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2012-11-20 13:40 UTC (permalink / raw)
  To: Greg KH; +Cc: Matteo Croce, linux-kernel

On Tue 2012-11-06 05:43:46, Greg KH wrote:
> On Tue, Nov 06, 2012 at 12:52:46AM +0100, Matteo Croce wrote:
> > Hi all,
> > 
> > I know that this is useless to people using git, but it was so fun to write
> > and I use it to update regularly my pc kernel source from time to time
> > while saving servers (and home) bandwidth
> 
> Have you looked at the python script called 'ketchup'?  I think it
> already does a lot of what you are doing here.

I tried to get it to work with 3.x kernels, and I don't think I was
successful. Hopefully someone else did the job?

It would be nice to include it in the scripts/ directory, to save
duplicate work. (Or drivers/staging/scripts? :-).
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Kernel Source updater script
  2012-11-20 13:40   ` Pavel Machek
@ 2012-11-20 16:20     ` Matteo Croce
  0 siblings, 0 replies; 4+ messages in thread
From: Matteo Croce @ 2012-11-20 16:20 UTC (permalink / raw)
  To: Pavel Machek; +Cc: Greg KH, linux-kernel

I have an updated version here:

git://github.com/teknoraver/misc.git

2012/11/20 Pavel Machek <pavel@ucw.cz>:
> On Tue 2012-11-06 05:43:46, Greg KH wrote:
>> On Tue, Nov 06, 2012 at 12:52:46AM +0100, Matteo Croce wrote:
>> > Hi all,
>> >
>> > I know that this is useless to people using git, but it was so fun to write
>> > and I use it to update regularly my pc kernel source from time to time
>> > while saving servers (and home) bandwidth
>>
>> Have you looked at the python script called 'ketchup'?  I think it
>> already does a lot of what you are doing here.
>
> I tried to get it to work with 3.x kernels, and I don't think I was
> successful. Hopefully someone else did the job?
>
> It would be nice to include it in the scripts/ directory, to save
> duplicate work. (Or drivers/staging/scripts? :-).
>                                                                         Pavel
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html



-- 
Matteo Croce
OpenWrt Developer
 _______                     ________        __
|       |.-----.-----.-----.|  |  |  |.----.|  |_
|   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
|_______||   __|_____|__|__||________||__|  |____|
         |__| W I R E L E S S   F R E E D O M
ATTITUDE ADJUSTMENT (bleeding edge) --------------
 * 1/4 oz Vodka      Pour all ingredients into mixing
 * 1/4 oz Gin        tin with ice, strain into glass.
 * 1/4 oz Amaretto
 * 1/4 oz Triple sec
 * 1/4 oz Peach schnapps
 * 1/4 oz Sour mix
 * 1 splash Cranberry juice
-----------------------------------------------------

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-11-20 16:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-05 23:52 Kernel Source updater script Matteo Croce
2012-11-06  4:43 ` Greg KH
2012-11-20 13:40   ` Pavel Machek
2012-11-20 16:20     ` Matteo Croce

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.