Make mounting into sub-directoies work fixes #1073

This commit is contained in:
Dietmar Rieder
2024-02-07 17:02:02 +01:00
committed by Christian Goll
parent ea8e4680bc
commit f17ba7c62b
3 changed files with 14 additions and 3 deletions

View File

@@ -10,11 +10,18 @@ After=ignition-ww4-disks.service
Requisite=ignition-ww4-disks.service
# Get the mounts
{{- range $fsdevice,$fs := .FileSystems }}
{{- $prefix := $fsdevice }}{{ $suffix := "mount" }}
{{- $prefix := $fsdevice }}
{{- $prefix = tr $fsdevice "-" "\\x2d" }}
{{- $prefix = tr $prefix "/" "-" }}
{{- $prefix = slice $prefix 1 }}{{ $suffix := "mount" }}
{{- if eq $fs.Format "swap"}}
{{- $prefix = tr $fsdevice "/dev/disk/by-partlabel/" "dev-disk-by\\x2dpartlabel-"}}{{ $suffix = "swap"}}
{{- else }}
{{- if $fs.Path }}{{ $prefix = tr $fs.Path "/" "" }}{{ end }}
{{- if ne $fs.Path "" }}
{{- $prefix = tr $fs.Path "-" "\\x2d" }}
{{- $prefix = tr $prefix "/" "-" }}
{{- $prefix = slice $prefix 1 }}
{{- end }}
{{- end }}
Wants={{ print $prefix "." $suffix }}
{{- end }}

View File

@@ -2,7 +2,10 @@
{{- $time := .BuildTime }}
{{- $source := .BuildSource }}
{{- range $fsdevice,$fs := .FileSystems }}
{{- $prefix := tr $fs.Path "/" "" }}{{ $suffix:="mount"}}
{{- $prefix := tr $fs.Path "-" "\\x2d" }}
{{- $prefix = tr $prefix "/" "-" }}
{{- $prefix = slice $prefix 1 }}
{{ $suffix := "mount"}}
{{- if $fs.Label }}{{ $prefix = $fs.Label }}{{ end }}
{{- if eq $fs.Format "swap"}}{{ $prefix = tr $fsdevice "/dev/disk/by-partlabel/" "dev-disk-by\\x2dpartlabel-"}}{{ $suffix = "swap"}}{{ end }}
{{- $filename := print $prefix "." $suffix }}