chengshan / rpms / kernel

Forked from rpms/kernel 2 years ago
Clone
Justin Vreeland 794355
#!/bin/sh
Justin Vreeland 794355
Justin Vreeland 794355
# Adjusts the configuration options to build the variants correctly
Justin Vreeland 794355
#
Justin Vreeland 794355
# arg1: configuration to go in the primary variant
Justin Vreeland 794355
# arg2: are we only generating debug configs
Justin Vreeland 794355
Justin Vreeland 794355
Justin Vreeland 794355
PRIMARY=$1
Justin Vreeland 794355
DEBUGBUILDSENABLED=$2
Justin Vreeland 794355
Justin Vreeland 794355
if [ -z "$2" ]; then
Justin Vreeland 794355
	exit 1
Justin Vreeland 794355
fi
Justin Vreeland 794355
Justin Vreeland 794355
if [ -z "$PRIMARY" ]; then
Justin Vreeland 794355
	PRIMARY=rhel
Justin Vreeland 794355
fi
Justin Vreeland 794355
Justin Vreeland 794355
if [ "$PRIMARY" = "fedora" ]; then
Justin Vreeland 794355
	SECONDARY=rhel
Justin Vreeland 794355
else
Justin Vreeland 794355
	SECONDARY=fedora
Justin Vreeland 794355
fi
Justin Vreeland 794355
Justin Vreeland 794355
for i in kernel-*-"$PRIMARY".config; do
Justin Vreeland 794355
	NEW=kernel-"$VERSION"-$(echo "$i" | cut -d - -f2- | sed s/-"$PRIMARY"//)
Justin Vreeland 794355
	#echo $NEW
Justin Vreeland 794355
	mv "$i" "$NEW"
Justin Vreeland 794355
done
Justin Vreeland 794355
Justin Vreeland 794355
rm -f kernel-*-"$SECONDARY".config
Justin Vreeland 794355
Justin Vreeland 794355
if [ "$DEBUGBUILDSENABLED" -eq 0 ]; then
Justin Vreeland 794355
	for i in kernel-*debug*.config; do
Justin Vreeland 794355
		base=$(echo "$i" | sed -r s/-?debug//g)
Justin Vreeland 794355
		NEW=kernel-$(echo "$base" | cut -d - -f2-)
Justin Vreeland 794355
		mv "$i" "$NEW"
Justin Vreeland 794355
	done
Justin Vreeland 794355
fi