Justin Vreeland 794355
#!/bin/sh
Justin Vreeland 794355
Justin Vreeland 794355
# Adjusts the configuration options to build the variants correctly
Justin Vreeland 794355
bde051
test -n "$RHTEST" && exit 0
Justin Vreeland 794355
bde051
DEBUGBUILDSENABLED=$1
bde051
if [ -z "$DEBUGBUILDSENABLED" ]; then
Justin Vreeland 794355
	exit 1
Justin Vreeland 794355
fi
Justin Vreeland 794355
bde051
if [ -z "$FLAVOR" ]; then
bde051
	FLAVOR=rhel
Justin Vreeland 794355
fi
Justin Vreeland 794355
bde051
if [ "$FLAVOR" = "fedora" ]; then
Justin Vreeland 794355
	SECONDARY=rhel
Justin Vreeland 794355
else
Justin Vreeland 794355
	SECONDARY=fedora
Justin Vreeland 794355
fi
Justin Vreeland 794355
73e442
# The +1 is to remove the - at the end of the SPECPACKAGE_NAME string
73e442
specpackage_name_len=$((${#SPECPACKAGE_NAME} + 1))
73e442
for i in "${SPECPACKAGE_NAME}"*-"$FLAVOR".config; do
73e442
	# shellcheck disable=SC3057
73e442
	NEW=${SPECPACKAGE_NAME}-"$SPECRPMVERSION"-$(echo "${i:$specpackage_name_len}" | sed s/-"$FLAVOR"//)
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
73e442
	for i in "${SPECPACKAGE_NAME}"-*debug*.config; do
Justin Vreeland 794355
		base=$(echo "$i" | sed -r s/-?debug//g)
73e442
		NEW=${SPECPACKAGE_NAME}-$(echo "$base" | cut -d - -f2-)
Justin Vreeland 794355
		mv "$i" "$NEW"
Justin Vreeland 794355
	done
Justin Vreeland 794355
fi