better curl/wget
This commit is contained in:
parent
e6595dc6b1
commit
30b8404f3e
10 changed files with 43 additions and 16 deletions
|
|
@ -37,6 +37,7 @@ help_tips(){
|
|||
echo 'programming languages ' "type 'ls ~/bin/helloworld*'"
|
||||
echo 'upload file to xrsh ' "type 'upload <file>'"
|
||||
echo 'download file locally ' "type 'download <file>'"
|
||||
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'"
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
|
|||
10
buildroot-v86/board/v86/rootfs_overlay/root/bin/curl
Executable file
10
buildroot-v86/board/v86/rootfs_overlay/root/bin/curl
Executable file
|
|
@ -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
|
||||
}
|
||||
4
buildroot-v86/board/v86/rootfs_overlay/root/bin/pkg
Normal file
4
buildroot-v86/board/v86/rootfs_overlay/root/bin/pkg
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
|
||||
test -z "$1" && { echo "usage: pkg <ls|install> [pkgname]"; exit 0; }
|
||||
|
||||
21
buildroot-v86/board/v86/rootfs_overlay/root/bin/wget
Executable file
21
buildroot-v86/board/v86/rootfs_overlay/root/bin/wget
Executable file
|
|
@ -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 <url> [-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
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -1,13 +0,0 @@
|
|||
#!/bin/html
|
||||
<a-box position="-1 0.5 -3" rotation="0 45 0" color="#4CC3D9"></a-box>
|
||||
<a-sphere position="0 1.25 -5" radius="1.25" color="#EF2D5E"></a-sphere>
|
||||
<a-cylinder position="1 0.75 -3" radius="0.5" height="1.5" color="#FFC65D"></a-cylinder>
|
||||
<a-plane position="0 0.05 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
|
||||
|
||||
<!--
|
||||
<a-box position="0 1.4 -0.5" scale="0.2 0.2 0.2" color="#FF00AA" grabbable></a-box>
|
||||
-->
|
||||
|
||||
|
||||
<!-- for [lowerlevel] THREE.js code see ~/index.js -->
|
||||
|
||||
|
|
@ -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 ])
|
||||
|
|
|
|||
BIN
dist/v86-linux.iso
vendored
BIN
dist/v86-linux.iso
vendored
Binary file not shown.
Loading…
Add table
Reference in a new issue