added overlayfs
This commit is contained in:
parent
aa5e6849cb
commit
04275e3f2f
3 changed files with 22 additions and 12 deletions
|
|
@ -14,7 +14,7 @@
|
||||||
* | property | type | default | info |
|
* | property | type | default | info |
|
||||||
* |------------------|-----------|------------------------|------|
|
* |------------------|-----------|------------------------|------|
|
||||||
* | `iso` | `string` | https`//forgejo.isvery.ninja/assets/xrsh-buildroot/main/xrsh.iso" | |
|
* | `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 ||
|
* | `width` | `number` | 800 ||
|
||||||
* | `height` | `number` | 600 ||
|
* | `height` | `number` | 600 ||
|
||||||
* | `depth` | `number` | 0.03 ||
|
* | `depth` | `number` | 0.03 ||
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,7 @@ ISOTerminal.prototype.start = function(opts){
|
||||||
// },
|
// },
|
||||||
//screen_dummy: true,
|
//screen_dummy: true,
|
||||||
//disable_jit: false,
|
//disable_jit: false,
|
||||||
|
overlayfs: this.opts.overlayfs,
|
||||||
filesystem: {},
|
filesystem: {},
|
||||||
autostart: true,
|
autostart: true,
|
||||||
prompt: this.opts.prompt,
|
prompt: this.opts.prompt,
|
||||||
|
|
@ -249,16 +250,6 @@ ISOTerminal.prototype.startVM = function(opts){
|
||||||
|
|
||||||
this.addEventListener('emulator-started', async (e) => {
|
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 = ''
|
let line = ''
|
||||||
this.ready = false
|
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
|
let msg = "\n\r" + msglib.empowermsg + msglib.text_color + msglib.loadmsg + msglib.text_reset
|
||||||
this.emit('serial-output-string', msg)
|
this.emit('serial-output-string', msg)
|
||||||
this.emit('runISO',{...this.v86opts, bufferLatency: this.opts.bufferLatency })
|
this.emit('runISO',{...this.v86opts, bufferLatency: this.opts.bufferLatency })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
importScripts("libv86.js");
|
importScripts("libv86.js");
|
||||||
importScripts("ISOTerminal.js") // we don't instance it again here (just use its functions)
|
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
|
this.opts = opts
|
||||||
if( opts.debug ) console.dir(opts)
|
if( opts.debug ) console.dir(opts)
|
||||||
|
|
||||||
|
|
@ -66,9 +66,13 @@ this.runISO = function(opts){
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
importScripts("feat/javascript.js")
|
importScripts("feat/javascript.js")
|
||||||
importScripts("feat/index.html.js")
|
importScripts("feat/index.html.js")
|
||||||
importScripts("feat/autorestore.js")
|
importScripts("feat/autorestore.js")
|
||||||
|
|
||||||
|
if( opts.overlayfs ) await this.addOverlayFS(opts)
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* forward events/functions so non-worker world can reach them
|
* 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) )
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue