1
- From f97d2c5d7968e6172b9b542a78351854f8e983dd Mon Sep 17 00:00:00 2001
1
+ From cd7ce15a7838fb45e618f445a39599b1ac21c557 Mon Sep 17 00:00:00 2001
2
2
From: Arthur Sengileyev <
[email protected] >
3
3
Date: Wed, 22 Jan 2025 17:24:01 +0200
4
4
Subject: [PATCH] Add QEMU driver support on Windows hosts
13
13
contrib/bundle-wsl/wsllinks.ini | 2 ++
14
14
pkg/cidata/cidata.go | 11 ++++++++++-
15
15
pkg/hostagent/hostagent.go | 7 ++++++-
16
- pkg/hostagent/mount.go | 21 ++++++++++++++++++---
16
+ pkg/hostagent/mount.go | 23 ++ ++++++++++++++++++---
17
17
pkg/ioutilx/ioutilx.go | 3 ++-
18
18
pkg/iso9660util/iso9660util.go | 6 ------
19
19
pkg/osutil/user.go | 2 +-
20
20
pkg/qemu/qemu.go | 2 ++
21
21
pkg/sshutil/sshutil.go | 19 ++++++++++---------
22
22
templates/default.yaml | 2 +-
23
- 15 files changed, 83 insertions(+), 24 deletions(-)
23
+ 15 files changed, 85 insertions(+), 24 deletions(-)
24
24
create mode 100644 contrib/bundle-wsl/go-wsllinks.exe
25
25
create mode 100644 contrib/bundle-wsl/sftp-server.ini
26
26
create mode 100644 contrib/bundle-wsl/wsllinks.ini
27
27
28
28
diff --git a/Makefile b/Makefile
29
- index 71bea6e4..afde990b 100644
29
+ index 71bea6e4..3d77640f 100644
30
30
--- a/Makefile
31
31
+++ b/Makefile
32
32
@@ -551,6 +551,20 @@ artifacts-misc: | _artifacts
@@ -36,7 +36,7 @@ index 71bea6e4..afde990b 100644
36
36
+ .PHONY: add-bundles
37
37
+ add-bundles: add-bundle-wsl
38
38
+
39
- + add-bundle-wsl: _output/bin/bundle-wsl/wsllinks.ini _output/bin/bundle-wsl/sftp-server.ini _output/bin/bundle-wsl/cygpath.exe _output/bin/bundle-wsl/id.exe _output/bin/bundle-wsl/realpath.exe _output/bin/bundle-wsl/sftp-server.exe _output/bin/bundle-wsl/ssh.exe _output/bin/bundle-wsl/ssh-keygen.exe
39
+ + add-bundle-wsl: _output/bin/bundle-wsl/wsllinks.ini _output/bin/bundle-wsl/sftp-server.ini _output/bin/bundle-wsl/cygpath.exe _output/bin/bundle-wsl/id.exe _output/bin/bundle-wsl/realpath.exe _output/bin/bundle-wsl/sftp-server.exe _output/bin/bundle-wsl/ssh.exe _output/bin/bundle-wsl/ssh-keygen.exe _output/bin/bundle-wsl/gzip.exe
40
40
+
41
41
+
42
42
+ _output/bin/bundle-wsl/%.ini: contrib/bundle-wsl/%.ini | _output/bin/bundle-wsl
@@ -105,15 +105,15 @@ index 00000000..47d2814a
105
105
--- /dev/null
106
106
+++ b/contrib/bundle-wsl/sftp-server.ini
107
107
@@ -0,0 +1 @@
108
- + binary = /usr/lib/ssh/sftp-server
108
+ + binary = /usr/lib/ssh/sftp-server
109
109
diff --git a/contrib/bundle-wsl/wsllinks.ini b/contrib/bundle-wsl/wsllinks.ini
110
110
new file mode 100644
111
111
index 00000000..60b0c8e8
112
112
--- /dev/null
113
113
+++ b/contrib/bundle-wsl/wsllinks.ini
114
114
@@ -0,0 +1,2 @@
115
- + distro = lima-infra
116
- + user = lima
115
+ + distro = lima-infra
116
+ + user = lima
117
117
diff --git a/pkg/cidata/cidata.go b/pkg/cidata/cidata.go
118
118
index 2030a9a8..bdbca881 100644
119
119
--- a/pkg/cidata/cidata.go
@@ -179,21 +179,22 @@ index 396401a4..212f0c35 100644
179
179
180
180
if err := cidata.GenerateCloudConfig(inst.Dir, instName, inst.Config); err != nil {
181
181
diff --git a/pkg/hostagent/mount.go b/pkg/hostagent/mount.go
182
- index 646dc5d4..d7ef289f 100644
182
+ index 646dc5d4..9a59f25c 100644
183
183
--- a/pkg/hostagent/mount.go
184
184
+++ b/pkg/hostagent/mount.go
185
- @@ -4,7 +4,10 @@ import (
185
+ @@ -4,7 +4,11 @@ import (
186
186
"errors"
187
187
"fmt"
188
188
"os"
189
+ + "os/exec"
189
190
+ "path"
190
191
+ "runtime"
191
192
192
193
+ "github.com/lima-vm/lima/pkg/ioutilx"
193
194
"github.com/lima-vm/lima/pkg/limayaml"
194
195
"github.com/lima-vm/lima/pkg/localpathutil"
195
196
"github.com/lima-vm/sshocker/pkg/reversesshfs"
196
- @@ -36,13 +39 ,22 @@ func (a *HostAgent) setupMount(m limayaml.Mount) (*mount, error) {
197
+ @@ -36,13 +40 ,22 @@ func (a *HostAgent) setupMount(m limayaml.Mount) (*mount, error) {
197
198
if err != nil {
198
199
return nil, err
199
200
}
@@ -219,12 +220,13 @@ index 646dc5d4..d7ef289f 100644
219
220
}
220
221
// NOTE: allow_other requires "user_allow_other" in /etc/fuse.conf
221
222
sshfsOptions := "allow_other"
222
- @@ -64,6 +76,9 @@ func (a *HostAgent) setupMount(m limayaml.Mount) (*mount, error) {
223
+ @@ -64,6 +77,10 @@ func (a *HostAgent) setupMount(m limayaml.Mount) (*mount, error) {
223
224
Readonly: !(*m.Writable),
224
225
SSHFSAdditionalArgs: []string{"-o", sshfsOptions},
225
226
}
226
- + if runtime.GOOS == "windows" {
227
- + rsf.OpensshSftpServerBinary = "sftp-server" // using wrapper
227
+ + serverPath, err := exec.LookPath("sftp-server")
228
+ + if err == nil {
229
+ + rsf.OpensshSftpServerBinary = serverPath
228
230
+ }
229
231
if err := rsf.Prepare(); err != nil {
230
232
return nil, fmt.Errorf("failed to prepare reverse sshfs for %q on %q: %w", location, mountPoint, err)
0 commit comments