Skip to content

Commit 0a74ee7

Browse files
committed
boot scripts for wsl2
Signed-off-by: Ansuman Sahoo <[email protected]>
1 parent 85f3adf commit 0a74ee7

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

pkg/driver/wsl2/wsl_driver_windows.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package wsl2
55

66
import (
77
"context"
8+
"embed"
89
"fmt"
910
"net"
1011
"regexp"
@@ -159,8 +160,31 @@ func (l *LimaWslDriver) Validate(_ context.Context) error {
159160
return nil
160161
}
161162

163+
//go:embed boot/*.sh
164+
var bootFS embed.FS
165+
162166
func (l *LimaWslDriver) BootScripts() (map[string][]byte, error) {
163-
return map[string][]byte{}, nil
167+
scripts := make(map[string][]byte)
168+
169+
entries, err := bootFS.ReadDir("boot")
170+
if err != nil {
171+
return scripts, err
172+
}
173+
174+
for _, entry := range entries {
175+
if entry.IsDir() {
176+
continue
177+
}
178+
179+
content, err := bootFS.ReadFile("boot/" + entry.Name())
180+
if err != nil {
181+
return nil, err
182+
}
183+
184+
scripts[entry.Name()] = content
185+
}
186+
187+
return scripts, nil
164188
}
165189

166190
func (l *LimaWslDriver) InspectStatus(ctx context.Context, inst *limatype.Instance) string {

0 commit comments

Comments
 (0)