added overlayfs
All checks were successful
/ mirror_to_github (push) Successful in 29s
/ test (push) Successful in 6s

This commit is contained in:
Leon van Kammen 2025-02-18 15:24:38 +01:00
parent aa5e6849cb
commit 04275e3f2f
3 changed files with 22 additions and 12 deletions

View file

@ -14,7 +14,7 @@
* | property | type | default | info |
* |------------------|-----------|------------------------|------|
* | `iso` | `string` | https`//forgejo.isvery.ninja/assets/xrsh-buildroot/main/xrsh.iso" | |
* | `overlayfs` | `string` | *WORK-IN-PROGRESS* | |
* | `overlayfs` | `string` | '' | zip URL/file to autoextract on top of filesystem |
* | `width` | `number` | 800 ||
* | `height` | `number` | 600 ||
* | `depth` | `number` | 0.03 ||

View file

@ -141,6 +141,7 @@ ISOTerminal.prototype.start = function(opts){
// },
//screen_dummy: true,
//disable_jit: false,
overlayfs: this.opts.overlayfs,
filesystem: {},
autostart: true,
prompt: this.opts.prompt,
@ -249,16 +250,6 @@ ISOTerminal.prototype.startVM = function(opts){
this.addEventListener('emulator-started', async (e) => {
// OVERLAY FS *FIXME*
//if( me.opts.overlayfs ){
// fetch(me.opts.overlayfs)
// .then( (f) => {
// f.arrayBuffer().then( (buf) => {
// emulator.create_file('overlayfs.zip', new Uint8Array(buf) )
// })
// })
//}
let line = ''
this.ready = false
@ -287,6 +278,7 @@ ISOTerminal.prototype.bootISO = function(){
let msg = "\n\r" + msglib.empowermsg + msglib.text_color + msglib.loadmsg + msglib.text_reset
this.emit('serial-output-string', msg)
this.emit('runISO',{...this.v86opts, bufferLatency: this.opts.bufferLatency })
}

View file

@ -1,7 +1,7 @@
importScripts("libv86.js");
importScripts("ISOTerminal.js") // we don't instance it again here (just use its functions)
this.runISO = function(opts){
this.runISO = async function(opts){
this.opts = opts
if( opts.debug ) console.dir(opts)
@ -66,9 +66,13 @@ this.runISO = function(opts){
})
}
importScripts("feat/javascript.js")
importScripts("feat/index.html.js")
importScripts("feat/autorestore.js")
if( opts.overlayfs ) await this.addOverlayFS(opts)
}
/*
* forward events/functions so non-worker world can reach them
@ -94,3 +98,17 @@ this.onmessage = async function(e){
}
}
}
this.addOverlayFS = async function(opts){
return new Promise( (resolve,reject) => {
// OVERLAY FS *FIXME*
if( opts.overlayfs ){
fetch(opts.overlayfs)
.then( (f) => {
f.arrayBuffer().then( (buf) => {
this.emulator.create_file('overlayfs.zip', new Uint8Array(buf) )
})
})
}
})
}