# Copy (and uncomment once) the following block to establish a new stage.
# You can copy to any location in this file : the higher up you copy, the
# earlier that stage will be processed. If you copy to the bottom, it will
# effectively establish the last stage.
# 
# The markup tags in the template are purely for visual assistance.

#{
##<mustchange>
#	#the first line establishes the stage name
#	#must be copied as well as altered to generate a new name
#	#name must be a) unique; and b) alphanumeric (with underscores permitted)

#	ident=my_stage1
##</mustchange>

##<mustnotchange>
#	#the following lines must never be altered, so copy them as is

#	[ -z "$ident" ] && die "$ident is null"

#	echo "$ident" | grep '[^[:alnum:]_]' && die "Bad name : $ident"

#	if echo "$idents" | grep -w "$ident" > /dev/null; then
#		die "stage-definitions :: error compiling stage $ident :
#		name clash with a stage name already defined"
#	fi
	
#	[ -z "$idents" ] && idents=$ident || idents="$idents $ident"

#	stage=`expr $stage + 1`
#	eval $ident=$stage
##</mustnotchange>

##<maychange>
#	#the last line must be copied and optionally altered as a 
#	#colon-separated list of packages

#	eval list_${ident}=""
##</maychange>
#}

{
	#stage definition for pre_x :
	ident=pre_x

	[ -z "$ident" ] && die "$ident is null"

	echo "$ident" | grep '[^[:alnum:]_]' && die "Bad name : $ident"

	if echo "$idents" | grep -w "$ident" > /dev/null; then
		die "stage-definitions :: error compiling stage $ident :
		name clash with a stage name already defined"
	fi

	[ -z "$idents" ] && idents=$ident || idents="$idents $ident"
	stage=`expr $stage + 1`
	eval $ident=$stage

	eval list_${ident}=""
}

{
	#stage definition for x
	ident=x

	[ -z "$ident" ] && die "$ident is null"

	echo "$ident" | grep '[^[:alnum:]_]' && die "Bad name : $ident"

	if echo "$idents" | grep -w "$ident" > /dev/null; then
		die "stage-definitions :: error compiling stage $ident :
		name clash with a stage name already defined"
	fi

	[ -z "$idents" ] && idents=$ident || idents="$idents $ident"
	stage=`expr $stage + 1`
	eval $ident=$stage

	eval list_${ident}="xorg"
}

{
	#stage definition for post_x
	ident=post_x

	[ -z "$ident" ] && die "$ident is null"

	echo "$ident" | grep '[^[:alnum:]_]' && die "Bad name : $ident"

	if echo "$idents" | grep -w "$ident" > /dev/null; then
		die "stage-definitions :: error compiling stage $ident :
		name clash with a stage name already defined"
	fi

	[ -z "$idents" ] && idents=$ident || idents="$idents $ident"
	stage=`expr $stage + 1`
	eval $ident=$stage

	eval list_${ident}=""
}

{
	#stage definition for desktop
	ident=desktop

	[ -z "$ident" ] && die "$ident is null"

	echo "$ident" | grep '[^[:alnum:]_]' && die "Bad name : $ident"

	if echo "$idents" | grep -w "$ident" > /dev/null; then
		die "stage-definitions :: error compiling stage $ident :
		name clash with a stage name already defined"
	fi

	[ -z "$idents" ] && idents=$ident || idents="$idents $ident"
	stage=`expr $stage + 1`
	eval $ident=$stage

	eval list_${ident}="kde-baseapps-kde4:kde-runtime-kde4:kde-workspace-kde4:kdelibs-kde4"
}

{
	#stage definition for post_desktop
	ident=post_desktop

	[ -z "$ident" ] && die "$ident is null"

	echo "$ident" | grep '[^[:alnum:]_]' && die "Bad name : $ident"

	if echo "$idents" | grep -w "$ident" > /dev/null; then
		die "stage-definitions :: error compiling stage $ident :
		name clash with a stage name already defined"
	fi

	[ -z "$idents" ] && idents=$ident || idents="$idents $ident"
	stage=`expr $stage + 1`
	eval $ident=$stage

	eval list_${ident}=""
}
