On Mo, 10.08.20 19:46, Böszörményi Zoltán (zbos...@pr.hu) wrote:

> Is there a way to describe optional mounts via such Conditions* options?

No.

.mount units automatically gain dependencies on the devices they are
mounted from. Only after all dependencies are fulfilled (i.e. the
backing device showed up) the mount is executed, and as first step of
that the conditions are checked, i.e. much too late for your case.

My recommendation to you: write a generator, see
systemd.generator(7) for details. The existing
systemd-gpt-auto-generator(8) does pretty much what you want to do
already, maybe use that as inspiration. It only supports GPT disk
images however, and it auto-detects /var/ partitions only since v245.

Generators run very very early at boot and generate units and
dependencies. this is where you should genreate your var.mount
depending on the partition table. But note you have to implement that
very carefuly, and do raw disk accesses, since udev and such is not
running that early, nor do you even have the guarantee the kernel
itself noticed your extra partition or not yet. The only guarantee you
get is that the root partition was already found, everything else
might happen concurrently.

Lennart

--
Lennart Poettering, Berlin
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to