save
This commit is contained in:
parent
c8b057e6a2
commit
54d4dfcb33
3 changed files with 68 additions and 8 deletions
|
|
@ -62,6 +62,10 @@ module VirtualMachine
|
|||
if options[:detached] == nil
|
||||
options[:detached] = false
|
||||
end
|
||||
|
||||
if options[:tpm] == nil
|
||||
options[:tpm] = false
|
||||
end
|
||||
end
|
||||
|
||||
def self.archive(options)
|
||||
|
|
@ -98,14 +102,16 @@ module VirtualMachine
|
|||
)
|
||||
end
|
||||
|
||||
# vm setup windows --arch arm64 --iso /Users/agurgul/Downloads/win.iso --tpm
|
||||
# vm setup windows --tpm --cdrom /Users/agurgul/Downloads/win.iso
|
||||
def self.setup(options)
|
||||
fill_defaults(options)
|
||||
|
||||
url = distro(options[:name], options[:arch], :install)
|
||||
disk_img_path = root_img_path(options)
|
||||
# puts options
|
||||
# exit -1
|
||||
|
||||
Downloader.get(url) do |path|
|
||||
|
||||
get_cdrom_image(options) do |path|
|
||||
disk_img_path = root_img_path(options)
|
||||
create_disk_image(disk_img_path, 64000)
|
||||
|
||||
Qemu.launch(
|
||||
|
|
@ -114,11 +120,23 @@ module VirtualMachine
|
|||
cpus: [1, System.cpus - 2].max,
|
||||
cdrom: path,
|
||||
detach: options[:detached],
|
||||
display: DisplayMode.window
|
||||
display: DisplayMode.window,
|
||||
tpm: options[:tpm]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
def self.get_cdrom_image(options)
|
||||
if options[:cdrom] == nil
|
||||
url = distro(options[:name], options[:arch], :install)
|
||||
Downloader.get(url) do |path|
|
||||
yield path
|
||||
end
|
||||
else
|
||||
yield options[:cdrom]
|
||||
end
|
||||
end
|
||||
|
||||
# size in MB
|
||||
# lsof /Users/artur/.cache/dat/vm/debian/arm64/debian/root.img
|
||||
def self.create_disk_image(path, size)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue