Files
warewulf/overlays/ignition/rootfs/etc/systemd/system/ww4-mounts.ww
Christian Goll bd485817c1 Require ignition for mount and not only after
Signed-off-by: Christian Goll <cgoll@suse.com>
2025-02-21 22:27:40 -07:00

37 lines
1.1 KiB
Plaintext

{{- range $fsdevice,$fs := .FileSystems }}
{{- $prefix := replace "-" "\\x2d" $fs.Path }}
{{- $prefix = replace "/" "-" $prefix }}
{{- $prefix = substr 1 -1 $prefix }}
{{ $suffix := "mount"}}
{{- if $fs.Label }}{{ $prefix = $fs.Label }}{{ end }}
{{- if eq $fs.Format "swap" }}{{ $prefix = replace "/dev/disk/by-partlabel/" "dev-disk-by\\x2dpartlabel-" $fsdevice }}{{ $suffix = "swap" }}{{ end }}
{{ file (print $prefix "." $suffix) }}
# This file is autogenerated by warewulf
{{- if eq $fs.Format "swap"}}
[Unit]
ConditionPathExists=/warewulf/ignition.json
Requires=ignition-ww4-disks.service
After=ignition-ww4-disks.service
Before=swap.target
[Swap]
What={{ $fsdevice }}
[Install]
RequiredBy=swap.target
{{- else }}
[Unit]
ConditionPathExists=/warewulf/ignition.json
Before=local-fs.target
Requires=ignition-ww4-disks.service
After=ignition-ww4-disks.service
[Mount]
Where={{ $fs.Path }}
What={{ $fsdevice }}
Type={{ $fs.Format }}
{{- if $fs.MountOptions }}
Options={{range $index,$opt := $fs.MountOptions }}{{if $index }},{{ end }}{{ $opt }}{{ end }}
{{- end }}
[Install]
RequiredBy=local-fs.target
{{- end }}
{{- end }}