Skip to content

Commit

Permalink
Merge pull request #1232 from zyga/feature/rauc-transaction-id
Browse files Browse the repository at this point in the history
Expose transaction ID to pre/post install handlers
  • Loading branch information
ejoerns committed Aug 29, 2023
2 parents 52dfd8e + feccf6d commit 9226f04
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,11 @@ variables.
``RAUC_UPDATE_SOURCE``
A deprecated alias for ``RAUC_BUNDLE_MOUNT_POINT``

``RAUC_TRANSACTION_ID``
A UUID of a particular installation. This is either generated by RAUC or
provided explicitly on command line or over the D-Bus :ref:`InstallBundle
<gdbus-method-de-pengutronix-rauc-Installer.InstallBundle>` method.

``RAUC_MOUNT_PREFIX``
Provides the path prefix that may be used for RAUC mount points

Expand Down
1 change: 1 addition & 0 deletions src/install.c
Original file line number Diff line number Diff line change
Expand Up @@ -1353,6 +1353,7 @@ gboolean do_install_bundle(RaucInstallArgs *args, GError **error)
}

handler_env = prepare_environment(bundle->mount_point, bundle->manifest, target_group);
handler_env = g_environ_setenv(handler_env, "RAUC_TRANSACTION_ID", args->transaction, TRUE);

if (r_context()->config->preinstall_handler) {
g_message("Starting pre install handler: %s", r_context()->config->preinstall_handler);
Expand Down
1 change: 1 addition & 0 deletions test/bin/postinstall.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh

[ "x$RAUC_CURRENT_BOOTNAME" != "xsystem0" ] && exit 1
[ "x$RAUC_TRANSACTION_ID" = "x" ] && exit 1

exit 0
1 change: 1 addition & 0 deletions test/bin/preinstall.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/sh

[ "x$RAUC_CURRENT_BOOTNAME" != "xsystem0" ] && exit 1
[ "x$RAUC_TRANSACTION_ID" = "x" ] && exit 1

exit 0

0 comments on commit 9226f04

Please sign in to comment.