Skip to content

Commit 44ea4d1

Browse files
committed
Remove VMType check from the lima-init boot script
Do this when setting up the cidata instead, next to the decision on whether to use "cidata" dir or "cidata.iso". This means that this particular boot script is not depending on the driver, but can be used from all container drivers. Signed-off-by: Anders F Björklund <anders.f.bjorklund@gmail.com>
1 parent d1b3766 commit 44ea4d1

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

pkg/cidata/cidata.TEMPLATE.d/boot/02-wsl2-setup.sh renamed to pkg/cidata/cidata.TEMPLATE.d/boot/02-lima-init.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
# SPDX-License-Identifier: Apache-2.0
55

66
# This script replaces the cloud-init functionality of creating a user and setting its SSH keys
7-
# when using a WSL2 VM.
8-
[ "$LIMA_CIDATA_VMTYPE" = "wsl2" ] || exit 0
7+
[ "$LIMA_CIDATA_LIMA_INIT" = "1" ] || exit 0
98

109
# create user
1110
# shellcheck disable=SC2153

pkg/cidata/cidata.TEMPLATE.d/lima.env

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,8 @@ LIMA_CIDATA_PLAIN=1
5959
{{- else}}
6060
LIMA_CIDATA_PLAIN=
6161
{{- end}}
62+
{{- if .LimaInit}}
63+
LIMA_CIDATA_LIMA_INIT=1
64+
{{- else}}
65+
LIMA_CIDATA_LIMA_INIT=
66+
{{- end}}

pkg/cidata/cidata.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ func templateArgs(bootScripts bool, instDir, name string, instConfig *limayaml.L
142142
VirtioPort: virtioPort,
143143
Plain: *instConfig.Plain,
144144
TimeZone: *instConfig.TimeZone,
145+
LimaInit: *instConfig.VMType == limayaml.WSL2,
145146
Param: instConfig.Param,
146147
}
147148

pkg/cidata/template.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ type TemplateArgs struct {
105105
VirtioPort string
106106
Plain bool
107107
TimeZone string
108+
LimaInit bool
108109
}
109110

110111
func ValidateTemplateArgs(args *TemplateArgs) error {

0 commit comments

Comments
 (0)