From 8877cebf8707d77bec14f8b43721a81bb2cb015c Mon Sep 17 00:00:00 2001 From: John Hanks Date: Wed, 28 Feb 2024 06:23:56 -0600 Subject: [PATCH] Swapping replace from sprig for our tr in overlays. --- .../rootfs/etc/systemd/system/ww4-disks.target.ww | 10 +++++----- .../wwinit/rootfs/etc/systemd/system/ww4-mounts.ww | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/overlays/wwinit/rootfs/etc/systemd/system/ww4-disks.target.ww b/overlays/wwinit/rootfs/etc/systemd/system/ww4-disks.target.ww index a2cc693b..314fa37f 100644 --- a/overlays/wwinit/rootfs/etc/systemd/system/ww4-disks.target.ww +++ b/overlays/wwinit/rootfs/etc/systemd/system/ww4-disks.target.ww @@ -11,15 +11,15 @@ Requisite=ignition-ww4-disks.service # Get the mounts {{- range $fsdevice,$fs := .FileSystems }} {{- $prefix := $fsdevice }} -{{- $prefix = tr $fsdevice "-" "\\x2d" }} -{{- $prefix = tr $prefix "/" "-" }} +{{- $prefix = replace "-" "\\x2d" $fsdevice }} +{{- $prefix = replace "/" "-" $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"}} +{{- $prefix = replace "/dev/disk/by-partlabel/" "dev-disk-by\\x2dpartlabel-"}}{{ $fsdevice $suffix = "swap"}} {{- else }} {{- if ne $fs.Path "" }} -{{- $prefix = tr $fs.Path "-" "\\x2d" }} -{{- $prefix = tr $prefix "/" "-" }} +{{- $prefix = replace "-" "\\x2d" $fs.Path }} +{{- $prefix = replace "/" "-" $prefix }} {{- $prefix = slice $prefix 1 }} {{- end }} {{- end }} diff --git a/overlays/wwinit/rootfs/etc/systemd/system/ww4-mounts.ww b/overlays/wwinit/rootfs/etc/systemd/system/ww4-mounts.ww index 1f47a8e2..c2a96d55 100644 --- a/overlays/wwinit/rootfs/etc/systemd/system/ww4-mounts.ww +++ b/overlays/wwinit/rootfs/etc/systemd/system/ww4-mounts.ww @@ -2,12 +2,12 @@ {{- $time := .BuildTime }} {{- $source := .BuildSource }} {{- range $fsdevice,$fs := .FileSystems }} -{{- $prefix := tr $fs.Path "-" "\\x2d" }} -{{- $prefix = tr $prefix "/" "-" }} +{{- $prefix := replace "-" "\\x2d" $fs.Path }} +{{- $prefix = replace "/" "-" $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 }} +{{- if eq $fs.Format "swap"}}{{ $prefix = replace "/dev/disk/by-partlabel/" "dev-disk-by\\x2dpartlabel-"}}{{ $fsdevice $suffix = "swap"}}{{ end }} {{- $filename := print $prefix "." $suffix }} {{- file $filename }} # This file is autogenerated by warewulf