From: Daan De Meyer Date: Thu, 14 Dec 2023 08:44:11 +0000 (+0100) Subject: Set $ARCHITECTURE when running scripts X-Git-Tag: v20~67^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c415f7872597ae0397e0374679990bd49b03e61b;p=thirdparty%2Fmkosi.git Set $ARCHITECTURE when running scripts --- diff --git a/mkosi/__init__.py b/mkosi/__init__.py index b5750bcd4..6792ca715 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -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", diff --git a/mkosi/resources/mkosi.md b/mkosi/resources/mkosi.md index b9dcdab75..2c8dd3e03 100644 --- a/mkosi/resources/mkosi.md +++ b/mkosi/resources/mkosi.md @@ -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