Dominique Leuenberger 2019-01-21 09:55:15 +00:00 committed by Git OBS Bridge
commit 5d1da8e54e
4 changed files with 30 additions and 5 deletions

12
README
View File

@ -4,8 +4,10 @@ obs-service-kiwi_metainfo_helper
This service can be enabled to run during buildtime, when it will edit the This service can be enabled to run during buildtime, when it will edit the
kiwi image description to replace placeholders with build-specific metainfo. kiwi image description to replace placeholders with build-specific metainfo.
| Placeholder| Value | Example | | Placeholder | Value | Example |
|------------|--------------------------------------------|-----------------------------------------------------------------------------------------------| |--------------------|--------------------------------------------|-----------------------------------------------------------------------------------------------|
| %DISTURL% | The OBS dist url | obs://build.suse.de/SUSE:SLE-15:Update:CR/images/2951b67133dd6384cacb28203174e030-sles15-image| | %DISTURL% | The OBS dist url | obs://build.suse.de/SUSE:SLE-15:Update:CR/images/2951b67133dd6384cacb28203174e030-sles15-image|
| %RELEASE% | The OBS release number (<cicnt\>.<bldcnt\>)| 4.2 | | %RELEASE% | The OBS release number (<cicnt\>.<bldcnt\>)| 4.2 |
| %BUILDTIME%| $(date --utc +%FT%T.%NZ) | 2018-10-30T09:19:02.074934628Z | | %BUILDTIME% | $(date --utc +%FT%T.%NZ) | 2018-10-30T09:19:02.074934628Z |
| %OS_VERSION_ID% | VERSION_ID in the os-release file | 15 |
| %OS_VERSION_ID_SP% | Like VERSION_ID, but with SP (SLE only) | 15.0 |

View File

@ -17,3 +17,15 @@ fi
sed -i"" "s#%DISTURL%#${DISTURL}#g" "${RECIPEFILE}" sed -i"" "s#%DISTURL%#${DISTURL}#g" "${RECIPEFILE}"
sed -i"" "s/%RELEASE%/${RELEASE}/g" "${RECIPEFILE}" sed -i"" "s/%RELEASE%/${RELEASE}/g" "${RECIPEFILE}"
sed -i"" "s/%BUILDTIME%/$(date --utc +%FT%T.%NZ)/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}"

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Jan 10 15:42:38 UTC 2019 - Fabian Vogt <fvogt@suse.com>
- Add %OS_VERSION_ID(_SP)% and %PRETTY_NAME% (boo#1119378)
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Jan 10 08:06:05 UTC 2019 - Fabian Vogt <fvogt@suse.com> Thu Jan 10 08:06:05 UTC 2019 - Fabian Vogt <fvogt@suse.com>

View File

@ -27,6 +27,12 @@ Source0: kiwi_metainfo_helper.service
Source1: kiwi_metainfo_helper Source1: kiwi_metainfo_helper
Source2: README Source2: README
Requires: sed Requires: sed
# For os-release
%if 0%{?is_opensuse}
Requires: openSUSE-release
%else
Requires: sles-release
%endif
BuildArch: noarch BuildArch: noarch
%description %description