dissect: Set SYSTEMD_DISSECT_DEVICE to path of loop device
For some use cases we want to operate on the loop device that systemd-dissect has attached the loop device to, so let's make that easily accessible.
This commit is contained in:
@@ -235,7 +235,8 @@
|
||||
use <option>--read-only</option> to switch to read-only operation. The invoked process will have the
|
||||
<varname>$SYSTEMD_DISSECT_ROOT</varname> environment variable set, containing the absolute path name
|
||||
of the temporary mount point, i.e. the same directory that is set as the current working
|
||||
directory.</para></listitem>
|
||||
directory. It will also have the <varname>$SYSTEMD_DISSECT_DEVICE</varname> environment variable set,
|
||||
containing the absolute path name of the loop device the image was attached to.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
|
||||
@@ -1577,6 +1577,11 @@ static int action_with(DissectedImage *m, LoopDevice *d) {
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (setenv("SYSTEMD_DISSECT_DEVICE", d->node, /* overwrite= */ true) < 0) {
|
||||
log_error_errno(errno, "Failed to set $SYSTEMD_DISSECT_DEVICE: %m");
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (strv_isempty(arg_argv)) {
|
||||
const char *sh;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user