update
This commit is contained in:
70
isobuild/mod.ts
Normal file
70
isobuild/mod.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* EcoOS ISO Builder
|
||||
*
|
||||
* CLI for building custom Ubuntu ISO with EcoOS daemon
|
||||
*/
|
||||
|
||||
import { build } from './ts/index.ts';
|
||||
|
||||
const command = Deno.args[0];
|
||||
|
||||
switch (command) {
|
||||
case 'build':
|
||||
await build();
|
||||
break;
|
||||
|
||||
case 'clean':
|
||||
console.log('Cleaning build artifacts...');
|
||||
try {
|
||||
await Deno.remove('./output', { recursive: true });
|
||||
await Deno.remove('./build', { recursive: true });
|
||||
console.log('Clean complete.');
|
||||
} catch {
|
||||
console.log('Nothing to clean.');
|
||||
}
|
||||
break;
|
||||
|
||||
case 'test-qemu':
|
||||
console.log('Testing ISO in QEMU...');
|
||||
const isoPath = './output/ecoos.iso';
|
||||
try {
|
||||
await Deno.stat(isoPath);
|
||||
} catch {
|
||||
console.error('ISO not found. Run "deno task build" first.');
|
||||
Deno.exit(1);
|
||||
}
|
||||
|
||||
const qemu = new Deno.Command('qemu-system-x86_64', {
|
||||
args: [
|
||||
'-enable-kvm',
|
||||
'-m', '4G',
|
||||
'-cpu', 'host',
|
||||
'-smp', '2',
|
||||
'-cdrom', isoPath,
|
||||
'-boot', 'd',
|
||||
'-vga', 'virtio',
|
||||
'-display', 'gtk',
|
||||
'-device', 'usb-tablet',
|
||||
'-nic', 'user,hostfwd=tcp::3006-:3006',
|
||||
],
|
||||
stdout: 'inherit',
|
||||
stderr: 'inherit',
|
||||
});
|
||||
await qemu.spawn().status;
|
||||
break;
|
||||
|
||||
default:
|
||||
console.log(`
|
||||
EcoOS ISO Builder
|
||||
|
||||
Usage:
|
||||
deno task build Build the ISO
|
||||
deno task clean Clean build artifacts
|
||||
deno task test-qemu Test ISO in QEMU
|
||||
|
||||
Requirements:
|
||||
- Ubuntu 24.04+ host
|
||||
- live-build, debootstrap, xorriso installed
|
||||
- sudo access for live-build
|
||||
`);
|
||||
}
|
||||
Reference in New Issue
Block a user