forked from pool/obs-service-kiwi_metainfo_helper
Fabian Vogt
8af2e23907
- Strip service prefix from the recipe name to work with enabled services in OBS OBS-URL: https://build.opensuse.org/request/show/800063 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-kiwi_metainfo_helper?expand=0&rev=7
35 lines
1011 B
Bash
35 lines
1011 B
Bash
#!/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}"
|
|
|
|
# The build script renames the recipe (to strip _service:foo:), but doesn't update .data
|
|
RECIPEFILE="${RECIPEFILE##*:}"
|
|
|
|
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}"
|
|
|
|
[ -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}"
|