]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Set DISTRIBUTION= and RELEASE= when invoking scripts
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 23 Feb 2024 15:27:50 +0000 (16:27 +0100)
committerJörg Behrmann <behrmann@physik.fu-berlin.de>
Fri, 23 Feb 2024 17:30:58 +0000 (18:30 +0100)
Until now once could simply source /etc/os-release to figure this
out but this is not possible in sync scripts, so add two new env
variables to expose the distribution and release config options.

mkosi/__init__.py

index e30e64e1d9101688744a9e97798449bc57514b29..74e20fe3009fc3efeb4fec7fa3bb50239c98c736 100644 (file)
@@ -417,6 +417,8 @@ def run_sync_scripts(context: Context) -> None:
         return
 
     env = dict(
+        DISTRIBUTION=str(context.config.distribution),
+        RELEASE=context.config.release,
         ARCHITECTURE=str(context.config.architecture),
         SRCDIR="/work/src",
         MKOSI_UID=str(INVOKING_USER.uid),
@@ -466,6 +468,8 @@ def run_prepare_scripts(context: Context, build: bool) -> None:
         return
 
     env = dict(
+        DISTRIBUTION=str(context.config.distribution),
+        RELEASE=context.config.release,
         ARCHITECTURE=str(context.config.architecture),
         BUILDROOT=str(context.root),
         SRCDIR="/work/src",
@@ -536,6 +540,8 @@ def run_build_scripts(context: Context) -> None:
         return
 
     env = dict(
+        DISTRIBUTION=str(context.config.distribution),
+        RELEASE=context.config.release,
         ARCHITECTURE=str(context.config.architecture),
         BUILDROOT=str(context.root),
         DESTDIR="/work/dest",
@@ -623,6 +629,8 @@ def run_postinst_scripts(context: Context) -> None:
         return
 
     env = dict(
+        DISTRIBUTION=str(context.config.distribution),
+        RELEASE=context.config.release,
         ARCHITECTURE=str(context.config.architecture),
         BUILDROOT=str(context.root),
         OUTPUTDIR="/work/out",
@@ -685,6 +693,8 @@ def run_finalize_scripts(context: Context) -> None:
         return
 
     env = dict(
+        DISTRIBUTION=str(context.config.distribution),
+        RELEASE=context.config.release,
         ARCHITECTURE=str(context.config.architecture),
         BUILDROOT=str(context.root),
         OUTPUTDIR="/work/out",