Para o registro:
Is if possible to use a variable in the
What=
field of a systemd mount configuration file instead of an absolute path string?
Sim, é possível, por ex. (apenas testado com systemd v.238
):
mnt-data.mount
content:
[Unit]
Description=Mount System Backups Directory
[Mount]
What=${SOMEPATH}
Where=/mnt/data
Type=ext4
Options=defaults
se você correr
systemctl set-environment SOMEPATH=/dev/disk/by-label/DATA
e depois
systemctl start mnt-date.mount
ele montará /dev/disk/by-label/DATA
a /mnt/data
ou, por meio de um arquivo env:
mnt-data.mount
content:
[Unit]
Description=Mount System Backups Directory
[Mount]
EnvironmentFile=/path/to/env_file
What=${SOMEPATH}
Where=/mnt/data
Type=ext4
Options=defaults
/path/to/env_file
content:
SOMEPATH=/dev/disk/by-uuid/1b5a38ca-9f0d-4f1a-8fc1-7c418e79bf07
Isso pode não ajudar você a
find a way to use a custom kernel command-line bootparam, and mount a partition provided by that bootparam.
mas é definitivamente possível usar What=${SOMEVAR}
.