Am 02.10.20 um 10:10 schrieb 'steve garret' via kiwi:
> Hello kiwi users,
>
> I do have an OEM image and I'd like to insert the build id (e.g. Build45.1)
> , name and version of the image into a file of the root file system, e.g.
> /etc/my-release.
> Name and version is not a problem, there are $kiwi_* variables.
>
>
> Is that possible from within
config.sh/images.sh/disk.sh ?
> Oneshot service at boot time? Where to look at?
> Maybe allready written somewhere?
If you are running your own OBS instance, then you can apply a patch
similar to this one to obs-build's build-recipe-kiwi:
--- a/build-recipe-kiwi
+++ b/build-recipe-kiwi
@@ -419,7 +419,7 @@ perform_image_build() {
# old kiwi, do a prepare and a create call
local prepare_call
echo "running kiwi prepare for $imgtype${profile:+, profile
$profile}..."
- prepare_call="cd $TOPDIR/SOURCES && rm -rf
$TOPDIR/KIWIROOT-$imgtype"
+ prepare_call="export RELEASE=$RELEASE; cd $TOPDIR/SOURCES && rm
-rf $TOPDIR/KIWIROOT-$imgtype"
prepare_call="$prepare_call && $kiwi_path --logfile terminal"
prepare_call="$prepare_call --prepare $TOPDIR/SOURCES"
prepare_call="$prepare_call --root $TOPDIR/KIWIROOT-$imgtype"
@@ -430,7 +430,7 @@ perform_image_build() {
mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype
echo "running kiwi create for $imgtype${profile:+, profile
$profile}..."
local create_call
- create_call="cd $TOPDIR/SOURCES"
+ create_call="export RELEASE=$RELEASE; cd $TOPDIR/SOURCES"
create_call="$create_call && $kiwi_path --logfile terminal"
create_call="$create_call --create $TOPDIR/KIWIROOT-$imgtype"
create_call="$create_call --type $imgtype"
@@ -444,7 +444,7 @@ perform_image_build() {
mkdir -p $BUILD_ROOT/$TOPDIR/KIWI-$imgtype
local build_call
echo "running kiwi system build for $imgtype${profile:+, profile
$profile}..."
- build_call="cd $TOPDIR/SOURCES && rm -rf $TOPDIR/KIWI-$imgtype"
+ build_call="export RELEASE=$RELEASE; cd $TOPDIR/SOURCES && rm
-rf $TOPDIR/KIWI-$imgtype"
build_call="$build_call && LANG=en_US.UTF-8 $kiwi_path --debug
$KIWI_MAIN_PARAMETERS"
test -n "$profile" && build_call="$build_call --profile $profile"
build_call="$build_call system build --description
$TOPDIR/SOURCES --target-dir $TOPDIR/KIWI-$imgtype"
and then just use "$RELEASE" on config.sh as you like.
The patch is probably a bit outdated, but you get the idea, just export
RELEASE in {prepare,create,build}_call.
--
Stefan Seyfried
"For a successful technology, reality must take precedence over
public relations, for nature cannot be fooled." -- Richard Feynman