The ConditionPathExists
works perfectly, but you need to adapt the path to your Where=
statement.
For example:
Your want to mount something to /media/fritzbox
, your add to the mount file Where=/media/fritzbox
. You would need to add to the automount file Where=/media/fritzbox
and in the Unit section ConditionPathExists=/media/fritzbox
.
Hence, all you can do is avoid dashes in the folder names under all circumstances.
No, dashes work. For example
$ cat 'media-Fritz\x2dbox.mount'
...
Where=/media/Fritz-box
...
If you received an error, either your Where statement is wrong, or you named your mount unit not correctly.
Btw., /run/media should not be used for a permanent mount, with a mount unit or a fstab entry. It should only be used for temporary mounts, like a USB stick or if you want temporary mount a partition via a file manager.