Module: Bsdkrun::System
- Defined in:
- lib/bsdkrun/system.rb
Overview
Host-level toolchain / image operations.
Class Method Summary collapse
-
.fetch_image(os, version: nil, force: false) ⇒ String
Download + prepare a BSD image ahead of time.
-
.grow_disk(disk, size) ⇒ void
Grow a raw disk image (the guest expands its root FS on next boot).
-
.probe ⇒ Boolean
Sanity-check the toolchain: verify libkrun links and a context can be created/configured.
-
.versions(os) ⇒ Array<String>
List the builds available to fetch for a BSD, one version per line.
Class Method Details
.fetch_image(os, version: nil, force: false) ⇒ String
Download + prepare a BSD image ahead of time.
21 22 23 24 25 26 |
# File 'lib/bsdkrun/system.rb', line 21 def fetch_image(os, version: nil, force: false) args = ["fetch", "--os", os.to_s] args.push("--version", version.to_s) if version args << "--force" if force Process.run!(args, label: "bsdkrun fetch").stdout end |
.grow_disk(disk, size) ⇒ void
This method returns an undefined value.
Grow a raw disk image (the guest expands its root FS on next boot).
42 43 44 45 |
# File 'lib/bsdkrun/system.rb', line 42 def grow_disk(disk, size) Process.run!(["grow", "--disk", disk, "--size", size], label: "bsdkrun grow") nil end |
.probe ⇒ Boolean
Sanity-check the toolchain: verify libkrun links and a context can be created/configured. Does not boot.
11 12 13 |
# File 'lib/bsdkrun/system.rb', line 11 def probe Process.run(["probe"]).exit_code.zero? end |
.versions(os) ⇒ Array<String>
List the builds available to fetch for a BSD, one version per line.
32 33 34 35 |
# File 'lib/bsdkrun/system.rb', line 32 def versions(os) res = Process.run!(["versions", "--os", os.to_s], label: "bsdkrun versions") res.stdout.split("\n").map(&:strip).reject(&:empty?) end |