]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Set $ARCHITECTURE when running scripts
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 14 Dec 2023 08:44:11 +0000 (09:44 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 14 Dec 2023 09:07:49 +0000 (10:07 +0100)
mkosi/__init__.py
mkosi/resources/mkosi.md

index b5750bcd4fbe2b60188b2b313ac14c9aabdd83d6..6792ca7156c85666efa761d54394f26fd60fdea7 100644 (file)
@@ -426,6 +426,7 @@ def run_prepare_scripts(state: MkosiState, build: bool) -> None:
         return
 
     env = dict(
+        ARCHITECTURE=str(state.config.architecture),
         BUILDROOT=str(state.root),
         CHROOT_SCRIPT="/work/prepare",
         CHROOT_SRCDIR="/work/src",
@@ -486,6 +487,7 @@ def run_build_scripts(state: MkosiState) -> None:
         return
 
     env = dict(
+        ARCHITECTURE=str(state.config.architecture),
         BUILDROOT=str(state.root),
         CHROOT_DESTDIR="/work/dest",
         CHROOT_OUTPUTDIR="/work/out",
@@ -558,6 +560,7 @@ def run_postinst_scripts(state: MkosiState) -> None:
         return
 
     env = dict(
+        ARCHITECTURE=str(state.config.architecture),
         BUILDROOT=str(state.root),
         CHROOT_OUTPUTDIR="/work/out",
         CHROOT_SCRIPT="/work/postinst",
@@ -612,6 +615,7 @@ def run_finalize_scripts(state: MkosiState) -> None:
         return
 
     env = dict(
+        ARCHITECTURE=str(state.config.architecture),
         BUILDROOT=str(state.root),
         CHROOT_OUTPUTDIR="/work/out",
         CHROOT_SCRIPT="/work/finalize",
index b9dcdab752632ea6e6385937b6b0ff6b929c7bbf..2c8dd3e036bb62105bae27212874b7d28790ade2 100644 (file)
@@ -1693,6 +1693,11 @@ image and execute it as the post-installation script.
 
 Scripts executed by mkosi receive the following environment variables:
 
+* `$ARCHITECTURE` contains the architecture from the `Architecture=`
+  setting. If `Architecture=` is not set, it will contain the native
+  architecture of the host machine. See the documentation of
+  `Architecture=` for possible values for this variable.
+
 * `$CHROOT_SCRIPT` contains the path to the running script relative to
   the image root directory. The primary usecase for this variable is in
   combination with the `mkosi-chroot` script. See the description of