Adjust sfdisk --label gpt to only apply when wiping the disk
Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -181,7 +181,7 @@ if ! command -v sfdisk >/dev/null ; then
|
||||
info "warewulf: sfdisk not found, skipping partitioning"
|
||||
else :
|
||||
info "warewulf: sfdisk: partitioning /dev/sda"
|
||||
sfdisk --label gpt --wipe "auto" "/dev/sda" < "${PREFIX}/warewulf/sfdisk/device-0" || die "warewulf: sfdisk: failed to partition /dev/sda"
|
||||
sfdisk --wipe "auto" "/dev/sda" < "${PREFIX}/warewulf/sfdisk/device-0" || die "warewulf: sfdisk: failed to partition /dev/sda"
|
||||
|
||||
if command -v blockdev >/dev/null ; then
|
||||
info "warewulf: blockdev: re-reading partition table"
|
||||
@@ -238,7 +238,7 @@ if ! command -v sfdisk >/dev/null ; then
|
||||
info "warewulf: sfdisk not found, skipping partitioning"
|
||||
else :
|
||||
info "warewulf: sfdisk: partitioning /dev/sda"
|
||||
sfdisk --label gpt --wipe "auto" "/dev/sda" < "${PREFIX}/warewulf/sfdisk/device-0" || die "warewulf: sfdisk: failed to partition /dev/sda"
|
||||
sfdisk --wipe "auto" "/dev/sda" < "${PREFIX}/warewulf/sfdisk/device-0" || die "warewulf: sfdisk: failed to partition /dev/sda"
|
||||
|
||||
if command -v blockdev >/dev/null ; then
|
||||
info "warewulf: blockdev: re-reading partition table"
|
||||
|
||||
@@ -24,6 +24,7 @@ else :
|
||||
{{- $diskDict := dict "device" $disk.Id }}
|
||||
{{- if $disk.WipeTable }}
|
||||
{{- $_ := set $diskDict "wipe" "always" }}
|
||||
{{- $_ := set $diskDict "labelOption" "--label gpt" }}
|
||||
{{- end }}
|
||||
{{- $disks = append $disks $diskDict }}
|
||||
{{- end }}
|
||||
@@ -33,7 +34,7 @@ else :
|
||||
{{- range $i, $device := $disks }}
|
||||
{{- if $device.device }}
|
||||
info "warewulf: sfdisk: partitioning {{ $device.device }}"
|
||||
sfdisk --label gpt --wipe "{{ default "auto" $device.wipe }}" "{{ $device.device }}" < "${PREFIX}/warewulf/sfdisk/device-{{ $i }}" || die "warewulf: sfdisk: failed to partition {{ $device.device }}"
|
||||
sfdisk {{ default "" $device.labelOption }} --wipe "{{ default "auto" $device.wipe }}" "{{ $device.device }}" < "${PREFIX}/warewulf/sfdisk/device-{{ $i }}" || die "warewulf: sfdisk: failed to partition {{ $device.device }}"
|
||||
|
||||
if command -v blockdev >/dev/null ; then
|
||||
info "warewulf: blockdev: re-reading partition table"
|
||||
|
||||
Reference in New Issue
Block a user