+3
-3
README.md
+3
-3
README.md
···
68
68
| `-c, --cpu <type>` | CPU type to emulate | `host` |
69
69
| `-C, --cpus <number>` | Number of CPU cores | `2` |
70
70
| `-m, --memory <size>` | RAM allocation | `2G` |
71
-
| `-d, --drive <path>` | Path to virtual disk image | None |
71
+
| `-i, --image <path>` | Path to virtual disk image | None |
72
72
| `--disk-format <format>` | Disk format (qcow2, raw, etc.) | `raw` |
73
73
| `--size <size>` | Size of the VM disk image to create if it does not exist | `20G` |
74
74
| `-b, --bridge <name>` | Name of the network bridge to use for networking (e.g., br0) | None |
···
143
143
144
144
```bash
145
145
# Automatically create a 50GB disk if it doesn't exist
146
-
openindiana-up --drive my-disk.qcow2 --disk-format qcow2 --size 50G
146
+
openindiana-up --image my-disk.qcow2 --disk-format qcow2 --size 50G
147
147
```
148
148
149
149
## 🖥️ Console Setup
···
170
170
- **Memory**: 2GB RAM (configurable with `--memory`)
171
171
- **Cores**: 2 virtual CPUs (configurable with `--cpus`)
172
172
- **Storage**: ISO-only by default; optional persistent disk (configurable with
173
-
`--drive`)
173
+
`--image`)
174
174
- **Network**: User mode networking with SSH forwarding
175
175
- **Console**: Enhanced serial console via stdio with proper signal handling
176
176
- **Default Version**: OpenIndiana 20251026 (when no arguments provided)
+5
-5
main.ts
+5
-5
main.ts
···
34
34
.option("-m, --memory <size:string>", "Amount of memory for the VM", {
35
35
default: "2G",
36
36
})
37
-
.option("-d, --drive <path:string>", "Path to VM disk image")
37
+
.option("-i, --image <path:string>", "Path to VM disk image")
38
38
.option(
39
39
"--disk-format <format:string>",
40
40
"Disk image format (e.g., qcow2, raw)",
···
104
104
isoPath = await downloadIso(resolvedInput, options);
105
105
}
106
106
107
-
if (options.drive) {
107
+
if (options.image) {
108
108
await createDriveImageIfNeeded(options);
109
109
}
110
110
111
-
if (!input && options.drive && !await emptyDiskImage(options.drive)) {
111
+
if (!input && options.image && !await emptyDiskImage(options.image)) {
112
112
isoPath = null;
113
113
}
114
114
···
120
120
})
121
121
.command("ps", "List all virtual machines")
122
122
.option("--all, -a", "Show all virtual machines, including stopped ones")
123
-
.action(async (options: { all: boolean }) => {
124
-
await ps(options.all);
123
+
.action(async (options: { all?: unknown }) => {
124
+
await ps(Boolean(options.all));
125
125
})
126
126
.command("start", "Start a virtual machine")
127
127
.arguments("<vm-name:string>")
+8
-8
src/utils.ts
+8
-8
src/utils.ts
···
12
12
cpu: string;
13
13
cpus: number;
14
14
memory: string;
15
-
drive?: string;
15
+
image?: string;
16
16
diskFormat: string;
17
17
size: string;
18
18
bridge?: string;
···
47
47
const filename = url.split("/").pop()!;
48
48
const outputPath = options.output ?? filename;
49
49
50
-
if (options.drive && await Deno.stat(options.drive).catch(() => false)) {
51
-
const driveSize = await du(options.drive);
50
+
if (options.image && await Deno.stat(options.image).catch(() => false)) {
51
+
const driveSize = await du(options.image);
52
52
if (driveSize > 10) {
53
53
console.log(
54
54
chalk.yellowBright(
55
-
`Drive image ${options.drive} is not empty (size: ${driveSize} KB), skipping ISO download to avoid overwriting existing data.`,
55
+
`Drive image ${options.image} is not empty (size: ${driveSize} KB), skipping ISO download to avoid overwriting existing data.`,
56
56
),
57
57
);
58
58
return null;
···
119
119
"-serial",
120
120
"chardev:con0",
121
121
..._.compact(
122
-
options.drive && [
122
+
options.image && [
123
123
"-drive",
124
-
`file=${options.drive},format=${options.diskFormat},if=virtio`,
124
+
`file=${options.image},format=${options.diskFormat},if=virtio`,
125
125
],
126
126
),
127
127
],
···
141
141
diskSize: options.size,
142
142
diskFormat: options.diskFormat,
143
143
isoPath: isoPath ? Deno.realPathSync(isoPath) : undefined,
144
-
drivePath: options.drive ? Deno.realPathSync(options.drive) : undefined,
144
+
drivePath: options.image ? Deno.realPathSync(options.image) : undefined,
145
145
version: DEFAULT_VERSION,
146
146
status: "RUNNING",
147
147
pid: cmd.pid,
···
178
178
179
179
export async function createDriveImageIfNeeded(
180
180
{
181
-
drive: path,
181
+
image: path,
182
182
diskFormat: format,
183
183
size,
184
184
}: Options,