]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Rename $SCRIPT to $CHROOT_SCRIPT
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 25 Sep 2023 07:48:09 +0000 (09:48 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 25 Sep 2023 07:48:09 +0000 (09:48 +0200)
This refers to a path in the chroot so let's make sure the naming
is consistent. We keep the old name as well for now to keep backwards
compat.

NEWS.md
mkosi/__init__.py
mkosi/resources/mkosi.md

diff --git a/NEWS.md b/NEWS.md
index e93431d225ddeeda40a43415d244795dcb860766..a5b40c9d4954df546645da9c9cd79ea2fb6e4be9 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,5 +1,10 @@
 # mkosi Changelog
 
+## v18
+
+- `$SCRIPT` was renamed in favor of `$CHROOT_SCRIPT`. `$SCRIPT` can
+  still be used but is considered deprecated.
+
 ## v17.1
 
 - Fixed bug where `--autologin` was broken when used in combination with
index 1289e5ac87f86567fe0b2ed611f13e8a4a622a8e..ebbabf111db64e924b58a8924580c2c8cba459de 100644 (file)
@@ -261,6 +261,7 @@ def run_prepare_script(state: MkosiState, build: bool) -> None:
 
     env = dict(
         SCRIPT="/work/prepare",
+        CHROOT_SCRIPT="/work/prepare",
         SRCDIR=str(Path.cwd()),
         CHROOT_SRCDIR="/work/src",
         BUILDROOT=str(state.root),
@@ -310,6 +311,7 @@ def run_build_script(state: MkosiState) -> None:
         WITH_TESTS=one_zero(state.config.with_tests),
         WITH_NETWORK=one_zero(state.config.with_network),
         SCRIPT="/work/build-script",
+        CHROOT_SCRIPT="/work/build-script",
         SRCDIR=str(Path.cwd()),
         CHROOT_SRCDIR="/work/src",
         DESTDIR=str(state.install_dir),
@@ -361,6 +363,7 @@ def run_postinst_script(state: MkosiState) -> None:
 
     env = dict(
         SCRIPT="/work/postinst",
+        CHROOT_SCRIPT="/work/postinst",
         SRCDIR=str(Path.cwd()),
         CHROOT_SRCDIR="/work/src",
         OUTPUTDIR=str(state.staging),
@@ -399,6 +402,7 @@ def run_finalize_script(state: MkosiState) -> None:
 
     env = dict(
         SCRIPT="/work/finalize",
+        CHROOT_SCRIPT="/work/finalize",
         SRCDIR=str(Path.cwd()),
         CHROOT_SRCDIR="/work/src",
         OUTPUTDIR=str(state.staging),
index 091c5f6cbfa5f798e8ae0fc8ada007f2089cb993..85092a4a6004ade7f873bed816ca59af0a52e6db 100644 (file)
@@ -1312,8 +1312,8 @@ supported:
 
 Scripts executed by mkosi receive the following environment variables:
 
-* `$SCRIPT` contains the path to the running script relative to the
-  image root directory. The primary usecase for this variable is in
+* `$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
   `mkosi-chroot` below for more information.
 
@@ -1369,20 +1369,21 @@ available via `$PATH` to simplify common usecases.
 * `mkosi-chroot`: This script will chroot into the image and execute the
   given command. On top of chrooting into the image, it will also mount
   various files and directories (`$SRCDIR`, `$DESTDIR`, `$BUILDDIR`,
-  `$OUTPUTDIR`, `$SCRIPT`) into the image and modify the corresponding
-  environment variables to point to the locations inside the image. It
-  will also mount APIVFS filesystems (`/proc`, `/dev`, ...) to make sure
-  scripts and tools executed inside the chroot work properly. It also
-  propagates `/etc/resolv.conf` from the host into the chroot if
-  requested so that DNS resolution works inside the chroot. After the
-  mkosi-chroot command exits, various mount points are cleaned up.
+  `$OUTPUTDIR`, `$CHROOT_SCRIPT`) into the image and modify the
+  corresponding environment variables to point to the locations inside
+  the image. It will also mount APIVFS filesystems (`/proc`, `/dev`,
+  ...) to make sure scripts and tools executed inside the chroot work
+  properly. It also propagates `/etc/resolv.conf` from the host into the
+  chroot if requested so that DNS resolution works inside the chroot.
+  After the mkosi-chroot command exits, various mount points are cleaned
+  up.
 
   To execute the entire script inside the image, put the following
   snippet at the start of the script:
 
   ```sh
   if [ "$container" != "mkosi" ]; then
-      exec mkosi-chroot "$SCRIPT" "$@"
+      exec mkosi-chroot "$CHROOT_SCRIPT" "$@"
   fi
   ```
 
@@ -1644,7 +1645,7 @@ $ cat >mkosi.build <<EOF
 #!/bin/sh
 
 if [ "$container" != "mkosi" ]; then
-    exec mkosi-chroot "$SCRIPT" "$@"
+    exec mkosi-chroot "$CHROOT_SCRIPT" "$@"
 fi
 
 cd $SRCDIR