xrsh/make

62 lines
1.8 KiB
Text
Raw Normal View History

2023-11-01 11:21:41 +01:00
#!/bin/sh
REDBEAN_VERSION=https://redbean.dev/redbean-3.0.0.com
2023-12-18 09:54:52 +01:00
APP=xrsh
2024-05-22 08:23:56 +00:00
DIR=$(dirname $(readlink -f $0))
2023-11-01 11:21:41 +01:00
export PATH=$PATH:.
silent(){ "$@" 1>/dev/null 2>/dev/null; }
2024-08-30 12:09:45 +02:00
deps(){ # check dependencies
2023-11-01 11:21:41 +01:00
echo "[v] checking dependencies "
test -f ${APP}.com || {
wget "$REDBEAN_VERSION" -O ${APP}.com
chmod +x ${APP}.com
}
}
2024-08-30 12:09:45 +02:00
standalone(){ # build standalone xrsh.com binary
2024-10-28 11:12:18 +00:00
FILE=${APP}.com
test -z "$1" && {
rm ${APP}.com || true
deps
}
test -n "$1" && FILE="$1"
#cp index.html /tmp/index.html
#sed -i 's|isoterminal=".*"|isoterminal="iso: ./../xrsh.iso"|g' index.html
2024-10-28 11:12:18 +00:00
zip -x "*.git*" -r "$FILE" index.html xrsh.iso .args LICENSE src/index.{html,css} src/assets src/com/*.js src/com/isoterminal/{libv86.js,bios,v86.wasm,feat,core.js,PromiseWorker.js,ISOTerminal.js,localforage.js,VT100.js,assets,worker.js}
#cp /tmp/index.html index.html
2024-10-28 11:12:18 +00:00
sha256sum ${APP}.com > "$FILE".txt
ls -lah "$FILE"
2023-11-01 11:21:41 +01:00
}
2024-08-30 12:09:45 +02:00
dev(){ # start dev http server
2024-05-22 08:23:56 +00:00
cd "$DIR"
2024-08-02 16:15:23 +00:00
test -f xrsh.com || standalone
2024-08-06 16:50:51 +02:00
test -f /tmp/cert.pem || openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout /tmp/key.pem -out /tmp/cert.pem
2024-08-02 16:15:23 +00:00
./xrsh.com -c 0 -C /tmp/cert.pem -K /tmp/key.pem -D . "$@"
2023-11-01 11:21:41 +01:00
}
2024-08-30 12:09:45 +02:00
shell(){ # run xrsh shell via docker
OCI=$(which podman || which docker)
set -x
$OCI rm -f xrsh || true
$OCI run --name xrsh -d \
-v ./src/com/isoterminal/mnt:/mnt busybox:1.31.1-musl tail -f /dev/null
$OCI exec -it xrsh /bin/sh -i -c 'ln -s /mnt/profile /etc/profile && sh --login'
}
2024-08-30 12:09:45 +02:00
recordings(){ # compile vhs recordings
2024-08-26 19:57:35 +00:00
export PATH=$PATH:src/com/isoterminal/mnt
export BROWSER=0
test -z $1 && find src/tests/vhs/* | xargs -n1 vhs
test -z $1 || vhs $1
}
2024-08-30 12:09:45 +02:00
usage(){
echo "Usage:"
awk '/\(\){ #/ { gsub(/\(\){ #/," <----",$0); print " ./make "$0 }' $0
}
test -z $1 && usage
2023-11-01 11:21:41 +01:00
test -z $1 || "$@"