diff --git a/buildroot-v86/board/v86/rootfs_overlay/etc/profile b/buildroot-v86/board/v86/rootfs_overlay/etc/profile index 43f1b0c..0b3332a 100644 --- a/buildroot-v86/board/v86/rootfs_overlay/etc/profile +++ b/buildroot-v86/board/v86/rootfs_overlay/etc/profile @@ -37,6 +37,7 @@ help_tips(){ echo 'programming languages ' "type 'ls ~/bin/helloworld*'" echo 'upload file to xrsh ' "type 'upload '" echo 'download file locally ' "type 'download '" + echo 'download remote file ' "type 'wget https://nlnet.nl/index.html -o index.html'" echo 'paste text ' "ctrl/cmd+shift+v'" echo 'paste text to file ' "ctrl/cmd+v'" echo 'import file to scene ' "drag-drop file or ctrl/cmd+v or type 'upload'" diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/.profile b/buildroot-v86/board/v86/rootfs_overlay/root/.profile index 4859d66..f66abb0 100644 --- a/buildroot-v86/board/v86/rootfs_overlay/root/.profile +++ b/buildroot-v86/board/v86/rootfs_overlay/root/.profile @@ -4,7 +4,6 @@ alias mg='echo -e "HINT: type Ctrl+c Ctrl-x to quit\n[press a key]";read;mg'; alias nano='echo -e "HINT: type Ctrl+x to quit\n[press a key]" ;read;nano'; # save space in the iso image -alias curl="wget -q -O - " alias make="mim" # minimalist autoenv version [https://github.com/hyperupcall/autoenv] diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/bin/curl b/buildroot-v86/board/v86/rootfs_overlay/root/bin/curl new file mode 100755 index 0000000..8825b44 --- /dev/null +++ b/buildroot-v86/board/v86/rootfs_overlay/root/bin/curl @@ -0,0 +1,10 @@ +#!/bin/sh +# this is a curl stub which directly interfaces with the browsers javascript fetch() via wget +# REASON: way less overhead / complexity compared to the v86 linux networking stack + +tmp=/tmp/$$ +wget "$1" -o $tmp +test -f $tmp && { + cat $tmp + rm $tmp +} diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/bin/pkg b/buildroot-v86/board/v86/rootfs_overlay/root/bin/pkg new file mode 100644 index 0000000..01c47d3 --- /dev/null +++ b/buildroot-v86/board/v86/rootfs_overlay/root/bin/pkg @@ -0,0 +1,4 @@ +#!/bin/sh + +test -z "$1" && { echo "usage: pkg [pkgname]"; exit 0; } + diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/bin/wget b/buildroot-v86/board/v86/rootfs_overlay/root/bin/wget new file mode 100755 index 0000000..12a866f --- /dev/null +++ b/buildroot-v86/board/v86/rootfs_overlay/root/bin/wget @@ -0,0 +1,21 @@ +#!/bin/sh +# this is a wget stub which directly interfaces with the browsers javascript fetch() +# REASON: way less overhead / complexity compared to the v86 linux networking stack + +url="$1" +filename="$(basename "$url")" +tmp=/mnt/$$ + +test -z "$1" && { echo "usage: $0 [-o outfile]"; exit 0; } + +for arg in $*; do + test $arg = "-o" && shift && filename=$* + shift +done + +js '$("[isoterminal]").emit("create_file_from_url",["'$tmp'","'$url'"])' +while sleep 0.5s; do + printf "." 1>&2 + test "$(awk '{ print $1 }' $tmp)" = 0 && retcode=1 || retcode=0 + test -f $tmp && mv $tmp "$filename" && printf "\n" && exit $retcode +done diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/bin/xrsh.menu b/buildroot-v86/board/v86/rootfs_overlay/root/bin/xrsh.menu deleted file mode 100644 index 13f4793..0000000 --- a/buildroot-v86/board/v86/rootfs_overlay/root/bin/xrsh.menu +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh - diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/bin/ziprun b/buildroot-v86/board/v86/rootfs_overlay/root/bin/ziprun index 3178e76..83862c3 100755 --- a/buildroot-v86/board/v86/rootfs_overlay/root/bin/ziprun +++ b/buildroot-v86/board/v86/rootfs_overlay/root/bin/ziprun @@ -3,6 +3,12 @@ set -e # halt on error file="$1" dir="$(basename "$file")" +echo "$file" | grep -q http && { + filename="$(basename "$file")" + wget "$file" -o /tmp/$$.zip + file=/tmp/$$.zip +} + logger "$0: extracting $file" test -d "/root/$dir" && rm -rf "/root/$dir" diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/default.html b/buildroot-v86/board/v86/rootfs_overlay/root/default.html deleted file mode 100755 index d3d1591..0000000 --- a/buildroot-v86/board/v86/rootfs_overlay/root/default.html +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/html - - - - - - - - - - diff --git a/buildroot-v86/board/v86/rootfs_overlay/root/manual.md b/buildroot-v86/board/v86/rootfs_overlay/root/manual.md index 620543b..393a94f 100644 --- a/buildroot-v86/board/v86/rootfs_overlay/root/manual.md +++ b/buildroot-v86/board/v86/rootfs_overlay/root/manual.md @@ -236,6 +236,7 @@ term.emit("send", ["some input", 6]) // file operations (uses /mnt) $('[isoterminal]').emit("create_file", ["hello.txt","hi"]) +$('[isoterminal]').emit("create_file_from_url", ["index.html","https://nlnet.nl/index.html"]) $('[isoterminal]').emit("update_file", ["hello.txt","hello"]) $('[isoterminal]').emit("append_file", ["hello.txt","world"]) $('[isoterminal]').emit("read_file", ["hello.txt", console.log ]) diff --git a/dist/v86-linux.iso b/dist/v86-linux.iso index a8d201a..9c4f0ac 100644 Binary files a/dist/v86-linux.iso and b/dist/v86-linux.iso differ