#!/bin/sh
if [ -z "$1" ]; then
	echo armv5tel-do-kernel-create.sh KVERSION
	exit
fi

VER=$1
BASEDIR=$(dirname $0)

source $BASEDIR/armv5tel-kernels

for package in ${PACKAGES}; do
	if [ ! -e ${package} ]; then
	name=$(echo ${package} | cut -d/ -f2)
	mkdir ${package}
	cp Documentation/ebuild/metadata.xml ${package}
		if [ ${name/-*/} = "linux" ]; then
			newname=$(echo ${name} | cut -d- -f2)
			sed -e "s:@nasname@:${newname}:" Documentation/ebuild/linux-flavour.ebuild > ${package}/${name}-${VER}.ebuild
		else
			newname=${name/-*/}
			sed -e "s:@nasname@:${newname}:" Documentation/ebuild/flavour-sources.ebuild > ${package}/${name}-${VER}.ebuild
		fi
	fi
	git add ${package}
	git add ${package}/*
done
