mirror of
https://github.com/systemd/systemd
synced 2024-07-22 02:34:54 +00:00
systemd-mount: support unmounting devices on remote host
The commit 9017f5d88d
prohibits
to unmount devices on remote host. This makes reenable such feature.
This commit is contained in:
parent
f0aac575fc
commit
3747daa2e5
|
@ -260,8 +260,8 @@
|
|||
which can be mount points, devices, <filename>/etc/fstab</filename> style node names, or backing files
|
||||
corresponding to loop devices, like
|
||||
<command>systemd-mount --umount /path/to/umount /dev/sda1 UUID=xxxxxx-xxxx LABEL=xxxxx /path/to/disk.img</command>.
|
||||
</para>
|
||||
</listitem>
|
||||
Note that when <option>-H</option> or <option>-M</option> is specified, only absolute paths to mount points are
|
||||
supported.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<xi:include href="user-system-options.xml" xpointer="user" />
|
||||
|
|
|
@ -311,8 +311,13 @@ static int parse_argv(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
if (arg_transport != BUS_TRANSPORT_LOCAL) {
|
||||
log_error("Unmounting devices only supported locally.");
|
||||
return -EOPNOTSUPP;
|
||||
int i;
|
||||
|
||||
for (i = optind; i < argc; i++)
|
||||
if (!path_is_absolute(argv[i]) ) {
|
||||
log_error("Only absolute path is supported: %s", argv[i]);
|
||||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (optind >= argc) {
|
||||
|
@ -918,6 +923,23 @@ static int action_umount(
|
|||
|
||||
int i, r, r2 = 0;
|
||||
|
||||
if (arg_transport != BUS_TRANSPORT_LOCAL) {
|
||||
for (i = optind; i < argc; i++) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
p = strdup(argv[i]);
|
||||
if (!p)
|
||||
return log_oom();
|
||||
|
||||
path_kill_slashes(p);
|
||||
|
||||
r = stop_mounts(bus, p);
|
||||
if (r < 0)
|
||||
r2 = r;
|
||||
}
|
||||
return r2;
|
||||
}
|
||||
|
||||
for (i = optind; i < argc; i++) {
|
||||
_cleanup_free_ char *u = NULL, *p = NULL;
|
||||
struct stat st;
|
||||
|
|
Loading…
Reference in a new issue