vagrant_utm 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/docs/commands.md +2 -2
- data/docs/configuration.md +2 -0
- data/docs/index.md +1 -0
- data/lib/vagrant_utm/action/boot.rb +27 -2
- data/lib/vagrant_utm/config.rb +14 -0
- data/lib/vagrant_utm/driver/meta.rb +2 -1
- data/lib/vagrant_utm/driver/version_5_0.rb +18 -0
- data/lib/vagrant_utm/scripts/add_folder_share.applescript +2 -2
- data/lib/vagrant_utm/scripts/add_port_forwards.applescript +13 -13
- data/lib/vagrant_utm/scripts/customize_vm.applescript +8 -0
- data/lib/vagrant_utm/scripts/read_forwarded_ports.applescript +5 -4
- data/lib/vagrant_utm/version.rb +1 -1
- data/lib/vagrant_utm.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e9244b20397925333750f59097f53ae24d91d577a2b576bb9708575900e6322
|
|
4
|
+
data.tar.gz: 661fdde402f8e5524c615ca564f2e2996ba802faae4e9def172c3cc40ad4b675
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 443831d9674fa2256109ecae5d40bbd6e25034e6226287188238e2659d7b8e9ba6628b5bf26bbfed4e16e06000724b8008f39c099c5a4b018aaba2715fd00728
|
|
7
|
+
data.tar.gz: 21a86fd8e831745d6cac5b48d3b7d582e033be905afc1de4b1206984d8a9a9c6e8020ecd428c6a2dda11628d0ac4880ed44b6821ad144ac7321eebfb42343bc9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [0.1.6] - 2026-08-14
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- Driver: Add support for UTM 5.0.x
|
|
7
|
+
|
|
8
|
+
### Fixed
|
|
9
|
+
- Fix AppleScript line continuation character encoding issue on Japanese/Korean locales
|
|
10
|
+
- Allow shared folders with whitespace in the host path
|
|
11
|
+
|
|
12
|
+
## [0.1.5] - 2025-11-16
|
|
13
|
+
|
|
14
|
+
- Support vm icon
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
3
18
|
## [0.1.4] - 2025-10-11
|
|
4
19
|
|
|
5
20
|
- Driver: Add support for UTM 4.7.x
|
data/docs/commands.md
CHANGED
|
@@ -155,6 +155,6 @@ List all IP addresses associated with network interfaces on the guest.
|
|
|
155
155
|
|
|
156
156
|
`utmctl start --disposable`
|
|
157
157
|
|
|
158
|
-
Start virtual machine in disposable
|
|
158
|
+
Start virtual machine in disposable mode, which allows you to run a virtual machine without saving any persistent changes to the drive.
|
|
159
159
|
|
|
160
|
-
Read about Disposable mode in [UTM docs](https://docs.getutm.app/advanced/disposable/)
|
|
160
|
+
Read about Disposable mode in [UTM docs](https://docs.getutm.app/advanced/disposable/)
|
data/docs/configuration.md
CHANGED
|
@@ -45,6 +45,8 @@ Vagrant.configure("2") do |config|
|
|
|
45
45
|
u.cpus = 1
|
|
46
46
|
# Memory in MB
|
|
47
47
|
u.memory = 1024
|
|
48
|
+
# VM icon (Available icons https://github.com/utmapp/UTM/tree/main/Icons)
|
|
49
|
+
u.icon = "debian"
|
|
48
50
|
# Notes for UTM VM (Appears in UTM UI)
|
|
49
51
|
u.notes = "Vagrant: For testing plugin development"
|
|
50
52
|
# QEMU Directoy Share mode for the VM.
|
data/docs/index.md
CHANGED
|
@@ -24,6 +24,7 @@ allowing Vagrant to control and provision machines via UTM's API.
|
|
|
24
24
|
|
|
25
25
|
[UTM] is a free, full-featured system emulator and virtual machine host for iOS and macOS.
|
|
26
26
|
The UTM provider currently supports UTM versions
|
|
27
|
+
* 5.0.x
|
|
27
28
|
* 4.7.x
|
|
28
29
|
* 4.6.x
|
|
29
30
|
* 4.5.x (Obsolete, use plugin version 0.0.1)
|
|
@@ -9,10 +9,35 @@ module VagrantPlugins
|
|
|
9
9
|
@app = app
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
def call(env)
|
|
12
|
+
def call(env) # rubocop:disable Metrics/AbcSize
|
|
13
13
|
# Start up the VM and wait for it to boot.
|
|
14
14
|
env[:ui].info I18n.t("vagrant.actions.vm.boot.booting")
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
# Wait for AppleScript configuration changes to be fully saved
|
|
17
|
+
# before attempting to start the VM to avoid OSStatus error -609
|
|
18
|
+
# We retry the start command with exponential backoff if it fails
|
|
19
|
+
max_retries = 3
|
|
20
|
+
retry_count = 0
|
|
21
|
+
retry_delay = 1
|
|
22
|
+
|
|
23
|
+
max_retries.times do
|
|
24
|
+
env[:machine].provider.driver.start
|
|
25
|
+
break # Success, exit the loop
|
|
26
|
+
rescue VagrantPlugins::Utm::Errors::UtmctlError => e
|
|
27
|
+
# Only retry if it's an OSStatus error (configuration still being saved)
|
|
28
|
+
raise unless e.message.include?("OSStatus")
|
|
29
|
+
|
|
30
|
+
retry_count += 1
|
|
31
|
+
|
|
32
|
+
# If we've exhausted all retries, re-raise the error
|
|
33
|
+
raise if retry_count >= max_retries
|
|
34
|
+
|
|
35
|
+
message = "VM configuration may still be saving. Retrying in #{retry_delay} seconds... " \
|
|
36
|
+
"(#{retry_count}/#{max_retries})"
|
|
37
|
+
env[:ui].warn message
|
|
38
|
+
sleep retry_delay
|
|
39
|
+
retry_delay *= 2 # Exponential backoff: 1s, 2s, 4s
|
|
40
|
+
end
|
|
16
41
|
|
|
17
42
|
@app.call(env)
|
|
18
43
|
end
|
data/lib/vagrant_utm/config.rb
CHANGED
|
@@ -85,6 +85,20 @@ module VagrantPlugins
|
|
|
85
85
|
customize("pre-boot", ["customize_vm.applescript", :id, "--notes", notes])
|
|
86
86
|
end
|
|
87
87
|
|
|
88
|
+
# Shortcut for setting the icon of the virtual machine.
|
|
89
|
+
# Calls #customize internally.
|
|
90
|
+
#
|
|
91
|
+
# Available icons can be found at:
|
|
92
|
+
# https://github.com/utmapp/UTM/tree/main/Icons
|
|
93
|
+
#
|
|
94
|
+
# Common icons include: linux, ubuntu, debian, fedora, archlinux,
|
|
95
|
+
# openbsd, freebsd, windows, macos, android, etc.
|
|
96
|
+
#
|
|
97
|
+
# @param icon [String] the icon name for the VM (e.g., "ubuntu", "debian")
|
|
98
|
+
def icon=(icon)
|
|
99
|
+
customize("pre-boot", ["customize_vm.applescript", :id, "--icon", icon.to_s])
|
|
100
|
+
end
|
|
101
|
+
|
|
88
102
|
# TODO: All warning if user sets directory_share_mode,
|
|
89
103
|
# because default implementation is 'virtFS'
|
|
90
104
|
# Shortcut for setting the directory share mode of the virtual machine.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require File.expand_path("version_4_7", __dir__)
|
|
4
|
+
|
|
5
|
+
module VagrantPlugins
|
|
6
|
+
module Utm
|
|
7
|
+
module Driver
|
|
8
|
+
# Driver for UTM 5.0.x
|
|
9
|
+
class Version_5_0 < Version_4_7 # rubocop:disable Naming/ClassAndModuleCamelCase
|
|
10
|
+
def initialize(uuid)
|
|
11
|
+
super
|
|
12
|
+
|
|
13
|
+
@logger = Log4r::Logger.new("vagrant::provider::utm::version_5_0")
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
end
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
on createQemuArgsForDir(dirId, dirPath)
|
|
9
9
|
|
|
10
10
|
-- Prepare the QEMU argument strings
|
|
11
|
-
set fsdevArgStr to "-fsdev local,id=" & dirId & ",path=" & dirPath & ",security_model=mapped-xattr"
|
|
11
|
+
set fsdevArgStr to "-fsdev \"local,id=" & dirId & ",path=" & dirPath & ",security_model=mapped-xattr\""
|
|
12
12
|
set deviceArgStr to "-device virtio-9p-pci,fsdev=" & dirId & ",mount_tag=" & dirId
|
|
13
13
|
|
|
14
14
|
return {fsdevArgStr, deviceArgStr}
|
|
@@ -93,4 +93,4 @@ on run argv
|
|
|
93
93
|
-- Update registry of vm with new directory shares
|
|
94
94
|
update registry of vm with reg
|
|
95
95
|
end tell
|
|
96
|
-
end run
|
|
96
|
+
end run
|
|
@@ -25,11 +25,12 @@ on run argv
|
|
|
25
25
|
set ruleComponents to text items of ruleArg
|
|
26
26
|
|
|
27
27
|
-- Create a port forwarding rule record
|
|
28
|
-
set
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
set ruleProtocol to item 1 of ruleComponents
|
|
29
|
+
set ruleGuestAddress to item 2 of ruleComponents
|
|
30
|
+
set ruleGuestPort to item 3 of ruleComponents
|
|
31
|
+
set ruleHostAddress to item 4 of ruleComponents
|
|
32
|
+
set ruleHostPort to item 5 of ruleComponents
|
|
33
|
+
set portForwardRule to {indexVal:indexNumber, protocolVal:ruleProtocol, guestAddress:ruleGuestAddress, guestPort:ruleGuestPort, hostAddress:ruleHostAddress, hostPort:ruleHostPort}
|
|
33
34
|
|
|
34
35
|
-- Add the rule to the list
|
|
35
36
|
set end of portForwardRules to portForwardRule
|
|
@@ -49,13 +50,12 @@ on run argv
|
|
|
49
50
|
set portForwards to port forwards of anInterface
|
|
50
51
|
|
|
51
52
|
-- Create a new port forward configuration
|
|
52
|
-
set
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
53
|
+
set forwardProtocol to protocolVal of portForwardRule
|
|
54
|
+
set forwardGuestAddress to guestAddress of portForwardRule
|
|
55
|
+
set forwardGuestPort to guestPort of portForwardRule
|
|
56
|
+
set forwardHostAddress to hostAddress of portForwardRule
|
|
57
|
+
set forwardHostPort to hostPort of portForwardRule
|
|
58
|
+
set newPortForward to {protocol:forwardProtocol, guest address:forwardGuestAddress, guest port:forwardGuestPort, host address:forwardHostAddress, host port:forwardHostPort}
|
|
59
59
|
|
|
60
60
|
-- Add new port forward to the list
|
|
61
61
|
copy newPortForward to the end of portForwards
|
|
@@ -69,4 +69,4 @@ on run argv
|
|
|
69
69
|
-- Update the VM configuration
|
|
70
70
|
update configuration of vm with config
|
|
71
71
|
end tell
|
|
72
|
-
end run
|
|
72
|
+
end run
|
|
@@ -6,6 +6,7 @@ on run argv
|
|
|
6
6
|
set memorySize to 0
|
|
7
7
|
set vmNotes to ""
|
|
8
8
|
set directoryShareMode to null
|
|
9
|
+
set vmIcon to ""
|
|
9
10
|
|
|
10
11
|
-- Parse arguments
|
|
11
12
|
repeat with i from 2 to (count argv)
|
|
@@ -20,6 +21,8 @@ on run argv
|
|
|
20
21
|
set vmNotes to item (i + 1) of argv
|
|
21
22
|
else if currentArg is "--directory-share-mode" then
|
|
22
23
|
set directoryShareMode to item (i + 1) of argv
|
|
24
|
+
else if currentArg is "--icon" then
|
|
25
|
+
set vmIcon to item (i + 1) of argv
|
|
23
26
|
end if
|
|
24
27
|
end repeat
|
|
25
28
|
|
|
@@ -52,6 +55,11 @@ on run argv
|
|
|
52
55
|
set directory share mode of config to directoryShareMode -- mode is assumed to be enum value
|
|
53
56
|
end if
|
|
54
57
|
|
|
58
|
+
-- Set icon if provided
|
|
59
|
+
if vmIcon is not "" then
|
|
60
|
+
set icon of config to vmIcon
|
|
61
|
+
end if
|
|
62
|
+
|
|
55
63
|
-- Save the configuration
|
|
56
64
|
update configuration of vm with config
|
|
57
65
|
|
|
@@ -17,11 +17,12 @@ on run argv
|
|
|
17
17
|
set i to i + 1
|
|
18
18
|
# Log the port forward details Virtualbox style
|
|
19
19
|
# 'Forwarding(nicIndex)(ruleIndex)="protocol,guestAddress,guestPort,hostAddress,hostPort"'
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
set forwardingLine to "Forwarding(" & index of anInterface & ")(" & i & ")=\"" & protocol of aPortForward & ","
|
|
21
|
+
set forwardingLine to forwardingLine & guest address of aPortForward & "," & guest port of aPortForward & ","
|
|
22
|
+
set forwardingLine to forwardingLine & host address of aPortForward & "," & host port of aPortForward & "\""
|
|
23
|
+
log forwardingLine
|
|
23
24
|
end repeat
|
|
24
25
|
end if
|
|
25
26
|
end repeat
|
|
26
27
|
end tell
|
|
27
|
-
end run
|
|
28
|
+
end run
|
data/lib/vagrant_utm/version.rb
CHANGED
data/lib/vagrant_utm.rb
CHANGED
|
@@ -18,6 +18,7 @@ module VagrantPlugins
|
|
|
18
18
|
autoload :Version_4_5, lib_path.join("version_4_5") # rubocop:disable Naming/VariableNumber
|
|
19
19
|
autoload :Version_4_6, lib_path.join("version_4_6") # rubocop:disable Naming/VariableNumber
|
|
20
20
|
autoload :Version_4_7, lib_path.join("version_4_7") # rubocop:disable Naming/VariableNumber
|
|
21
|
+
autoload :Version_5_0, lib_path.join("version_5_0") # rubocop:disable Naming/VariableNumber
|
|
21
22
|
end
|
|
22
23
|
|
|
23
24
|
# Drop some autoloads for the model classes
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: vagrant_utm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Naveenraj M
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-08-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Vagrant UTM provider that allows you to manage UTM virtual machines.
|
|
14
14
|
email:
|
|
@@ -104,6 +104,7 @@ files:
|
|
|
104
104
|
- lib/vagrant_utm/driver/version_4_5.rb
|
|
105
105
|
- lib/vagrant_utm/driver/version_4_6.rb
|
|
106
106
|
- lib/vagrant_utm/driver/version_4_7.rb
|
|
107
|
+
- lib/vagrant_utm/driver/version_5_0.rb
|
|
107
108
|
- lib/vagrant_utm/errors.rb
|
|
108
109
|
- lib/vagrant_utm/model/forwarded_port.rb
|
|
109
110
|
- lib/vagrant_utm/model/list_result.rb
|