2019-01-09 11:39:18 +01:00
|
|
|
#!/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
|
|
|
|
|
|
|
|
sed -i"" "s#%DISTURL%#${DISTURL}#g" "${RECIPEFILE}"
|
|
|
|
sed -i"" "s/%RELEASE%/${RELEASE}/g" "${RECIPEFILE}"
|
|
|
|
sed -i"" "s/%BUILDTIME%/$(date --utc +%FT%T.%NZ)/g" "${RECIPEFILE}"
|
2019-01-15 11:27:59 +01:00
|
|
|
|
|
|
|
[ -f /usr/lib/os-release ] && . /usr/lib/os-release
|
|
|
|
[ -f /etc/os-release ] && . /etc/os-release
|
|
|
|
|
|
|
|
sed -i"" "s/%OS_VERSION_ID%/${VERSION_ID}/g" "${RECIPEFILE}"
|
|
|
|
sed -i"" "s/%OS_PRETTY_NAME%/${PRETTY_NAME}/g" "${RECIPEFILE}"
|
|
|
|
|
|
|
|
# Special case for SLE X "SP 0", make sure it has .0
|
|
|
|
VERSION_ID_SP="${VERSION_ID}"
|
|
|
|
[[ "${VERSION_ID_SP%}" == *"."* ]] || VERSION_ID_SP="${VERSION_ID}.0"
|
|
|
|
|
|
|
|
sed -i"" "s/%OS_VERSION_ID_SP%/${VERSION_ID_SP}/g" "${RECIPEFILE}"
|