details.</para>
<xi:include href="version-info.xml" xpointer="v256"/></listitem>
+
+ <listitem><para>An <varname>X_SYSTEMD_SHUTDOWN=…</varname> message will be sent out very shortly before
+ the system shuts down. The value is one of the strings <literal>reboot</literal>,
+ <literal>halt</literal>, <literal>poweroff</literal>, <literal>kexec</literal> and indicates which kind
+ of shutdown is being executed.</para>
+
+ <xi:include href="version-info.xml" xpointer="v256"/></listitem>
+
+ <listitem><para>An <varname>X_SYSTEMD_REBOOT_PARAMETER=…</varname> message will also be sent out very
+ shortly before the system shuts down. Its value is the reboot argument as configured with
+ <command>systemctl --reboot-argument=…</command>.</para>
+
+ <xi:include href="version-info.xml" xpointer="v256"/></listitem>
</itemizedlist>
<para>Note that these extension fields are sent in addition to the regular <literal>READY=1</literal> and
}
}
+static void notify_supervisor(void) {
+ /* Notify VMM/container manager of the desired mode of reboot and the boot parameter */
+ _cleanup_free_ char *reboot_parameter = NULL;
+ int r;
+
+ r = read_reboot_parameter(&reboot_parameter);
+ if (r < 0 && r != -ENOENT)
+ log_debug_errno(r, "Failed to read reboot parameter, ignoring: %m");
+
+ if (reboot_parameter)
+ (void) sd_notifyf(/* unset_environment= */ false,
+ "X_SYSTEMD_SHUTDOWN=%s\n"
+ "X_SYSTEMD_REBOOT_PARAMETER=%s",
+ arg_verb, reboot_parameter);
+ else
+ (void) sd_notifyf(/* unset_environment= */ false,
+ "X_SYSTEMD_SHUTDOWN=%s",
+ arg_verb);
+}
+
int main(int argc, char *argv[]) {
static const char* const dirs[] = {
SYSTEM_SHUTDOWN_PATH,
if (!in_container)
sync_with_progress();
+ notify_supervisor();
+
if (streq(arg_verb, "exit")) {
if (in_container) {
log_info("Exiting container.");