pengqianheng / rpms / kernel

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