File apply_kiwi_profile of Package obs-service-apply_kiwi_profile
#!/bin/bash
set -eu
if [ "${BUILD_DIST+x}" != "x" ]; then
echo "Not running in an OBS build container"
exit 1
fi
BUILD_DATA="${BUILD_DIST/.dist/.data}"
. "${BUILD_DATA}"
if [ "${RECIPEFILE##*.}" != "kiwi" ]; then
echo "Recipe is not a kiwi file - exiting"
exit 0
fi
profile_string="BUILD_FLAVOR"
for arg in "$@"; do
[ "$#" -eq 1 ] && break
if [ "$1" = "--profile" ]; then
shift
profile_string="$1"
fi
shift
done
profile_string=${profile_string/BUILD_FLAVOR/${BUILD_FLAVOR}}
if [ -z "${profile_string}" ]; then
echo "Resulting string is empty, doing nothing"
exit 0
fi
echo "Setting profile to '${profile_string}'"
echo -e ":Macros\nBuildFlags: kiwiprofile:${profile_string}" >> ${BUILD_DIST}