launcher update + build
This commit is contained in:
		
							parent
							
								
									301c282125
								
							
						
					
					
						commit
						a029032b2b
					
				
					 8 changed files with 26 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -47,7 +47,7 @@ test -d /dev/browser || {
 | 
			
		|||
    stty raw < /dev/ttyS1
 | 
			
		||||
    mkfifo /var/run/ttyS1
 | 
			
		||||
    cat /dev/ttyS1 > /var/run/ttyS1 &
 | 
			
		||||
    /bin/sh < /var/run/ttyS1 > /var/run/ttyS1
 | 
			
		||||
    /bin/sh < /var/run/ttyS1 2>&1 | logger 
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  setup_listen_homedir(){
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								buildroot-v86/board/v86/rootfs_overlay/root/.config/launcher/<>
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										2
									
								
								buildroot-v86/board/v86/rootfs_overlay/root/.config/launcher/<>
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
cm /root/index.html
 | 
			
		||||
							
								
								
									
										2
									
								
								buildroot-v86/board/v86/rootfs_overlay/root/.config/launcher/js
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										2
									
								
								buildroot-v86/board/v86/rootfs_overlay/root/.config/launcher/js
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
cm /root/index.js
 | 
			
		||||
							
								
								
									
										2
									
								
								buildroot-v86/board/v86/rootfs_overlay/root/.config/launcher/say hello
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										2
									
								
								buildroot-v86/board/v86/rootfs_overlay/root/.config/launcher/say hello
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
#!/bin/sh
 | 
			
		||||
say hello world
 | 
			
		||||
| 
						 | 
				
			
			@ -2,6 +2,3 @@
 | 
			
		|||
msg = args.join(' ')
 | 
			
		||||
console.log(msg)
 | 
			
		||||
//alert(msg)
 | 
			
		||||
 | 
			
		||||
const term = document.querySelector('[isoterminal]').components.isoterminal.term
 | 
			
		||||
term.exec("logger bin/helloworld.js "+msg)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -214,15 +214,25 @@ The following files are loaded during boot (via `/etc/profile`)
 | 
			
		|||
# Calling terminal from javascript
 | 
			
		||||
 | 
			
		||||
```javascript
 | 
			
		||||
const term = document.querySelector('[isoterminal]').components.isoterminal.term
 | 
			
		||||
term.exec("ls -la")
 | 
			
		||||
const term = document.querySelector('[isoterminal]')
 | 
			
		||||
 | 
			
		||||
// interact directly with files 
 | 
			
		||||
await term.worker.create_file("hello.txt", term.convert.toUint8Array("hello") )
 | 
			
		||||
await term.worker.update_file("hello.txt", term.convert.toUint8Array("hi") )
 | 
			
		||||
await term.worker.append_file("hello.txt", term.convert.toUint8Array("world") )
 | 
			
		||||
const buf = await term.worker.read_file("hello.txt")
 | 
			
		||||
const str = new TextDecoder().decode(buf);
 | 
			
		||||
// send string to terminal prompt (/dev/tty0)
 | 
			
		||||
$('[isoterminal]').emit("send", ["ls -la\n"])
 | 
			
		||||
 | 
			
		||||
// execute cmd in terminal
 | 
			
		||||
term.emit("exec", "echo hello > /mnt/foo")
 | 
			
		||||
 | 
			
		||||
// send string to /dev/tty6 (not used, just for demo-purposes)
 | 
			
		||||
term.emit("send", ["some input", 6])
 | 
			
		||||
 | 
			
		||||
// file operations (uses /mnt)
 | 
			
		||||
$('[isoterminal]').emit("create_file", ["hello.txt","hi"]) 
 | 
			
		||||
$('[isoterminal]').emit("update_file", ["hello.txt","hello"]) 
 | 
			
		||||
$('[isoterminal]').emit("append_file", ["hello.txt","world"]) 
 | 
			
		||||
$('[isoterminal]').emit("read_file",   ["hello.txt", console.log ]) 
 | 
			
		||||
 | 
			
		||||
// programmatically trigger hook (see /root/hook.d/* )
 | 
			
		||||
term.emit("hook", [ "mimetype/text/plain", ["helloworld"] ])
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# Calling javascript from terminal 
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										
											BIN
										
									
								
								dist/v86-linux.iso
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								dist/v86-linux.iso
									
										
									
									
										vendored
									
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -3,7 +3,6 @@
 | 
			
		|||
#test -n "$ARCH"    || ARCH=i686-embedded
 | 
			
		||||
test -n "$ARCH"    || ARCH=musl32
 | 
			
		||||
test -n "$CHANNEL" || CHANNEL=nixos-24.05 
 | 
			
		||||
test -n "$1" || { echo "usage: [ARCH=...] [CHANNEL=...] build_nixpkg.sh <packagename> [outfile]"; exit 0; }
 | 
			
		||||
test -n "$1" || { echo "usage: [ARCH=...] [CHANNEL=...] build_nixpkg.sh <packagename>"; exit 0; }
 | 
			
		||||
set -xe
 | 
			
		||||
nix-build '<nixpkgs>' --pure -I nixpkgs=channel:$CHANNEL -A pkgsCross.$ARCH.pkgsStatic.$1
 | 
			
		||||
test -n "$2" && cp result/bin/$1 $2
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue