lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFnufp3SdnBoFiC5j2bjrA=MW-WfsmFVhfggJvoHa-5ZEgg7aA@mail.gmail.com>
Date:	Tue, 6 Nov 2012 00:52:46 +0100
From:	Matteo Croce <technoboy85@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: Kernel Source updater script

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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ